Class: SolidusAdmin::StockLocations::Index::Component
- Inherits:
-
SolidusAdmin::Shipping::Component
- Object
- SolidusAdmin::Shipping::Component
- SolidusAdmin::StockLocations::Index::Component
- Defined in:
- app/components/solidus_admin/stock_locations/index/component.rb
Instance Method Summary collapse
- #actions ⇒ Object
- #batch_actions ⇒ Object
- #columns ⇒ Object
- #filters ⇒ Object
- #model_class ⇒ Object
- #row_url(stock_location) ⇒ Object
- #scopes ⇒ Object
- #search_key ⇒ Object
- #search_url ⇒ Object
Instance Method Details
#actions ⇒ Object
8 9 10 11 12 13 14 15 16 |
# File 'app/components/solidus_admin/stock_locations/index/component.rb', line 8 def actions render component("ui/button").new( tag: :a, text: t('.add'), href: spree.new_admin_stock_location_path, icon: "add-line", class: "align-self-end w-full", ) end |
#batch_actions ⇒ Object
30 31 32 33 34 35 36 37 38 39 |
# File 'app/components/solidus_admin/stock_locations/index/component.rb', line 30 def batch_actions [ { label: t('.batch_actions.delete'), action: solidus_admin.stock_locations_path, method: :delete, icon: 'delete-bin-7-line', }, ] end |
#columns ⇒ Object
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
# File 'app/components/solidus_admin/stock_locations/index/component.rb', line 49 def columns [ :name, :code, :admin_name, { header: :state, data: -> { color = _1.active? ? :green : :graphite_light text = _1.active? ? t('.active') : t('.inactive') component('ui/badge').new(name: text, color:) }, }, { header: :backorderable, data: -> { _1.backorderable_default ? component('ui/badge').yes : component('ui/badge').no } }, { header: :default, data: -> { _1.default ? component('ui/badge').yes : component('ui/badge').no } }, { header: :stock_movements, data: -> { count = _1.stock_movements.count link_to( "#{count} #{Spree::StockMovement.model_name.human(count:).downcase}", spree.admin_stock_location_stock_movements_path(_1), class: 'body-link' ) } } ] end |
#filters ⇒ Object
45 46 47 |
# File 'app/components/solidus_admin/stock_locations/index/component.rb', line 45 def filters [] end |
#model_class ⇒ Object
4 5 6 |
# File 'app/components/solidus_admin/stock_locations/index/component.rb', line 4 def model_class Spree::StockLocation end |
#row_url(stock_location) ⇒ Object
18 19 20 |
# File 'app/components/solidus_admin/stock_locations/index/component.rb', line 18 def row_url(stock_location) spree.edit_admin_stock_location_path(stock_location) end |
#scopes ⇒ Object
41 42 43 |
# File 'app/components/solidus_admin/stock_locations/index/component.rb', line 41 def scopes [] end |
#search_key ⇒ Object
26 27 28 |
# File 'app/components/solidus_admin/stock_locations/index/component.rb', line 26 def search_key :name_or_description_cont end |
#search_url ⇒ Object
22 23 24 |
# File 'app/components/solidus_admin/stock_locations/index/component.rb', line 22 def search_url solidus_admin.stock_locations_path end |