diff --git a/administrate-field-active_storage.gemspec b/administrate-field-active_storage.gemspec index 365ea10..72b6768 100644 --- a/administrate-field-active_storage.gemspec +++ b/administrate-field-active_storage.gemspec @@ -2,7 +2,7 @@ $:.push File.expand_path("../lib", __FILE__) Gem::Specification.new do |gem| gem.name = "administrate-field-active_storage" - gem.version = "0.1.5" + gem.version = "0.1.6" gem.authors = ["Hamad AlGhanim"] gem.email = ["hamadyalghanim@gmail.com"] gem.homepage = "https://github.com/Dreamersoul/administrate-field-active_storage" diff --git a/app/views/fields/active_storage/_index.html.erb b/app/views/fields/active_storage/_index.html.erb index fd096c3..2055d02 100644 --- a/app/views/fields/active_storage/_index.html.erb +++ b/app/views/fields/active_storage/_index.html.erb @@ -14,13 +14,11 @@ By default, the attribute is rendered as an image tag. [1]: http://www.rubydoc.info/gems/administrate/Administrate/Field/Image %> +<% + attachments = Array(field.many? ? field.attachments : field.data) +%> <% if field.attached? %> - <% if field.many? %> - <% field.attachments.each do |attachment| %> - <%= render :partial => 'fields/active_storage/item', locals: { field: field, attachment: attachment } %> -
- <% end %> - <% else %> - <%= render :partial => 'fields/active_storage/item', locals: { field: field, attachment: field.data } %> - <% end %> + <%= pluralize(attachments.count, 'Attached file') %> +<% else %> +0 Attached files <% end %>