# User editable webpages

**URL:** <https://www.ruby-forum.com/t/user-editable-webpages/151719>\
**Category:** Rails\
**Created:** [October 24, 2008, 7:59pm UTC](https://www.ruby-forum.com/t/user-editable-webpages/151719 "2008-10-24T19:59:08Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![snantz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/c2a13f/32.png) [@snantz](https://www.ruby-forum.com/u/snantz)\
**Post date:** [October 24, 2008, 7:59pm UTC](https://www.ruby-forum.com/t/user-editable-webpages/151719/1 "2008-10-24T19:59:08Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![snantz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/c2a13f/32.png) [@snantz](https://www.ruby-forum.com/u/snantz)\
**Post date:** [October 25, 2008, 11:49am UTC](https://www.ruby-forum.com/t/user-editable-webpages/151719/2 "2008-10-25T11:49:17Z")

</div>

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
