Class: SolidusAdmin::PromotionCategories::Index::Component
- Inherits:
-
BaseComponent
- Object
- BaseComponent
- SolidusAdmin::PromotionCategories::Index::Component
- Includes:
- Layout::PageHelpers
- Defined in:
- app/components/solidus_admin/promotion_categories/index/component.rb
Instance Method Summary collapse
- #batch_actions ⇒ Object
- #code_column ⇒ Object
- #columns ⇒ Object
-
#initialize(page:) ⇒ Component
constructor
A new instance of Component.
- #name_column ⇒ Object
- #next_page_path ⇒ Object
- #prev_page_path ⇒ Object
- #title ⇒ Object
Constructor Details
#initialize(page:) ⇒ Component
Returns a new instance of Component.
6 7 8 |
# File 'app/components/solidus_admin/promotion_categories/index/component.rb', line 6 def initialize(page:) @page = page end |
Instance Method Details
#batch_actions ⇒ Object
22 23 24 25 26 27 28 29 30 31 |
# File 'app/components/solidus_admin/promotion_categories/index/component.rb', line 22 def batch_actions [ { display_name: t('.batch_actions.delete'), action: solidus_admin.promotion_categories_path, method: :delete, icon: 'delete-bin-7-line', }, ] end |
#code_column ⇒ Object
49 50 51 52 53 54 55 56 |
# File 'app/components/solidus_admin/promotion_categories/index/component.rb', line 49 def code_column { header: :code, data: ->(promotion_category) do content_tag :div, promotion_category.code end } end |
#columns ⇒ Object
33 34 35 36 37 38 |
# File 'app/components/solidus_admin/promotion_categories/index/component.rb', line 33 def columns [ name_column, code_column, ] end |
#name_column ⇒ Object
40 41 42 43 44 45 46 47 |
# File 'app/components/solidus_admin/promotion_categories/index/component.rb', line 40 def name_column { header: :name, data: ->(promotion_category) do content_tag :div, promotion_category.name end } end |
#next_page_path ⇒ Object
18 19 20 |
# File 'app/components/solidus_admin/promotion_categories/index/component.rb', line 18 def next_page_path solidus_admin.url_for(**request.params, page: @page.next_param, only_path: true) unless @page.last? end |
#prev_page_path ⇒ Object
14 15 16 |
# File 'app/components/solidus_admin/promotion_categories/index/component.rb', line 14 def prev_page_path solidus_admin.url_for(**request.params, page: @page.number - 1, only_path: true) unless @page.first? end |
#title ⇒ Object
10 11 12 |
# File 'app/components/solidus_admin/promotion_categories/index/component.rb', line 10 def title Spree::PromotionCategory.model_name.human.pluralize end |