Sha256: 37ddeb41b5714ad2d6123cb4efab526c48936258224b8e010d44f167941f6404

Contents?: true

Size: 1.72 KB

Versions: 1

Compression:

Stored size: 1.72 KB

Contents

<script type="text/javascript">
  function displayRow(){
    var row = document.getElementById("captionRow");
    if (row.style.display == '') row.style.display = 'none';
    else row.style.display = '';
  }
</script>

<h4><%= Spree.t(:available_parts) %></h4>
<table class="index">
	<thead>
		<tr>
  		<th><%= Spree.t(:name) %></th>
  		<th><%= Spree.t(:options) %></th>
  		<th><%= Spree.t(:qty) %></th>
  		<th></th>
		</tr>
	</thead>
	<tbody>
    <% @available_products.each do |product| %>
      <tr id="<%= dom_id(product) %>">

        <td><%= product.name %></td>
        <td>
          <% if product.has_variants? %>
            <%= select_tag "part[id]",
                options_for_select(product.variants.map { |v| [variant_options(v), v.id] }) %>
          <% else %>
            <%= hidden_field_tag "part[id]", product.master.id %>
            <%= Spree.t(:no_variants) %>
          <% end %>
        </td>
        <td><%= text_field_tag "part[count]", 1 %></td>
		    <td class="actions">
		      <%= link_to(icon('add') + ' ' + Spree.t(:select), 
		                  admin_product_parts_path(@product),
		                  :class => "add_product_part_link") %>
		    </td>
      </tr>
    <% end %>
    <% if @available_products.empty? %>
     <tr><td colspan="3"><%= Spree.t(:no_match_found) %>.</td></tr>
    <% end %>
  </tbody>
</table>

<%= javascript_tag do %>
  $("a.add_product_part_link").click(function(){
    part_id_val = $('select option:selected', $(this).parent().parent()).val() ||
                  $('input:first', $(this).parent().parent()).val();
    params = { part_count :  $('input:last', $(this).parent().parent()).val(),
               part_id : part_id_val};
    return make_post_request($(this), params);
  });
<% end %>

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
solidus_product_assembly-1.0.0 app/views/spree/admin/parts/available.html.erb