Add html to active admin page

I would like to add either any html or div to the active admin form so that I can add a progress bar for loading the jquery file to the page of the active admin form. Currently my form is as follows:

  form(:html => { :multipart => true}) do |f|
    f.inputs "Studio" do
      f.input :name
      f.input :position
      f.input :description
      f.input :image, :label => "Image - (must be 335x221px)"
      f.input :gallery_image, :label => "Image - (must be 600x400px)"
    end
    f.actions 
  end

Let's say I wanted to add a div above each of the loaders to show the progress of loading, how would I add some div above each?

+3
source share
2 answers

You must transfer your form to the view and make changes there.

app / admin / studio.rb

form do |f|              
    render partial: 'form'                        
end  

app / views / admin / studio / _form.html.erb

<%= form(:html => { :multipart => true}) do |f| %>
    <div class="progress">...</div>
    <%= f.inputs "Studio" do %>
         <%= f.input :name %>
         <%= f.input :position %>
         <%= f.input :description %>
         <%= f.input :image, :label => "Image - (must be 335x221px)" %>
         <%= f.input :gallery_image, :label => "Image - (must be 600x400px)" %>
    <% end %>
    <%= f.actions  %>
<% end %>
+2
source

Active admin created DSL on top of Formtastic according to their docs

https://github.com/activeadmin/activeadmin/blob/master/docs/5-forms.md

, :

form do |f|
  f.semantic_errors(*f.object.errors.keys)

  import_errors = self.controller.instance_variable_get("@errors")
  if import_errors.present?
    ul class: 'errors' do
      import_errors.each do |e|
        li e
      end
    end
  end
0

All Articles