vol1ura/Sat_9am_5km

View on GitHub
app/views/admin/badges/_form.html.arb

Summary

Maintainability
Test Coverage
# frozen_string_literal: true

active_admin_form_for [:admin, resource] do |f|
  f.inputs 'Фан-ран награда' do
    input :name
    input :received_date, required: true if f.object.funrun_kind?
    input :conditions, as: :quill_editor,
                       required: true,
                       input_html: {
                         data: {
                           options: {
                             modules: {
                               toolbar: [
                                 %w[bold italic strike],
                                 %w[blockquote code-block],
                                 [{ list: 'ordered' }, { list: 'bullet' }],
                                 ['link'],
                                 ['clean']
                               ],
                             },
                             placeholder: 'Необходимо очень постараться...',
                             theme: 'snow',
                           },
                         },
                       }
    input :image, as: :file, input_html: { accept: 'image/png' }, required: true if f.object.funrun_kind?
  end

  f.actions
end