Forum: Ruby on Rails User editable webpages

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
C4bfcc81ac9281cb905f38e97e4d4e0b?d=identicon&s=25 Shandy Nantz (snantz)
on 2008-10-24 19:59
I have to build this webpage where the user can select the color, add a
picture, overall make the layout the way that they want. Can anyone
point me to a tutorial and give me some suggestions on how to get
started on this, I am unsure how to proceed. Thanks,

-S
A45f650cce5746dd89aafb3176b47b02?d=identicon&s=25 DyingToLearn (Guest)
on 2008-10-25 11:49
(Received via mailing list)
I don't know of a tutorial that can do this, but here is how I would
approach the problem:

For changing colours, you need to change the CSS. You should probably
break your CSS into (at least) two CSS files. One containing the
normal CSS, and one containing what the user is permitted to change.

Then you need to generate CSS files on the fly based on the user's
input. You could probably have a template file, and then do a gsub to
fill in all the colours (or other options that can be changed). Then
save this generated CSS file in public/stylesheets/
custom_for_user_id.css (or whatever make sense).

Then in you view layout you can do
stylesheet_link_tag("custom_for_#{user.id}").

If you really want to let users make the layout any "way that they
want", then you should probably just let them upload their own CSS. I
think typo has some code that allows the user to edit the CSS directly
from the web UI. You might want to look into that if your users need
that much freedom.

HTH
This topic is locked and can not be replied to.