java - How to create "clone" of controller in Grails? -
I have a menu that is loaded with the main layout. In the menu, I need to highlight a specific menu if users click on that menu and I find it based on the controller name.
I have 2 menus who have different names, such as User Editing and Client Edit. Both actually share the same controller (i.e.: UserController) and the same domain.
I tried to create a nickname for this in UrlMappings like ": / client / edit /" (Controller: "user", Action: "edit")
But the layout on the main does not appear to be recognized as "customer" but as a "user"
Is there a good way to solve this problem without repetition? Am I the successor to the controller? If so how do ...
Thank you very much.
Use a filter to add the name of the controller to the model and modify it to suit Do:
For example, put it in /grails-app/conf/MenuAddingFilter.groovy
class menuadding filter {static filter = {all (controller: '*', verb : '*') {After = {model -> Model.menuName = controllerName.replace ("Controller", "")}}}}
Then in your .gsp page, you will have the property of the menu name available for use. See for more information.
Comments
Post a Comment