| 1 | ActiveAdmin.register JavaneseGending do |
| 2 | menu priority: 8, parent: 'Javanese Gending' |
| 3 | permit_params :name, :description, :notation, :user_id |
| 4 | |
| 5 | index do |
| 6 | selectable_column |
| 7 | column :name |
| 8 | column 'NEW Notation' do |gending| |
| 9 | if gending.javanese_gending_notation.count.positive? |
| 10 | gending.javanese_gending_notation.each_with_index do |notation, _index| |
| 11 | a "#{notation.name} #{notation.rich_format.nil? ? 'No ⛔️' : 'Yes ✅'}", |
| 12 | href: admin_javanese_gending_notation_url(notation) |
| 13 | text_node ' | '.html_safe |
| 14 | a 'edit', href: edit_admin_javanese_gending_notation_url(notation) |
| 15 | text_node '</br>'.html_safe |
| 16 | end |
| 17 | nil |
| 18 | end |
| 19 | link_to 'Tambah', new_admin_javanese_gending_notation_path(javanese_gending_id: gending.id.to_s) |
| 20 | end |
| 21 | column :description do |gending| |
| 22 | strip_tags gending.description.truncate 150 |
| 23 | end |
| 24 | column :user |
| 25 | column :views_count |
| 26 | actions |
| 27 | end |
| 28 | |
| 29 | show do |
| 30 | attributes_table do |
| 31 | row :name |
| 32 | row :notation |
| 33 | row :user |
| 34 | row :description do |gending| |
| 35 | raw gending.description |
| 36 | end |
| 37 | row :created_at |
| 38 | row :updated_at |
| 39 | end |
| 40 | end |
| 41 | |
| 42 | form do |f| |
| 43 | f.inputs do |
| 44 | f.input :name |
| 45 | f.input :user |
| 46 | f.input :description, as: :quill_editor |
| 47 | f.input :notation, as: :quill_editor |
| 48 | end |
| 49 | f.actions |
| 50 | end |
| 51 | end |