Permalink
Browse files

Simplify inline image display by using an empty_image partial. Also m…

…ove insert link above image display.
  • Loading branch information...
1 parent e269163 commit d39ea75d9ebfed175c64b425d6b46b6cbbf0190a @robyurkowski robyurkowski committed Apr 2, 2012
@@ -6,7 +6,7 @@
a#add_image_link {
background: image-url('refinery/icons/add.png') no-repeat 0 6px;
- margin-top: 10px;
+ margin-bottom: 10px;
line-height: 29px;
padding-left: 20px;
display: inline;
@@ -0,0 +1,11 @@
+<li id='' class='image_field blank'>
+ <div class='thumb'></div>
+ <div class='image_actions'>
+ <div class='floater'>
+ <%= image_tag('refinery/icons/delete.png', {:width => 22, :height => 22, :class => 'delete_image', :alt => 'delete' }) %>
+ </div>
+ </div>
+ <div class='attributes'>
+ <%= f.hidden_field :images, :name => "gallery[images][]", :id => nil, :class => 'image_id', :value => nil %>
+ </div>
+</li>
@@ -1,11 +1,7 @@
-<% css_classes = ['image_field'] %>
-<% css_classes << 'blank' if image.new_record? %>
-
-<li id='<%= "image_#{image.id || 'new'}" %>' class='<%= css_classes.join(' ') %>'>
- <div class='thumb'><% unless image.new_record? %><%= image_tag image.thumbnail(:medium).url %><% end %></div>
+<li id='<%= "image_#{image.id}" %>' class='image_field'>
+ <div class='thumb'><%= image_tag image.thumbnail(:medium).url %></div>
<div class='image_actions'>
<div class='floater'>
- <%#= image_tag('refinery/icons/edit.png', {:width => 22, :height => 22, :class => 'edit_image', :alt => 'edit'}) %>
<%= image_tag('refinery/icons/delete.png', {:width => 22, :height => 22, :class => 'delete_image', :alt => 'delete' }) %>
</div>
</div>
@@ -1,6 +1,4 @@
<div class='wym_skin_refinery' id='images_picker'>
- <%= render :partial => "images", :locals => {:f => f} %>
-
<span class='clearfix label_inline_with_link'>
<%= link_to t('.add_new_image'), refinery.insert_admin_images_url({
:dialog => true,
@@ -11,4 +9,6 @@
}),
:id => "add_image_link" %>
</span>
+
+ <%= render :partial => "images", :locals => {:f => f} %>
</div>
@@ -1,11 +1,10 @@
<div class='wym_box field item_group'>
<ul id='page_images' class='clearfix'>
- <% f.object.items.order("position").each_with_index do |item, i| %>
- <%= render :partial => 'image', :locals => {:f => f, :image => item.image} %>
- <% end %>
-
+ <%= render :partial => 'image',
+ :collection => f.object.items.order('position').collect(&:image),
+ :locals => { :f => f } %>
</ul>
- <%= render :partial => 'image', :locals => {:f => f, :image => ::Refinery::Image.new } %>
+ <%= render :partial => 'empty_image', :locals => {:f => f } %>
</div>

0 comments on commit d39ea75

Please sign in to comment.