Sha256: bd9e6713443f34c07a1f0917db2e4efcfa78fb2aec8a3e6e85390096a5c45d09

Contents?: true

Size: 848 Bytes

Versions: 8

Compression:

Stored size: 848 Bytes

Contents

jQuery ->
  el = $('#stock_movement_stock_item_id')
  if el.length
    el.select2
      placeholder: "Find a stock item" # translate
      ajax:
        url: Spree.url(Spree.routes.stock_items_api(el.data('stock-location-id')))
        params: { "headers": { "X-Spree-Token": Spree.api_key } }
        data: (term, page) ->
          q:
            variant_product_name_cont: term
          per_page: 50
          page: page
          token: Spree.api_key
        results: (data, page) ->
          more = (page * 50) < data.count
          return { results: data.stock_items, more: more }
      formatResult: (stock_item) ->
        variantTemplate({ variant: stock_item.variant })
      formatSelection: (stock_item, container, excapeMarkup) ->
        Select2.util.escapeMarkup("#{stock_item.variant.name} (#{stock_item.variant.options_text})")

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
solidus_backend-1.2.3 app/assets/javascripts/spree/backend/stock_movement.js.coffee
solidus_backend-1.1.4 app/assets/javascripts/spree/backend/stock_movement.js.coffee
solidus_backend-1.0.7 app/assets/javascripts/spree/backend/stock_movement.js.coffee
solidus_backend-1.0.6 app/assets/javascripts/spree/backend/stock_movement.js.coffee
solidus_backend-1.2.2 app/assets/javascripts/spree/backend/stock_movement.js.coffee
solidus_backend-1.2.1 app/assets/javascripts/spree/backend/stock_movement.js.coffee
solidus_backend-1.1.3 app/assets/javascripts/spree/backend/stock_movement.js.coffee
solidus_backend-1.0.5 app/assets/javascripts/spree/backend/stock_movement.js.coffee