views:

34

answers:

1

I would like to have diferent views of a webpage depending on certains attributes of an item that I am showing.

This is: if the item is in the category X then I show some sections of the page. In other category I show others.

There is others attributes of the item.

I am aware of the multitenant plugin, but I think that is not what I am looking for.

I am thinking of something that maps a hierarchy of attributes with a particular grails view or layout. Maybe obtaining the name of the layout and view concatening the attributes some how to respect convention over configuration.

But I am concern in maintainability.

Can you give me any pointer?

+1  A: 

You have a bunch of options

  1. put the branching logic in a controller, and render different views based on the data
  2. put the branching logic in a gsp, and simply don't render different parts based on the model passed into the gsp

You can make the code clean in either way by making use of templates, to stay DRY.

hvgotcodes