How to change theme in rails 3.2.7

I’m using rails 3.2.7.

I have few themes in my public/themes folder.
For example in my theme-1 folder
there is one index.html + style.css + few images (if required)

At the time of registration user will select one theme. Now when the
user will login that theme will display. I will use handle
bar(http://handlebarsjs.com/) for data insertion.

My main problem is that how I’ll load the theme from public/themes
folder to the user after login.

My controller is below after user login

class ClientUsersController < ApplicationController

def index

end

end

Right now when user login he will redirect to index method and
index.html.erb data display to him with application.html.erb layout.

So how I will display the theme instead of application layout.

On Thursday, 30 August 2012 05:13:57 UTC-5, Ruby-Forum.com User wrote:

end

Right now when user login he will redirect to index method and
index.html.erb data display to him with application.html.erb layout.

So how I will display the theme instead of application layout.

Store all the CSS files and image files in hierarchical (except for the
stylesheets) order inside of the assets folders and then store their
preference in the session and use stylesheet_link_tag(session[:theme] || :default) but you might add in an extra check to make sure the theme
exists first I guess to prevent simple tampering.

Jordon B. wrote in post #1073894:

On Thursday, 30 August 2012 05:13:57 UTC-5, Ruby-Forum.com User wrote:

end

Right now when user login he will redirect to index method and
index.html.erb data display to him with application.html.erb layout.

So how I will display the theme instead of application layout.

Store all the CSS files and image files in hierarchical (except for the
stylesheets) order inside of the assets folders and then store their
preference in the session and use stylesheet_link_tag(session[:theme] || :default) but you might add in an extra check to make sure the theme
exists first I guess to prevent simple tampering.

Thx Jordon

But where should I keep my theme1/index.html file

On Thursday, 30 August 2012 05:26:14 UTC-5, Ruby-Forum.com User wrote:

Thx Jordon

But where should I keep my theme1/index.html file

Depending on what it has in it, what I would do is turn it into a
template
in the folder of the controller and just add a manual render at the
bottom
of the controller that triggers based on the theme. So if your
controller
is UserController and the theme is theme1 then I would make
theme1/index.html into app/views/user/theme1.erb and then do render
:theme1
in the controllers action. Though at the point I don’t know what you
would
need mustache/handlebar for unless it’s entirely Ajax.

Jordon B. wrote in post #1073902:

On Thursday, 30 August 2012 05:26:14 UTC-5, Ruby-Forum.com User wrote:

Thx Jordon

But where should I keep my theme1/index.html file

Depending on what it has in it, what I would do is turn it into a
template
in the folder of the controller and just add a manual render at the
bottom
of the controller that triggers based on the theme. So if your
controller
is UserController and the theme is theme1 then I would make
theme1/index.html into app/views/user/theme1.erb and then do render
:theme1
in the controllers action. Though at the point I don’t know what you
would
need mustache/handlebar for unless it’s entirely Ajax.

Thx Jordon

Now I’ll put theme folder in view section
app/views/themes/theme1
app/views/themes/theme1/index.html
app/views/themes/theme1/style.css
app/views/themes/theme1/image

Is it not possible if I put all these folders in public
public/themes/theme1
public/themes/theme1/index.html
public/themes/theme1/style.css
public/themes/theme1/image

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs