Announcing the “Navigation” Plugin for Grails
Another plugin release… this time thanks to help from Andreas Arledal on the CSS front.
The Navigation Plugin gives you site navigation menus by convention. You just define a property in your controllers to determine what actions are shown and in what groups.
There is even a default styling of neutral “silver” buttons that you can use, or override the CSS easily, or use tags to render the items any way you like.
Part of the motivation for this is that if we can establish a “de facto” convention for navigation info, then plugins will be able to use it, to have functionality that just automatically “pops up” in your existing application.
Anyway now when you are prototyping your apps you can just add “static navigation = true” to your controllers, and add <nav:render/> to your GSP layout… and away you go!
Enjoy!






















17 Comments
Matthew Taylor
January 27, 2009I can’t decide which is better… this Navigation plugin or your recipe for chili paste
Marc Palmer
January 27, 2009You’re too kind. I can assure you the chilli paste is better on toast, and the nav plugin helps people get around your sites better than the paste.
Dreur
January 28, 2009I prefer the chili paste
Thanks for the plugin seem nice.
Martin Flower
January 28, 2009Is this a broken link in the documentation ? (http://www.grails.org/Navigation+Plugin)
!Picture 1.png!
Marc Palmer
January 29, 2009Martin – there is a problem with image upload, so I could not upload the image, so I included it on this blog post for now. I will link to the version on my site for the time being
Chris Masters
January 30, 2009Just installed your plugin works great!
Many thanks – but for those people who cannot get it from plugin list (1.1 beta 2 it didn’t show up…) it is handy to know that
grails install-plugin http://plugins.grails.org/grails-navigation/tags/RELEASE_1_0/grails-navigation-1.0.zip
Does the trick.
Richard
February 22, 2009Hi
Great plugin – except I can’t get the auth example to work in 1.0.4
Any clues? I get an NPE as soon as I try to make the navigation a map instead of an array.. whether i include one or more members as in your example.
class AuthController {
static navigation = [
[group:'userOptions', action:'login', order: 0, isVisible: { session.user == null }]
]
…
the stack trace includes this
2009-02-22 22:02:26.208::WARN: Nested in org.springframework.beans.factory.access.BootstrapException: Error executing bootstraps; nested exception is org.codehaus.groovy.runtime.InvokerInvocationException: java.lang.NullPointerException:
java.lang.NullPointerException
at NavigationService$_registerItem_closure4.doCall(NavigationService.groovy:74)
at NavigationService.registerItem(NavigationService.groovy:71)
at NavigationGrailsPlugin$_refreshNavigation_closure7.doCall(NavigationGrailsPlugin.groovy:47)
at NavigationGrailsPlugin.refreshNavigation(NavigationGrailsPlugin.groovy:40)
at NavigationGrailsPlugin.this$2$refreshNavigation(NavigationGrailsPlugin.groovy)
at NavigationGrailsPlugin$_closure4.doCall(NavigationGrailsPlugin.groovy:27)
at RunApp_groovy$_run_closure2_closure7.doCall(RunApp_groovy:67)
at RunApp_groovy$_run_closure2_closure7.doCall(RunApp_groovy)
at Init_groovy$_run_closure6.doCall(Init_groovy:131)
at RunApp_groovy$_run_closure2.doCall(RunApp_groovy:66)
at RunApp_groovy$_run_closure2.doCall(RunApp_groovy)
at RunApp_groovy$_run_closure1.doCall(RunApp_groovy:57)
at RunApp_groovy$_run_closure1.doCall(RunApp_groovy)
at gant.Gant.dispatch(Gant.groovy:271)
at gant.Gant.this$2$dispatch(Gant.groovy)
at gant.Gant.invokeMethod(Gant.groovy)
at gant.Gant.processTargets(Gant.groovy:436)
at gant.Gant.processArgs(Gant.groovy:372)
Thanks!
Richard
Richard
February 23, 2009OK, after realising I shouldn’t file bugs in blogs, especially after 11pm
I debugged this and filed
https://fisheye.codehaus.org/browse/GRAILSPLUGINS-919
Richard
Masih
March 8, 2009Hi Mark,
Thank you for the Navigation plugin.well done.
i have been playing with the nav plugin and i came up with some ideas to make it more flexible,
it is nice to have horizontal or vertical menu option in the plugin, and the sub menu items , i think a simple javascript menu works great on that.
i am working on it and just wanted to know if you are planning to add more features in navigation plugin
thanks
David
September 12, 2010Please let all know when you have the vertical menu done!
Scott
August 19, 2009Just trying this out today (1.1). Looks pretty useful. I am wondering if the isVisible closure should be able to access actionName and controllerName, this way it would be possible to add items that only appear on specific pages.
Cheers,
Scott
Chris
July 6, 2010Hi,
nice Plugin!!! But one question: How do you render a single Item out of a group?
I want the Navigation to be in a left Panel, with SubItems directly below the active Item. Thinking about something like that:
<nav:eachItem group="
David
September 13, 2010Hi, how far have u gotten with your left panel plan for nav?
Martin Gee
October 3, 2010Awesome plugin! What are the futures for this plugin?
Nirav Assar
November 26, 2010The navigation plugin you have is fantastic. Thanks for that.
Ravi
July 22, 2011Will you be fixing the issues for http://jira.grails.org/browse/GPNAVIGATION or will it have to stay like that?
Marc Palmer
July 27, 2011I will as soon as I get a chance. I don’t get paid to work on the plugins, and finding time is tricky.