Class: SolidusAdmin::TaxCategories::Index::Component

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

Direct Known Subclasses

Edit::Component, New::Component

Instance Method Summary collapse

Instance Method Details

#batch_actionsObject



37
38
39
40
41
42
43
44
45
46
# File 'app/components/solidus_admin/tax_categories/index/component.rb', line 37

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

#columnsObject



48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'app/components/solidus_admin/tax_categories/index/component.rb', line 48

def columns
  [
    :name,
    :tax_code,
    :description,
    {
      header: :is_default,
      data: ->(tax_category) {
        if tax_category.is_default?
          component('ui/badge').yes
        else
          component('ui/badge').no
        end
      },
    },
  ]
end

#model_classObject



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

def model_class
  Spree::TaxCategory
end

#page_actionsObject



16
17
18
19
20
21
22
23
24
# File 'app/components/solidus_admin/tax_categories/index/component.rb', line 16

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

#row_url(tax_category) ⇒ Object



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

def row_url(tax_category)
  spree.edit_admin_tax_category_path(tax_category, _turbo_frame: :edit_tax_category_modal)
end

#search_keyObject



33
34
35
# File 'app/components/solidus_admin/tax_categories/index/component.rb', line 33

def search_key
  :name_or_description_cont
end

#search_urlObject



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

def search_url
  solidus_admin.tax_categories_path
end

#turbo_framesObject



26
27
28
29
30
31
# File 'app/components/solidus_admin/tax_categories/index/component.rb', line 26

def turbo_frames
  %w[
    new_tax_category_modal
    edit_tax_category_modal
  ]
end