Permalink
Browse files

Add thumb and tiny images to edit and overview

  • Loading branch information...
1 parent 0ffa815 commit 5a7952c1109fe5cd8b13054916eafb9a12d66ce5 @fousa committed Mar 25, 2011
@@ -11,4 +11,4 @@
<%= file_field(field.abstract_model.to_param, field.name, :class => "fileUploadField #{field.has_errors? ? "errorField" : nil}") %>
<%= hidden_field(field.abstract_model.to_param, "#{field.name}_cache") %>
</div>
-</div>
+</div>
@@ -2,7 +2,7 @@
<div class="input">
<% unless field.value.blank? %>
<div class="row">'
- <%= image_tag(field.bindings[:object].send("#{field.name}_url")) %><br />
+ <%= link_to image_tag(field.bindings[:object].send(field.name).send("url", :thumb)), field.bindings[:object].send(field.name).send("url") %><br />
<%= check_box(field.abstract_model.to_param, "remove_#{field.name}") %>
<%= label_tag("#{field.abstract_model.to_param}_remove_#{field.name}", "Remove existing #{field.label.downcase}", :class => "inline") %>
</div>
@@ -11,4 +11,4 @@
<%= file_field(field.abstract_model.to_param, field.name, :class => "fileUploadField #{field.has_errors? ? "errorField" : nil}") %>
<%= hidden_field(field.abstract_model.to_param, "#{field.name}_cache") %>
</div>
-</div>
+</div>
@@ -5,11 +5,15 @@ class CarrierWaveFile < RailsAdmin::Config::Fields::Types::FileUpload
RailsAdmin::Config::Fields::Types.register(self)
register_instance_option(:formatted_value) do
unless value.blank?
- "<a href='#{value}'}>#{value.to_s.split("/").last}</a>".html_safe
+ if value.tiny
+ "<a href='#{value}'}><img src='#{value.tiny.url}' /></a><a href='#{value}'}>#{value.to_s.split("/").last}</a>".html_safe
+ else
+ "<a href='#{value}'}>#{value.to_s.split("/").last}</a>".html_safe
+ end
else
""
end
end
end
end
-end
+end

0 comments on commit 5a7952c

Please sign in to comment.