Class: SolidusAdmin::Properties::Index::Component

Inherits:
UI::Pages::Index::Component
  • Object
show all
Defined in:
app/components/solidus_admin/properties/index/component.rb

Instance Method Summary collapse

Instance Method Details

#batch_actionsObject



29
30
31
32
33
34
35
36
37
38
# File 'app/components/solidus_admin/properties/index/component.rb', line 29

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

#columnsObject



40
41
42
43
44
45
# File 'app/components/solidus_admin/properties/index/component.rb', line 40

def columns
  [
    name_column,
    presentation_column,
  ]
end

#model_classObject



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

def model_class
  Spree::Property
end

#name_columnObject



47
48
49
50
51
52
53
54
# File 'app/components/solidus_admin/properties/index/component.rb', line 47

def name_column
  {
    header: :name,
    data: ->(property) do
       :div, property.name
    end
  }
end

#page_actionsObject



20
21
22
23
24
25
26
27
# File 'app/components/solidus_admin/properties/index/component.rb', line 20

def page_actions
  render component("ui/button").new(
    tag: :a,
    text: t('.add'),
    href: spree.new_admin_property_path,
    icon: "add-line",
  )
end

#presentation_columnObject



56
57
58
59
60
61
62
63
# File 'app/components/solidus_admin/properties/index/component.rb', line 56

def presentation_column
  {
    header: :presentation,
    data: ->(property) do
       :div, property.presentation
    end
  }
end

#row_url(property) ⇒ Object



16
17
18
# File 'app/components/solidus_admin/properties/index/component.rb', line 16

def row_url(property)
  spree.admin_property_path(property)
end

#search_keyObject



8
9
10
# File 'app/components/solidus_admin/properties/index/component.rb', line 8

def search_key
  :name_cont
end

#search_urlObject



12
13
14
# File 'app/components/solidus_admin/properties/index/component.rb', line 12

def search_url
  solidus_admin.properties_path
end