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. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.
On Thursday, 30 August 2012 05:13:57 UTC-5, Ruby-Forum.com User wrote:> > 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. >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. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/8cefqb7DF2UJ. For more options, visit https://groups.google.com/groups/opt_out.
Jordon Bedwell 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 -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.
On Thursday, 30 August 2012 05:26:14 UTC-5, Ruby-Forum.com User wrote:> > Jordon Bedwell 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 >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. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/GuJq_qsx2bwJ. For more options, visit https://groups.google.com/groups/opt_out.
Jordon Bedwell 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 -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.