<h2><%= t(:selected_option_types) %></h2>
<table class="option-types" data-hook="option_types">
  <thead>
    <tr data-hook="option_types_header">
      <th><%= t(:name) %></th>
      <th><%= t(:display) %></th>
      <th><%= t(:action) %></th>
    </tr>
  </thead>
  <tbody>
    <% @product.selected_options.each do |so| %>
      <tr data-hook="option_types_row">
        <td><%= so.option_type.name%></td>
        <td><%= so.option_type.presentation%></td>
        <td>
          <%= link_to_remote t(:remove),
                             :url => {:action => 'remove_option_type', :id => @product, :product_option_type_id => so},
                             :before => "$('#select-link').hide(); $('#busy_indicator').show()", 
                             :complete => "$('#busy_indicator').hide()",
                             :update => 'option-type-listing' %>
        </td>
      </tr>
    <% end %>
    <% if @product.selected_options.empty? %>
      <tr>
        <td colspan="3"><%= t(:none) %></td>
      </tr>
    <% end %>
  </tbody>
</table>
<% unless @product.new_record? %>
  <span id="select-link" data-hook>
    <%= link_to_remote icon('delete') + ' ' + t(:select_option_type), {
                       :url => {:controller => 'option_types', :action => 'select', :id => @product},
                       :update => 'new-option-type'}, :class => 'iconlink' %>
  </span>
  <%= image_tag 'spinner.gif', :plugin => 'spree', :style => 'display:none;', :id => 'busy_indicator' %>
<% end %>
<br />
<div id="new-option-type" data-hook></div>
