app/views/admin/variants/index.html.erb in spree-0.7.1 vs app/views/admin/variants/index.html.erb in spree-0.8.0
- old
+ new
@@ -1,54 +1,56 @@
-<%= render :partial => 'shared/product_sub_menu' %>
-<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>
- <% Variant.additional_fields.select{|f| f[:only].nil? || f[:only].include?(:variant) }.each do |field| %>
- <th><%= field[:name].titleize %></th>
+<%= render :partial => 'admin/shared/product_sub_menu' %>
+
+<%= render :partial => 'admin/shared/product_tabs', :locals => {:current => "Variants"} %>
+
+<table class="index">
+ <tr>
+ <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>
+ </tr>
+ <% @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 <%= 'style="color:red;"' unless variant.deleted_at.nil? %>>
+ <td><%= variant_options variant %></td>
+ <td><%= variant.price %></td>
+ <td><%= variant.sku %></td>
+ <% Variant.additional_fields.select{|f| f[:only].nil? || f[:only].include?(:variant) }.each do |field| %>
+ <td><%= variant[field[:name].gsub(" ", "_").downcase] %></td>
<% end %>
- <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 <%= 'style="color:red;"' unless variant.deleted_at.nil? %>>
- <td><%= variant_options variant %> '<%= variant.id.to_s %>'</td>
- <td><%= variant.price %>
- <td><%= variant.sku %></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) if variant.deleted_at.nil? %>
-
- <%= link_to_delete(variant) if variant.deleted_at.nil? %>
- </td>
- </tr>
- <% end %>
- <% unless @product.variants? %>
- <tr><td colspan="5"><%= t("none") %>.</td></tr>
- <% end %>
- </tbody>
+ <td><%= variant.on_hand %></td>
+ <td valign="top">
+ <%= link_to_edit(variant) if variant.deleted_at.nil? %>
+
+ <%= link_to_delete(variant) if variant.deleted_at.nil? %>
+ </td>
+ </tr>
+ <% end %>
+ <% unless @product.variants? %>
+ <tr><td colspan="5"><%= t("none") %>.</td></tr>
+ <% end %>
</table>
-<% unless @product.options.empty? %>
- <div id="variants"/>
- <%= image_tag "spinner.gif", :plugin=>"spree", :style => "display:none", :id => 'busy_indicator' %>
+<% if @product.options.empty? %>
+ <p>
+ <%= t("to_add_variants_you_must_first_define") %> <%= link_to t("option_types"), selected_admin_product_option_types_url(@product) %>
+ </p>
+<% else %>
+ <div id="variants"></div>
<br/>
- <span id="new_var_link">
- <%= 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> | <%= 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
+ <p id="new_var_link">
+ <%= link_to_remote icon('add') + ' ' + 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')"}, :class => 'iconlink' %>
+ </span> | <%= link_to @deleted.blank? ? t("show_deleted") : t("show_active"), admin_product_variants_url(@product, :deleted => @deleted.blank? ? "on" : "off") %>
+ </p>
+ <%= image_tag "spinner.gif", :plugin=>"spree", :style => "display:none", :id => 'busy_indicator' %>
+<% end %>