在Rails中,如何实现一个所见即所得编辑器,供用户创建蜗牛邮件套用信函(带有模板标签)
我在这里看到很多涉及所见即所得编辑器等的问题,但还没有找到我需要完成的任务的解决方案。我有一个 Rails 3.2 应用程序,其中包含一些客户端信息。我们正在向个人发送一些普通邮件套用信函和其他印刷文件。目前我们使用 Word 进行邮件合并,但我想将此功能构建到应用程序中。
我想让管理员能够创建新的套用信函(或其他格式相对简单的文档)。他们的编辑还会提供一些预设模板标签以在信件中使用。在文档创建编辑器中类似于以下内容:
%%person.address.street%%
%%person.address.city%%, %%person.address.state%% %%person.address.zip_code%%
%%current_date%%
Dear %%person.first_name%%,
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque iaculis felis
nec quam elementum sit amet laoreet sapien feugiat. Cras tincidunt dignissim
eleifend. Integer hendrerit turpis at odio mollis eget ultricies est dictum.
Donec feugiat turpis eget enim lacinia suscipit...
Sincerely,
%%user.first_name%% %%user.last_name%%
管理员可以将此文档模板另存为“欢迎信”之类的内容。然后,在查看人员记录时,将有一个选项“生成欢迎信”。
是否有一个好的解决方案来为管理员创建一个文档编辑器,并且允许使用此类模板标签?
I see a lot of questions here dealing with WYSIWYG editors, etc. but haven't found a solution to what I need to accomplish. I have a Rails 3.2 app with some client information. We are sending some snail-mail form letters and other printed documents to individuals. Currently we are using Word with a mail merge, but I would like to build this functionality into the app.
I would like to give admins the ability to create a new form letter (or other document with relatively simple formatting). Their editor would also provide some preset template tags to use within the letter. Something like the following in their document creation editor:
%%person.address.street%%
%%person.address.city%%, %%person.address.state%% %%person.address.zip_code%%
%%current_date%%
Dear %%person.first_name%%,
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque iaculis felis
nec quam elementum sit amet laoreet sapien feugiat. Cras tincidunt dignissim
eleifend. Integer hendrerit turpis at odio mollis eget ultricies est dictum.
Donec feugiat turpis eget enim lacinia suscipit...
Sincerely,
%%user.first_name%% %%user.last_name%%
Admins could save this document template as something like "Welcome Letter." Then while viewing a Person record, there would be an option to "Generate Welcome Letter."
Is there a good solution for creating a document editor for admins that also allows for the use of such template tags?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用模板标记语言,例如 liquid 或 小胡子。困难的部分似乎是让编辑器的用户界面足够友好,供非技术人员使用。
You could use a template markup language such as liquid, or mustache. The hard part seems to be making the UI for the editor friendly enough for non-technical people to use.