Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I use action text on active admin

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?

like image 815
godwon Avatar asked Sep 11 '19 10:09

godwon


1 Answers

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

Install

  • Add this to your Gemfile gem 'activeadmin_quill_editor'

  • in your app/assets/stylesheets/active_admin.scss file, add this:

@import 'activeadmin/quill_editor_input';
  • in your app/assets/javascripts/active_admin.js file, add this:
//= require activeadmin/quill_editor/quill
//= require activeadmin/quill_editor_input

Example

# 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
like image 186
Grofen Avatar answered Sep 28 '22 11:09

Grofen