Class: SolidusAdmin::AdjustmentReasons::Index::Component
- Inherits:
-
RefundsAndReturns::Component
- Object
- RefundsAndReturns::Component
- SolidusAdmin::AdjustmentReasons::Index::Component
- Defined in:
- app/components/solidus_admin/adjustment_reasons/index/component.rb
Instance Method Summary collapse
- #batch_actions ⇒ Object
- #columns ⇒ Object
- #model_class ⇒ Object
- #page_actions ⇒ Object
- #row_url(adjustment_reason) ⇒ Object
- #search_key ⇒ Object
- #search_url ⇒ Object
- #turbo_frames ⇒ Object
Instance Method Details
#batch_actions ⇒ Object
37 38 39 40 41 42 43 44 45 46 |
# File 'app/components/solidus_admin/adjustment_reasons/index/component.rb', line 37 def batch_actions [ { label: t('.batch_actions.delete'), action: solidus_admin.adjustment_reasons_path, method: :delete, icon: 'delete-bin-7-line', }, ] end |
#columns ⇒ Object
48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'app/components/solidus_admin/adjustment_reasons/index/component.rb', line 48 def columns [ :name, :code, { header: :active, data: ->(adjustment_reason) do adjustment_reason.active? ? component('ui/badge').yes : component('ui/badge').no end }, ] end |
#model_class ⇒ Object
4 5 6 |
# File 'app/components/solidus_admin/adjustment_reasons/index/component.rb', line 4 def model_class Spree::AdjustmentReason end |
#page_actions ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'app/components/solidus_admin/adjustment_reasons/index/component.rb', line 16 def page_actions render component("ui/button").new( tag: :a, text: t('.add'), href: solidus_admin.new_adjustment_reason_path, data: { turbo_frame: :new_adjustment_reason_modal }, icon: "add-line", class: "align-self-end w-full", ) end |
#row_url(adjustment_reason) ⇒ Object
33 34 35 |
# File 'app/components/solidus_admin/adjustment_reasons/index/component.rb', line 33 def row_url(adjustment_reason) spree.edit_admin_adjustment_reason_path(adjustment_reason, _turbo_frame: :edit_adjustment_reason_modal) end |
#search_key ⇒ Object
12 13 14 |
# File 'app/components/solidus_admin/adjustment_reasons/index/component.rb', line 12 def search_key :name_or_code_cont end |
#search_url ⇒ Object
8 9 10 |
# File 'app/components/solidus_admin/adjustment_reasons/index/component.rb', line 8 def search_url solidus_admin.adjustment_reasons_path end |
#turbo_frames ⇒ Object
26 27 28 29 30 31 |
# File 'app/components/solidus_admin/adjustment_reasons/index/component.rb', line 26 def turbo_frames %w[ new_adjustment_reason_modal edit_adjustment_reason_modal ] end |