Class: SolidusAdmin::Roles::Index::Component
- Inherits:
-
UsersAndRoles::Component
- Object
- UsersAndRoles::Component
- SolidusAdmin::Roles::Index::Component
- Defined in:
- app/components/solidus_admin/roles/index/component.rb
Instance Method Summary collapse
- #batch_actions ⇒ Object
- #columns ⇒ Object
- #edit_path(role) ⇒ Object
- #filters ⇒ Object
- #model_class ⇒ Object
- #page_actions ⇒ Object
- #scopes ⇒ Object
- #search_key ⇒ Object
- #search_url ⇒ Object
- #turbo_frames ⇒ Object
Instance Method Details
#batch_actions ⇒ Object
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(**search_filter_params), method: :delete, icon: 'delete-bin-7-line', }, ] end |
#columns ⇒ Object
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'app/components/solidus_admin/roles/index/component.rb', line 58 def columns [ { header: :role, data: ->(role) do link_to role.name, edit_path(role), data: { turbo_frame: :resource_modal }, class: "body-link" end, }, { header: :description, data: ->(role) do link_to_if role.description, role.description, edit_path(role), data: { turbo_frame: :resource_modal }, class: "body-link" end } ] end |
#edit_path(role) ⇒ Object
16 17 18 |
# File 'app/components/solidus_admin/roles/index/component.rb', line 16 def edit_path(role) solidus_admin.edit_role_path(role, **search_filter_params) end |
#filters ⇒ Object
54 55 56 |
# File 'app/components/solidus_admin/roles/index/component.rb', line 54 def filters [] end |
#model_class ⇒ Object
4 5 6 |
# File 'app/components/solidus_admin/roles/index/component.rb', line 4 def model_class Spree::Role end |
#page_actions ⇒ Object
20 21 22 23 24 25 26 27 28 |
# 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(**search_filter_params), data: { turbo_frame: :resource_modal }, icon: "add-line", ) end |
#scopes ⇒ Object
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_key ⇒ Object
8 9 10 |
# File 'app/components/solidus_admin/roles/index/component.rb', line 8 def search_key :name_cont end |
#search_url ⇒ Object
12 13 14 |
# File 'app/components/solidus_admin/roles/index/component.rb', line 12 def search_url solidus_admin.roles_path end |
#turbo_frames ⇒ Object
30 31 32 33 34 |
# File 'app/components/solidus_admin/roles/index/component.rb', line 30 def turbo_frames %w[ resource_modal ] end |