drhenner/ror_ecommerce

View on GitHub
app/views/admin/merchandise/wizards/product_types/_form.html.erb

Summary

Maintainability
Test Coverage
<% if @product_type.errors.any? %>
  <div id="error_explanation">
    <h2><%= pluralize(@product_type.errors.count, "error") %> prohibited this product_type from being saved:</h2>

    <ul>
    <% @product_type.errors.full_messages.each do |msg| %>
      <li><%= msg %></li>
    <% end %>
    </ul>
  </div>
<% end %>

<label>Name</label>
<%= form.text_field :name %>

<label>Parent</label>
  <%= form.select :parent_id,
                  nested_set_options(ProductType, ProductType.new) {|i| "#{'-' * i.level} #{i.name}" },
                  { :include_blank => true } %>

<%= form.submit 'Create', class: 'button', style: "margin-top: 10px" %>