feature/share-libs
rb 46 lines 953 Bytes
Raw
1 ActiveAdmin.register Lyric do
2 menu priority: 6, parent: 'Music Database'
3 permit_params :song_id, :lyric, :locale, :user_id
4
5 index do
6 selectable_column
7 column :lyric do |lyric|
8 strip_tags lyric.lyric.truncate 150
9 end
10 column :song
11 column :user
12 column :views_count
13 actions
14 end
15
16 filter :song
17 filter :views_count
18 filter :lyric
19 filter :created_at
20 filter :updated_at
21
22 show do
23 attributes_table do
24 row :song
25 row :user
26 row :lyric do |song|
27 raw song.lyric
28 end
29 row :created_at
30 row :updated_at
31 end
32 end
33
34 form do |f|
35 f.inputs do
36 if f.object.new_record?
37 f.input :song, include_blank: false, selected: params[:song_id]
38 else
39 f.input :song, include_blank: false
40 end
41 f.input :user, include_blank: false
42 f.input :lyric, :input_html => { :class => "tinymce", :style => 'width: auto' }
43 end
44 actions
45 end
46 end