feature/share-libs
rb 54 lines 1.23 KB
Raw
1 ActiveAdmin.register Artist do
2 menu priority: 3, parent: 'Music Database'
3 permit_params :name, :user_id, :description
4
5 index do
6 selectable_column
7 column :name
8 column :description do |artist|
9 strip_tags artist.description.truncate 150
10 end
11 column 'Albums', max_width: '800px', min_width: '400px' do |artist|
12 if artist.album.count.positive?
13 artist.album.each_with_index do |album, _index|
14 a album.name, href: admin_album_url(album)
15 text_node ' | '.html_safe
16 a 'edit', href: edit_admin_album_url(album)
17 text_node '</br>'.html_safe
18 end
19 text_node '</br>'.html_safe
20 end
21 link_to 'Tambah', new_admin_album_path + '?artist_id=' + artist.id.to_s
22 end
23 column :user
24 column :views_count
25 actions
26 end
27
28 filter :album
29 filter :views_count
30 filter :name
31 filter :created_at
32 filter :updated_at
33
34 show do
35 attributes_table do
36 row :name
37 row :user
38 row :description do |artist|
39 raw artist.description
40 end
41 row :created_at
42 row :updated_at
43 end
44 end
45
46 form do |f|
47 f.inputs do
48 f.input :name
49 f.input :user
50 f.input :description, as: :quill_editor
51 end
52 f.actions
53 end
54 end