Class: SolidusAdmin::Roles::Index::Component

Inherits:
UsersAndRoles::Component
  • Object
show all
Defined in:
app/components/solidus_admin/roles/index/component.rb

Instance Method Summary collapse

Instance Method Details

#batch_actionsObject



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

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

#columnsObject



58
59
60
61
62
63
64
65
66
67
68
69
# File 'app/components/solidus_admin/roles/index/component.rb', line 58

def columns
  [
    {
      header: :role,
      data: :name,
    },
    {
      header: :description,
      data: :description,
    }
  ]
end

#filtersObject



54
55
56
# File 'app/components/solidus_admin/roles/index/component.rb', line 54

def filters
  []
end

#model_classObject



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

def model_class
  Spree::Role
end

#page_actionsObject



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

def page_actions
  render component("ui/button").new(
    tag: :a,
    text: t('.add'),
    href: solidus_admin.new_role_path, data: { turbo_frame: :new_role_modal },
    icon: "add-line",
  )
end

#row_url(role) ⇒ Object



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

def row_url(role)
  solidus_admin.edit_role_path(role, _turbo_frame: :edit_role_modal)
end

#scopesObject



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

def scopes
  [
    { name: :all, label: t('.scopes.all'), default: true },
    { name: :admin, label: t('.scopes.admin') },
  ]
end

#search_keyObject



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

def search_key
  :name_cont
end

#search_urlObject



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

def search_url
  solidus_admin.roles_path
end

#turbo_framesObject



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

def turbo_frames
  %w[
    new_role_modal
    edit_role_modal
  ]
end