Is there anyway I can make content in my Rails views editable by end-users? Such that they can make simple text changes on pages I permit them to without having me edit the HAML files myself?
Thoughts?
CLARIFICATION:
I know about CMS systems, and I don't think that's entirely what I want. I want to maintain programatic control over my views, but there are sections that I want the user to be able to edit directly (for instance, I still need to populate the page with products, shopping cart, database blog entries, etc., but I want the user to be able to edit the "About Us" page or the "Contact Us" page, or edit the header text of a product category page, or provide an updated translation of any of those pages).
I know I can put these sections in a database, but since it's just a bulk of straight text, something didn't feel right about that approach (couldn't make sense of how I'd organize that cleanly and efficiently). Could I pull this stu开发者_如何学运维ff from text files? Formatted in Textile/Markdown? Would that be a feasible approach? Or is a database-based approach probably the way to go?
You are describing a CMS. Check out BrowserCMS and RadiantCMS.
In short, you need to extract out parts of the page that are editable, and store them somewhere, typically the DB. You can have users edit those parts of the page via your typical web forms. Extra points for ajax/in-place editing, but other than that there's not much magic to it. This railscast may also be useful if you don't need a full blown CMS.
Take a look at Liquid. It's a pretty powerful templating language extracted from Shopify.
One option would be to use one of the many CMS's (BrowserCMS rocks) or use one of the I18n tools that give you an editor for your i18n files, and make sure all your text is pulled from a language file.
精彩评论