Class: SolidusAdmin::Zones::Index::Component
- Inherits:
-
UI::Pages::Index::Component
- Object
- UI::Pages::Index::Component
- SolidusAdmin::Zones::Index::Component
- Defined in:
- app/components/solidus_admin/zones/index/component.rb
Instance Method Summary collapse
- #batch_actions ⇒ Object
- #columns ⇒ Object
- #filters ⇒ Object
- #model_class ⇒ Object
- #page_actions ⇒ Object
- #row_url(zone) ⇒ Object
- #scopes ⇒ Object
- #search_key ⇒ Object
- #search_url ⇒ Object
Instance Method Details
#batch_actions ⇒ Object
30 31 32 33 34 35 36 37 38 39 |
# File 'app/components/solidus_admin/zones/index/component.rb', line 30 def batch_actions [ { label: t('.batch_actions.delete'), action: solidus_admin.zones_path, method: :delete, icon: 'delete-bin-7-line', }, ] end |
#columns ⇒ Object
49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'app/components/solidus_admin/zones/index/component.rb', line 49 def columns [ :name, :description, { header: :kind, data: -> { component('ui/badge').new(name: _1.kind, color: _1.kind == 'country' ? :green : :blue) }, }, { header: :zone_members, data: -> { _1.zone_members.map(&:zoneable).map(&:name).to_sentence }, }, ] end |
#filters ⇒ Object
45 46 47 |
# File 'app/components/solidus_admin/zones/index/component.rb', line 45 def filters [] end |
#model_class ⇒ Object
4 5 6 |
# File 'app/components/solidus_admin/zones/index/component.rb', line 4 def model_class Spree::Zone end |
#page_actions ⇒ Object
20 21 22 23 24 25 26 27 28 |
# File 'app/components/solidus_admin/zones/index/component.rb', line 20 def page_actions render component("ui/button").new( tag: :a, text: t('.add'), href: spree.new_admin_zone_path, icon: "add-line", class: "align-self-end w-full", ) end |
#row_url(zone) ⇒ Object
16 17 18 |
# File 'app/components/solidus_admin/zones/index/component.rb', line 16 def row_url(zone) spree.edit_admin_zone_path(zone) end |
#scopes ⇒ Object
41 42 43 |
# File 'app/components/solidus_admin/zones/index/component.rb', line 41 def scopes [] end |
#search_key ⇒ Object
8 9 10 |
# File 'app/components/solidus_admin/zones/index/component.rb', line 8 def search_key :name_or_description_cont end |
#search_url ⇒ Object
12 13 14 |
# File 'app/components/solidus_admin/zones/index/component.rb', line 12 def search_url solidus_admin.zones_path end |