Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Grails- brandable application

Tags:

grails

Here's the challenge: depending on the incoming URL I want to display a specific landing page and, upon login, a specific user experience based on the identity of the user.

For example, both www.abc.com and www.xyz.com point to a single Grails instance providing a common portal experience. If the user arrived via www.abc.com, I want to display the ABC splash page with login form. If the user arrived via www.xyz.com, I want to display the XYZ splash page with login form.

Once the user logs in, I'll need to keep the original "brand" context as determined by the incoming URL. For example, even through all the GSPs, controllers, etc. are shared by all users, ABC users will pick up their own CSS, resource bundles (or entries), etc. and the user will have a very different visual experience than XYZ users.

Is this possible? Or do I need to branch the application codebase and host multiple independent portal instances?

like image 360
ecodan Avatar asked Sep 01 '10 18:09

ecodan


1 Answers

http://www.grails.org/Views+and+Layouts

take a look, I think it can solve 90% of your problems. Have a specific layout for each domain. The layouts are loaded for each view and can assist in defining the look and feel

you can can set variable in a filter, based on the URL, which could then be read in the layout http://www.grails.org/Filters

class MyFilters {
   def filters = {
        myFilter(controller:'*', action:'*') {
            after = {
              if (request.requestURI == "xyz") {
                session.layout = "layout1.gsp"
              } else {
                session.layout = "layout2.gsp"
              }
           } 
        }
   }
}
like image 88
Aaron Saunders Avatar answered Sep 20 '22 08:09

Aaron Saunders