Class: SolidusAdmin::PromotionCategories::Index::Component

Inherits:
UI::Pages::Index::Component
  • Object
show all
Defined in:
lib/components/admin/solidus_admin/promotion_categories/index/component.rb

Instance Method Summary collapse

Instance Method Details

#batch_actionsObject



21
22
23
24
25
26
27
28
29
30
# File 'lib/components/admin/solidus_admin/promotion_categories/index/component.rb', line 21

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

#code_columnObject



48
49
50
51
52
53
54
55
# File 'lib/components/admin/solidus_admin/promotion_categories/index/component.rb', line 48

def code_column
  {
    header: :code,
    data: ->(promotion_category) do
       :div, promotion_category.code
    end
  }
end

#columnsObject



32
33
34
35
36
37
# File 'lib/components/admin/solidus_admin/promotion_categories/index/component.rb', line 32

def columns
  [
    name_column,
    code_column,
  ]
end

#model_classObject



4
5
6
# File 'lib/components/admin/solidus_admin/promotion_categories/index/component.rb', line 4

def model_class
  Spree::PromotionCategory
end

#name_columnObject



39
40
41
42
43
44
45
46
# File 'lib/components/admin/solidus_admin/promotion_categories/index/component.rb', line 39

def name_column
  {
    header: :name,
    data: ->(promotion_category) do
       :div, promotion_category.name
    end
  }
end

#page_actionsObject



12
13
14
15
16
17
18
19
# File 'lib/components/admin/solidus_admin/promotion_categories/index/component.rb', line 12

def page_actions
  render component("ui/button").new(
    tag: :a,
    text: t('.add'),
    href: spree.new_admin_promotion_category_path,
    icon: "add-line",
  )
end

#row_url(promotion_category) ⇒ Object



8
9
10
# File 'lib/components/admin/solidus_admin/promotion_categories/index/component.rb', line 8

def row_url(promotion_category)
  spree.edit_admin_promotion_category_path(promotion_category)
end