feature/share-libs
rb 46 lines 1.3 KB
Raw
1 # frozen_string_literal: true
2
3 # TODO: Fix this later
4 # rubocop:disable Metrics/BlockLength
5 ActiveAdmin.register AudioFile do
6 menu priority: 6, parent: 'SplitFire 🔥'
7 permit_params :song_provider_id, :is_public, :locale
8
9 index do
10 selectable_column
11 column 'Image', max_width: '200px', min_width: '100px' do |file|
12 if file.song_provider.present? && file.song_provider.image_url.present?
13 image_tag(file.song_provider.image_url, width: 200,
14 height: 100)
15 end
16 end
17 column :song_provider
18 column 'Split results' do |file|
19 if file.splitfire_results.count.positive?
20 file.splitfire_results.each_with_index do |result, _index|
21 a result.source_file.blob.filename, href: admin_splitfire_result_url(result)
22 text_node ' | '.html_safe
23 a 'edit', href: admin_splitfire_result_url(result)
24 text_node '</br>'.html_safe
25 end
26 nil
27 end
28 end
29 actions
30 end
31
32 filter :song_provider
33 filter :created_at
34 filter :updated_at
35
36 show do
37 attributes_table do
38 row :song_provider
39 row :source_file do |file|
40 file.source_file.blob.filename if !file.source_file.nil? && !file.source_file.blob.nil?
41 end
42 row :created_at
43 row :updated_at
44 end
45 end
46 end