Rails 中的文本字段和模板
我有一个 Rails 3 应用程序和一个奇怪的问题,我在解决过程中遇到了很多麻烦。我有一个包含三个字段的表单:标题(文本字段)、引导(文本区域)、正文(文本区域)、Kicker(文本区域)。我想通过某种模板将它们编译成一篇“文章”。模板看起来像这样:
<b> [Title] </b>
<p> [Lead In] </p>
<p> [body] </p>
<p> [Kicker] </p>
如果它是静态的就很好了。但我希望能够提供多个模板,并且我希望根据这些模板自动创建表单。是否已经有一些东西可以解决这个模板问题?如果没有,任何第一步都会很有帮助。
谢谢!
I have a rails 3 app and a weird problem that I'm having a lot of trouble working through. I have a form with three fields: Title (Text Field), Lead in (Text Area), Body (Text Area), Kicker(Text Area). I'd like to compile them into a an "Article" via a template of some sort. The template would look something like this:
<b> [Title] </b>
<p> [Lead In] </p>
<p> [body] </p>
<p> [Kicker] </p>
This would be fine if it was static. But I'd like to be able to offer multiple templates, and I'd like to autocreate forms based on those templates. Is there something out there already that is a solution to this templating problem? If not, any first steps would be way helpful.
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
https://github.com/defunkt/mustache
这是一个非常漂亮的模板工具。
https://github.com/defunkt/mustache
That is a pretty nifty templating tool to use.