Class: SolidusAdmin::Taxonomies::Index::Component

Inherits:
UI::Pages::Index::Component
  • Object
show all
Defined in:
app/components/solidus_admin/taxonomies/index/component.rb

Instance Method Summary collapse

Instance Method Details

#batch_actionsObject



28
29
30
31
32
33
34
35
36
37
# File 'app/components/solidus_admin/taxonomies/index/component.rb', line 28

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

#columnsObject



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

def columns
  [
    name_column,
  ]
end

#model_classObject



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

def model_class
  Spree::Taxonomy
end

#name_columnObject



45
46
47
48
49
50
51
52
# File 'app/components/solidus_admin/taxonomies/index/component.rb', line 45

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

#page_actionsObject



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

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

#row_url(taxonomy) ⇒ Object



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

def row_url(taxonomy)
  spree.edit_admin_taxonomy_path(taxonomy)
end

#sortable_optionsObject



12
13
14
15
16
17
# File 'app/components/solidus_admin/taxonomies/index/component.rb', line 12

def sortable_options
  {
    url: ->(taxonomy) { solidus_admin.move_taxonomy_path(taxonomy) },
    param: 'position',
  }
end