如何在活动管理员上使用操作文本 [英] How can I use action text on active admin
问题描述
我正在使用 rails 6.0.0 和 ruby 2.6.0,我想知道在 ActiveAdmin 中使用 ActionText 的最佳方法是什么,我应该使用渲染吗?
i'm using rails 6.0.0 and ruby 2.6.0, I want to know what's the best way to use ActionText in ActiveAdmin, should I have to use render?
推荐答案
我在 ActiveAdmin 中使用了这个 f.rich_text_area :content
但它对我不起作用所以我添加了 <自定义表单中的 trix-editor>
标签遵循此 Form Partial Tricks 但这也不起作用,所以我最终使用了这个 gem ActiveAdmin Quill Editor易于设置且运行良好
I used this f.rich_text_area :content
inside ActiveAdmin but it didn't work for me so I added <trix-editor>
tag inside a custom form following this Form Partial Tricks
but also this didn't work so I ended up using this gem ActiveAdmin Quill Editor it was easy to setup and worked perfectly
将此添加到您的 Gemfile
gem 'activeadmin_quill_editor'
在您的 app/assets/stylesheets/active_admin.scss
文件中,添加:
in your app/assets/stylesheets/active_admin.scss
file, add this:
@import 'activeadmin/quill_editor_input';
- 在您的
app/assets/javascripts/active_admin.js
文件中,添加: - in your
app/assets/javascripts/active_admin.js
file, add this:
//= require activeadmin/quill_editor/quill
//= require activeadmin/quill_editor_input
示例
# ActiveAdmin article form conf:
form do |f|
f.inputs 'Article' do
f.input :title
f.input :description, as: :quill_editor
f.input :published
end
f.actions
end
这篇关于如何在活动管理员上使用操作文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!