Class: SolidusAdmin::TaxCategories::Index::Component
- Inherits:
-
SolidusAdmin::Taxes::Component
- Object
- SolidusAdmin::Taxes::Component
- SolidusAdmin::TaxCategories::Index::Component
- Defined in:
- app/components/solidus_admin/tax_categories/index/component.rb
Instance Method Summary collapse
- #batch_actions ⇒ Object
- #columns ⇒ Object
- #edit_path(tax_category) ⇒ Object
- #model_class ⇒ Object
- #page_actions ⇒ 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/tax_categories/index/component.rb', line 37 def batch_actions [ { label: t('.batch_actions.delete'), action: solidus_admin.tax_categories_path(**search_filter_params), method: :delete, icon: 'delete-bin-7-line', }, ] end |
#columns ⇒ Object
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'app/components/solidus_admin/tax_categories/index/component.rb', line 48 def columns [ { header: :name, data: ->(tax_category) do link_to tax_category.name, edit_path(tax_category), data: { turbo_frame: :resource_modal }, class: 'body-link' end }, { header: :tax_code, data: ->(tax_category) do link_to_if tax_category.tax_code, tax_category.tax_code, edit_path(tax_category), data: { turbo_frame: :resource_modal }, class: 'body-link' end }, { header: :description, data: ->(tax_category) do link_to_if tax_category.description, tax_category.description, edit_path(tax_category), data: { turbo_frame: :resource_modal }, class: 'body-link' end }, { header: :is_default, data: ->(tax_category) { if tax_category.is_default? component('ui/badge').yes else component('ui/badge').no end }, }, ] end |
#edit_path(tax_category) ⇒ Object
4 5 6 |
# File 'app/components/solidus_admin/tax_categories/index/component.rb', line 4 def edit_path(tax_category) spree.edit_admin_tax_category_path(tax_category, **search_filter_params) end |
#model_class ⇒ Object
8 9 10 |
# File 'app/components/solidus_admin/tax_categories/index/component.rb', line 8 def model_class Spree::TaxCategory end |
#page_actions ⇒ Object
16 17 18 19 20 21 22 23 24 25 |
# File 'app/components/solidus_admin/tax_categories/index/component.rb', line 16 def page_actions render component("ui/button").new( tag: :a, text: t('.add'), href: solidus_admin.new_tax_category_path(**search_filter_params), data: { turbo_frame: :resource_modal }, icon: "add-line", class: "align-self-end w-full", ) end |
#search_key ⇒ Object
33 34 35 |
# File 'app/components/solidus_admin/tax_categories/index/component.rb', line 33 def search_key :name_or_description_cont end |
#search_url ⇒ Object
12 13 14 |
# File 'app/components/solidus_admin/tax_categories/index/component.rb', line 12 def search_url solidus_admin.tax_categories_path end |
#turbo_frames ⇒ Object
27 28 29 30 31 |
# File 'app/components/solidus_admin/tax_categories/index/component.rb', line 27 def turbo_frames %w[ resource_modal ] end |