Module: Spree::Admin::StockLocationsHelper

Included in:
ProductsController, ShipmentsController, VariantsController
Defined in:
app/helpers/spree/admin/stock_locations_helper.rb

Instance Method Summary collapse

Instance Method Details

#available_stock_locations(_opts = {}) ⇒ Object



4
5
6
# File 'app/helpers/spree/admin/stock_locations_helper.rb', line 4

def available_stock_locations(_opts = {})
  Spree::StockLocation.order_default.active.accessible_by(current_ability)
end

#available_stock_locations_for_product(_product) ⇒ Object

overwrite this to customize behavior



13
14
15
# File 'app/helpers/spree/admin/stock_locations_helper.rb', line 13

def available_stock_locations_for_product(_product)
  available_stock_locations
end

#available_stock_locations_list(opts = {}) ⇒ Object



8
9
10
# File 'app/helpers/spree/admin/stock_locations_helper.rb', line 8

def available_stock_locations_list(opts = {})
  available_stock_locations(opts).map { |stock_location| [stock_location.display_name, stock_location.id] }
end

#default_stock_location_for_product(_product) ⇒ Object



17
18
19
# File 'app/helpers/spree/admin/stock_locations_helper.rb', line 17

def default_stock_location_for_product(_product)
  current_store.default_stock_location
end