Class: SolidusAdmin::ShippingMethods::Index::Component

Inherits:
SolidusAdmin::Shipping::Component
  • Object
show all
Defined in:
app/components/solidus_admin/shipping_methods/index/component.rb

Instance Method Summary collapse

Instance Method Details

#batch_actionsObject



30
31
32
33
34
35
36
37
38
39
# File 'app/components/solidus_admin/shipping_methods/index/component.rb', line 30

def batch_actions
  [
    {
      label: t('.batch_actions.delete'),
      action: solidus_admin.shipping_methods_path,
      method: :delete,
      icon: 'delete-bin-7-line',
    },
  ]
end

#columnsObject



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'app/components/solidus_admin/shipping_methods/index/component.rb', line 41

def columns
  [
    {
      header: :name,
      data: -> { [_1.admin_name.presence, _1.name].compact.join(' / ') },
    },
    {
      header: :zone,
      data: -> { _1.zones.pluck(:name).to_sentence },
    },
    {
      header: :calculator,
      data: -> { _1.calculator&.description },
    },
    {
      header: :available_to_users,
      data: -> { _1.available_to_users? ? component('ui/badge').yes : component('ui/badge').no },
    },
  ]
end

#model_classObject



4
5
6
# File 'app/components/solidus_admin/shipping_methods/index/component.rb', line 4

def model_class
  Spree::ShippingMethod
end

#page_actionsObject



20
21
22
23
24
25
26
27
28
# File 'app/components/solidus_admin/shipping_methods/index/component.rb', line 20

def page_actions
  render component("ui/button").new(
    tag: :a,
    text: t('.add'),
    href: spree.new_admin_shipping_method_path,
    icon: "add-line",
    class: "align-self-end w-full",
  )
end

#row_url(shipping_method) ⇒ Object



8
9
10
# File 'app/components/solidus_admin/shipping_methods/index/component.rb', line 8

def row_url(shipping_method)
  spree.edit_admin_shipping_method_path(shipping_method)
end

#search_keyObject



16
17
18
# File 'app/components/solidus_admin/shipping_methods/index/component.rb', line 16

def search_key
  :name_or_description_cont
end

#search_urlObject



12
13
14
# File 'app/components/solidus_admin/shipping_methods/index/component.rb', line 12

def search_url
  solidus_admin.shipping_methods_path
end