Sha256: c78b201c565558e4703b4f4cfbbe221dcd5724d19974049bf4ce3a41f6b1ca22

Contents?: true

Size: 1.89 KB

Versions: 4

Compression:

Stored size: 1.89 KB

Contents

<%# This partial was remove in solidus 1.2 but that is also when Spree.solidus_version was added %>
<%= render :partial => 'spree/admin/shared/product_sub_menu' if !Spree.respond_to?(:solidus_version) %>

<%= render :partial => 'spree/admin/shared/product_tabs', :locals => {:current => "Parts"} %>
<div id="product_parts">
  <%= render :partial => "parts_table", :locals => {:parts => @parts} %>
</div>

<%= form_tag('#') do %>
  <label><%= t('spree.search') %>:</label>
  <input id="searchtext" size="25">
  <button id="search_parts_button" class="fa fa-search button" name="button">Search</button>
<% end %>

<br/>
<div id="search_hits"></div>
<%= javascript_tag do %>
  /*!
   * Spree Product Assembly
   * https://github.com/spree/spree-product-assembly
   *
   */

  function search_for_parts(){
    $.ajax({
     data: {q: $("#searchtext").val() },
     dataType: 'html',
     success: function(request){
       jQuery('#search_hits').html(request);
       $('#search_hits').show();
     },
     type: 'POST',
     url: '<%= available_admin_product_parts_url(@product) %>'
    });
  }

  $("#searchtext").keypress(function (e) {
    if ((e.which && e.which == 13) || (e.keyCode && e.keyCode == 13)) {
      search_for_parts();
      return false;
    } else {
       return true;
    }
  });

  $("#search_parts_button").click(function(e) {
    e.preventDefault();
    search_for_parts();
  });

  function subscribe_product_part_links()
  {
    $("a.set_count_admin_product_part_link").click(function(){
      params = { count :  $("input", $(this).parent().parent()).val() };
      return make_post_request($(this), params);
    });

    $("a.remove_admin_product_part_link").click(function(){
      return make_post_request($(this), {});
    });
  }

  function make_post_request(link, post_params)
  {
    $.post(link.attr("href"), post_params, "script");
    return false;
  }

  subscribe_product_part_links();
<% end -%>

Version data entries

4 entries across 4 versions & 1 rubygems

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