app/views/admin/variants/index.html.erb in spree-0.5.1 vs app/views/admin/variants/index.html.erb in spree-0.6.0
- old
+ new
@@ -1,54 +1,54 @@
<%= render :partial => 'shared/product_sub_menu' %>
-<h1><%= t("Editing Product") %></h1>
+<h1><%= t("editing_product") %></h1>
<%= render :partial => 'shared/product_tabs', :locals => {:current => "Variants"} %>
<table class="full-table">
<thead>
<tr>
- <th><%= t("Options") %></th>
- <th><%= t("Price") %></th>
- <th><%= t("SKU") %></th>
- <% @additional_fields.each do |field| %>
- <th><%= field.titleize %></th>
+ <th><%= t("options") %></th>
+ <th><%= t("price") %></th>
+ <th><%= t("sku") %></th>
+ <% Variant.additional_fields.select{|f| f[:only].nil? || f[:only].include?(:variant) }.each do |field| %>
+ <th><%= field[:name].titleize %></th>
<% end %>
- <th><%= t("On Hand") %></th>
- <th><%= t("Action") %></th>
+ <th><%= t("on_hand") %></th>
+ <th><%= t("action") %></th>
</tr>
</thead>
<tbody>
<% @variants.each do |variant| %>
<!-- you can skip variant with no options: that's just the default variant that all products have -->
<% next if variant.option_values.empty? %>
- <tr>
- <td><%= variant_options variant %></td>
+ <tr <%= 'style="color:red;"' unless variant.deleted_at.nil? %>>
+ <td><%= variant_options variant %> '<%= variant.id.to_s %>'</td>
<td><%= variant.price %>
<td><%= variant.sku %></td>
- <% @additional_fields.each do |field| %>
- <td><%= variant[field] %></td>
+ <% Variant.additional_fields.select{|f| f[:only].nil? || f[:only].include?(:variant) }.each do |field| %>
+ <td><%= variant[field[:name].gsub(" ", "_").downcase] %></td>
<% end %>
<td><%= variant.on_hand %></td>
<td valign="top">
- <%= link_to_edit(variant) %>
+ <%= link_to_edit(variant) if variant.deleted_at.nil? %>
- <%= link_to_delete(variant) %>
+ <%= link_to_delete(variant) if variant.deleted_at.nil? %>
</td>
</tr>
<% end %>
<% unless @product.variants? %>
- <tr><td colspan="5"><%= t("None") %>.</td></tr>
+ <tr><td colspan="5"><%= t("none") %>.</td></tr>
<% end %>
</tbody>
</table>
<% unless @product.options.empty? %>
<div id="variants"/>
<%= image_tag "spinner.gif", :plugin=>"spree", :style => "display:none", :id => 'busy_indicator' %>
<br/>
<span id="new_var_link">
- <%= link_to_remote t("New Variant"),
+ <%= link_to_remote t("new_variant"),
:url => new_admin_product_variant_url(@product),
:method => :get,
:update => "variants",
:before => "Element.hide('new_var_link');Element.show('busy_indicator')",
:complete => "Element.hide('busy_indicator')" %>
- </span>
+ </span> | <%= link_to @deleted.blank? ? t("show_deleted") : t("show_active"), admin_product_variants_url(@product, :deleted => @deleted.blank? ? "on" : "off") %>
<% end %>
\ No newline at end of file