| 1 | ActiveAdmin.register JavaneseGendingNotation do |
| 2 | menu priority: 9, parent: 'Javanese Gending' |
| 3 | permit_params :name, :notation, :user_id, :javanese_gending_id, :rich_format |
| 4 | json_editor |
| 5 | |
| 6 | index do |
| 7 | selectable_column |
| 8 | column :name |
| 9 | column :notation do |gending| |
| 10 | strip_tags gending.notation.truncate 150 |
| 11 | end |
| 12 | column :rich_format do |gending| |
| 13 | gending.rich_format.nil? ? 'No ⛔️' : 'Yes ✅' |
| 14 | end |
| 15 | column :javanese_gending |
| 16 | column :user |
| 17 | column :views_count |
| 18 | actions |
| 19 | end |
| 20 | |
| 21 | show do |
| 22 | attributes_table do |
| 23 | row :name |
| 24 | row :javanese_gending |
| 25 | row :user |
| 26 | row :notation do |gending| |
| 27 | raw gending.notation |
| 28 | end |
| 29 | row :rich_format |
| 30 | row :created_at |
| 31 | row :updated_at |
| 32 | end |
| 33 | end |
| 34 | |
| 35 | form do |f| |
| 36 | f.inputs do |
| 37 | f.input :name |
| 38 | if f.object.new_record? |
| 39 | f.input :javanese_gending, include_blank: false, selected: params[:javanese_gending_id] |
| 40 | else |
| 41 | f.input :javanese_gending, include_blank: false |
| 42 | end |
| 43 | f.input :rich_format, as: :json |
| 44 | f.input :user |
| 45 | f.input :notation, as: :quill_editor |
| 46 | end |
| 47 | f.actions |
| 48 | end |
| 49 | end |