Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion app/views/fields/paperclip/_index.html.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<% if field.url_only? -%>
<% if field.blank? -%>
None
<% elsif field.url_only? -%>
<%= link_to field.url, field.url if field.url.present? %>
<% else -%>
<%= image_tag field.thumbnail %>
Expand Down
4 changes: 3 additions & 1 deletion app/views/fields/paperclip/_show.html.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<% if field.url_only? -%>
<% if field.blank? -%>
None
<% elsif field.url_only? -%>
<%= link_to field.url, field.url if field.url.present? %>
<% else -%>
<%= image_tag field.url if field.url.present? %>
Expand Down
4 changes: 4 additions & 0 deletions lib/administrate/field/paperclip.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ def style(size = big_style)
data.try(:url, size) || ''
end

def blank?
data.blank?
end
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Travis build is currently failing because of Rubocop. Can we delegate this so Rubocop is happy?
http://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Rails/Delegate
Thanks!


delegate :url, to: :data

def thumbnail
Expand Down