Module: NubisRailsBoilerplate::ActiveAdminHelpers
- Included in:
- ActiveAdmin::ResourceDSL, ActiveAdmin::Views::Pages::Show
- Defined in:
- lib/extra_activeadmin.rb
Instance Method Summary collapse
- #attributes_table_with_images(&config) ⇒ Object
- #form_with_images(section_title = "Images", &config) ⇒ Object
Instance Method Details
#attributes_table_with_images(&config) ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/extra_activeadmin.rb', line 25 def attributes_table_with_images(&config) attributes_table do config.call row :images do |item| item.images.collect do |image| image_tag(image.file.url(:small)) end.join.html_safe end end active_admin_comments end |
#form_with_images(section_title = "Images", &config) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/extra_activeadmin.rb', line 6 def form_with_images(section_title = "Images", &config) form html: {id: 'has_many_images', multipart: true} do |f| f.inputs("#{f.object.class.to_s} Details"){ config.call(f) } f.has_many :images, title: 'images' do |fi| fi.inputs "Images" do if fi.object.new_record? fi.input :file, as: :file else fi.input :_destroy, :as => :boolean, :label => "Destroy?", :hint => fi.template.image_tag(fi.object.file.url(:small)) end end end f.actions end end |