Class: SolidusAdmin::StoreCreditReasons::Index::Component

Inherits:
RefundsAndReturns::Component
  • Object
show all
Defined in:
app/components/solidus_admin/store_credit_reasons/index/component.rb

Instance Method Summary collapse

Instance Method Details

#batch_actionsObject



37
38
39
40
41
42
43
44
45
46
# File 'app/components/solidus_admin/store_credit_reasons/index/component.rb', line 37

def batch_actions
  [
    {
      label: t('.batch_actions.delete'),
      action: solidus_admin.store_credit_reasons_path,
      method: :delete,
      icon: 'delete-bin-7-line',
    },
  ]
end

#columnsObject



48
49
50
51
52
53
54
55
56
57
58
# File 'app/components/solidus_admin/store_credit_reasons/index/component.rb', line 48

def columns
  [
    :name,
    {
      header: :active,
      data: ->(store_credit_reason) do
        store_credit_reason.active? ? component('ui/badge').yes : component('ui/badge').no
      end
    },
  ]
end

#model_classObject



4
5
6
# File 'app/components/solidus_admin/store_credit_reasons/index/component.rb', line 4

def model_class
  Spree::StoreCreditReason
end

#page_actionsObject



8
9
10
11
12
13
14
15
16
# File 'app/components/solidus_admin/store_credit_reasons/index/component.rb', line 8

def page_actions
  render component("ui/button").new(
    tag: :a,
    text: t('.add'),
    href: solidus_admin.new_store_credit_reason_path, data: { turbo_frame: :new_store_credit_reason_modal },
    icon: "add-line",
    class: "align-self-end w-full",
  )
end

#row_url(store_credit_reason) ⇒ Object



25
26
27
# File 'app/components/solidus_admin/store_credit_reasons/index/component.rb', line 25

def row_url(store_credit_reason)
  spree.edit_admin_store_credit_reason_path(store_credit_reason, _turbo_frame: :edit_store_credit_reason_modal)
end

#search_keyObject



33
34
35
# File 'app/components/solidus_admin/store_credit_reasons/index/component.rb', line 33

def search_key
  :name_cont
end

#search_urlObject



29
30
31
# File 'app/components/solidus_admin/store_credit_reasons/index/component.rb', line 29

def search_url
  solidus_admin.store_credit_reasons_path
end

#turbo_framesObject



18
19
20
21
22
23
# File 'app/components/solidus_admin/store_credit_reasons/index/component.rb', line 18

def turbo_frames
  %w[
    new_store_credit_reason_modal
    edit_store_credit_reason_modal
  ]
end