Sha256: 601c451919acbb582c794bff3c3379cb093d27a5adce272f706efea8b4cb5dbf

Contents?: true

Size: 641 Bytes

Versions: 5

Compression:

Stored size: 641 Bytes

Contents

jQuery ->
  $('#stock_movement_stock_item_id').select2
    placeholder: "Find a stock item" # translate
    ajax:
      url: Spree.url(Spree.routes.stock_items_api)
      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) ->
      "#{stock_item.variant.name} (#{stock_item.variant.options_text})"

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
spree_backend-2.2.14 app/assets/javascripts/spree/backend/stock_movement.js.coffee
spree_backend-2.2.13 app/assets/javascripts/spree/backend/stock_movement.js.coffee
spree_backend-2.2.12 app/assets/javascripts/spree/backend/stock_movement.js.coffee
spree_backend-2.2.11 app/assets/javascripts/spree/backend/stock_movement.js.coffee
spree_backend-2.2.10 app/assets/javascripts/spree/backend/stock_movement.js.coffee