Sha256: fc459deeba66eeecf4e3b2d215b4f6d3e8f2fa2c460900850576fff36c1d9d3e

Contents?: true

Size: 1.82 KB

Versions: 4

Compression:

Stored size: 1.82 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><%= t('spree.available_parts') %></h4>
<table class="index">
	<thead>
		<tr>
        <th><%= t('spree.name') %></th>
        <th><%= t('spree.available_on') %></th>
  		<th><%= t('spree.options') %></th>
  		<th><%= t('spree.qty') %></th>
  		<th></th>
		</tr>
	</thead>
	<tbody>
    <% @available_products.each do |product| %>
      <tr id="<%= dom_id(product) %>">

        <td><%= product.name %></td>
        <td><%= product.available_on %></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 %>
            <%= t('spree.no_variants') %>
          <% end %>
        </td>
        <td><%= text_field_tag "part[count]", 1 %></td>
		    <td class="actions">
		      <%= link_to(icon('add') + ' ' + t('spree.select'),
		                  admin_product_parts_path(@product),
		                  :class => "add_product_part_link") %>
		    </td>
      </tr>
    <% end %>
    <% if @available_products.empty? %>
     <tr><td colspan="3"><%= t('spree.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

4 entries across 4 versions & 1 rubygems

Version Path
solidus_product_assembly-1.4.0 app/views/spree/admin/parts/available.js.erb
solidus_product_assembly-1.3.0 app/views/spree/admin/parts/available.js.erb
solidus_product_assembly-1.2.0 app/views/spree/admin/parts/available.js.erb
solidus_product_assembly-1.1.0 app/views/spree/admin/parts/available.js.erb