Use columns in the ActiveAdmin form.

I am using ActiveAdmin for my Rails project. How do I style the resource form view using columns

like in a view view inside a relationship has_many

(column-wise, I mean have two or three separate blocks of floating content)?

Here is the code I tried to set up (I used .arb views):

f.inputs t('activerecord.models.slide.other') do
  f.has_many :slides, heading: false do |item|

    # I would like to be a first column
    item.input :image,
                 as: :file,
                 label: I18n.t('form.label.slide'),
                 hint: retina_image_tag(item.object, :image, :preview)
    item.input :online,
                 as: :boolean,
                 hint: I18n.t('')

    if item.object.self_image?
      item.input :_destroy,
                   as: :boolean,
                   hint: I18n.t('form.hint.slide.destroy')

    # I would like to be a second column
    item.translated_inputs 'Translated fields', switch_locale: true do |t|
      t.input :title, hint: I18n.t('form.hint.title')
      t.input :description,
                hint: I18n.t('form.hint.content')


Thank you for your help!


source to share

1 answer

add custom CSS to erase the default AA styles. Apply float: left and width of half screen size.

        fieldset > ol
            fieldset.inputs.has_many_fields > ol > li.input
              float: left
              clear: none
              width: 47% 
              float: right
              clear: both 




All Articles