Class: SolidusAdmin::ShippingCategories::Index::Component

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

Direct Known Subclasses

Edit::Component, New::Component

Instance Method Summary collapse

Instance Method Details

#actionsObject



8
9
10
11
12
13
14
15
16
# File 'app/components/solidus_admin/shipping_categories/index/component.rb', line 8

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

#batch_actionsObject



47
48
49
50
51
52
53
54
55
56
# File 'app/components/solidus_admin/shipping_categories/index/component.rb', line 47

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

#columnsObject



58
59
60
61
62
# File 'app/components/solidus_admin/shipping_categories/index/component.rb', line 58

def columns
  [
    :name
  ]
end

#model_classObject



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

def model_class
  Spree::ShippingCategory
end

#page_actionsObject



18
19
20
21
22
23
24
25
26
# File 'app/components/solidus_admin/shipping_categories/index/component.rb', line 18

def page_actions
  render component("ui/button").new(
    tag: :a,
    text: t('.add'),
    href: solidus_admin.new_shipping_category_path, data: { turbo_frame: :new_shipping_category_modal },
    icon: "add-line",
    class: "align-self-end w-full",
  )
end

#row_url(shipping_category) ⇒ Object



35
36
37
# File 'app/components/solidus_admin/shipping_categories/index/component.rb', line 35

def row_url(shipping_category)
  spree.edit_admin_shipping_category_path(shipping_category, _turbo_frame: :edit_shipping_category_modal)
end

#search_keyObject



39
40
41
# File 'app/components/solidus_admin/shipping_categories/index/component.rb', line 39

def search_key
  :name_cont
end

#search_urlObject



43
44
45
# File 'app/components/solidus_admin/shipping_categories/index/component.rb', line 43

def search_url
  solidus_admin.shipping_categories_path
end

#turbo_framesObject



28
29
30
31
32
33
# File 'app/components/solidus_admin/shipping_categories/index/component.rb', line 28

def turbo_frames
  %w[
    new_shipping_category_modal
    edit_shipping_category_modal
  ]
end