Skip to content

Commit

Permalink
feat(collection view): better representation of files in the collecti…
Browse files Browse the repository at this point in the history
…on view closes #3
  • Loading branch information
Dreamersoul committed Apr 12, 2019
1 parent 8d93ef6 commit 19b1df3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
2 changes: 1 addition & 1 deletion administrate-field-active_storage.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -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 = ["[email protected]"]
gem.homepage = "https://github.com/Dreamersoul/administrate-field-active_storage"
Expand Down
14 changes: 6 additions & 8 deletions app/views/fields/active_storage/_index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -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 } %>
<br/>
<% 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 %>

0 comments on commit 19b1df3

Please sign in to comment.