Rails:让最终用户可以编辑视图? [英] Rails: Make views editable by end-users?

查看:33
本文介绍了Rails:让最终用户可以编辑视图?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

无论如何我可以使最终用户可以编辑我的 Rails 视图中的内容吗?这样他们就可以在我允许的页面上进行简单的文本更改,而无需我自己编辑 HAML 文件?

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?

想法?

澄清:

我了解 CMS 系统,但我认为这并不完全是我想要的.我想保持对我的视图的编程控制,但是我希望用户能够直接编辑某些部分(例如,我仍然需要用产品、购物车、数据库博客条目等填充页面,但是我希望用户能够编辑关于我们"页面或联系我们"页面,或编辑产品类别页面的标题文本,或提供任何这些页面的更新翻译).

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).

我知道我可以将这些部分放在数据库中,但由于它只是大量的直接文本,所以这种方法有些不对劲(无法理解我如何干净有效地组织它).我可以从文本文件中提取这些东西吗?用 Textile/Markdown 格式化?这是一个可行的方法吗?或者基于数据库的方法可能是可行的方法?

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 stuff from text files? Formatted in Textile/Markdown? Would that be a feasible approach? Or is a database-based approach probably the way to go?

推荐答案

您正在描述一个 CMS.查看 BrowserCMSRadiantCMS.

You are describing a CMS. Check out BrowserCMS and RadiantCMS.

简而言之,您需要提取页面中可编辑的部分,并将它们存储在某处,通常是数据库.您可以让用户通过典型的 Web 表单编辑页面的这些部分.ajax/就地编辑的额外加分,但除此之外,它没有太多魔力.如果您不需要完整的 CMS,此 railscast 也可能有用.

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.

这篇关于Rails:让最终用户可以编辑视图?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆