Class: SolidusAdmin::UI::Pages::Index::Component
- Inherits:
-
BaseComponent
- Object
- BaseComponent
- SolidusAdmin::UI::Pages::Index::Component
show all
- Includes:
- Layout::PageHelpers
- Defined in:
- app/components/solidus_admin/ui/pages/index/component.rb
Direct Known Subclasses
OptionTypes::Index::Component, Orders::Index::Component, Orders::Show::Adjustments::Index::Component, PaymentMethods::Index::Component, Products::Index::Component, Properties::Index::Component, RefundsAndReturns::Component, Shipping::Component, StockItems::Index::Component, Stores::Index::Component, Taxes::Component, Taxonomies::Index::Component, SolidusAdmin::UsersAndRoles::Component, Zones::Index::Component
Defined Under Namespace
Classes: Tab
Instance Method Summary
collapse
Constructor Details
#initialize(page:) ⇒ Component
Returns a new instance of Component.
23
24
25
26
|
# File 'app/components/solidus_admin/ui/pages/index/component.rb', line 23
def initialize(page:)
@page = page
@tabs = tabs&.map { |tab| Tab.new(**tab) }
end
|
Instance Method Details
#back_url ⇒ Object
11
|
# File 'app/components/solidus_admin/ui/pages/index/component.rb', line 11
def back_url; end
|
#batch_actions ⇒ Object
18
|
# File 'app/components/solidus_admin/ui/pages/index/component.rb', line 18
def batch_actions; []; end
|
#columns ⇒ Object
21
|
# File 'app/components/solidus_admin/ui/pages/index/component.rb', line 21
def columns; []; end
|
#filters ⇒ Object
20
|
# File 'app/components/solidus_admin/ui/pages/index/component.rb', line 20
def filters; []; end
|
#model_class ⇒ Object
10
|
# File 'app/components/solidus_admin/ui/pages/index/component.rb', line 10
def model_class; end
|
#next_page_path ⇒ Object
52
53
54
|
# File 'app/components/solidus_admin/ui/pages/index/component.rb', line 52
def next_page_path
solidus_admin.url_for(**request.params, page: @page.next_param, only_path: true) unless @page.last?
end
|
#page_actions ⇒ Object
14
|
# File 'app/components/solidus_admin/ui/pages/index/component.rb', line 14
def page_actions; end
|
#prev_page_path ⇒ Object
48
49
50
|
# File 'app/components/solidus_admin/ui/pages/index/component.rb', line 48
def prev_page_path
solidus_admin.url_for(**request.params, page: @page.number - 1, only_path: true) unless @page.first?
end
|
96
97
98
99
100
|
# File 'app/components/solidus_admin/ui/pages/index/component.rb', line 96
def
= self.
{ } if
end
|
#render_table ⇒ Object
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
|
# File 'app/components/solidus_admin/ui/pages/index/component.rb', line 78
def render_table
render component('ui/table').new(
id: stimulus_id,
data: {
class: model_class,
rows:,
fade: -> { row_fade(_1) },
prev: prev_page_path,
next: next_page_path,
columns:,
batch_actions:,
url: -> { row_url(_1) },
},
search: search_options,
sortable: sortable_options,
)
end
|
#render_title ⇒ Object
69
70
71
72
73
74
75
76
|
# File 'app/components/solidus_admin/ui/pages/index/component.rb', line 69
def render_title
back_url = self.back_url
safe_join [
( back_url if back_url),
(title),
]
end
|
#row_fade(_record) ⇒ Object
28
29
30
|
# File 'app/components/solidus_admin/ui/pages/index/component.rb', line 28
def row_fade(_record)
false
end
|
#row_url(_record) ⇒ Object
17
|
# File 'app/components/solidus_admin/ui/pages/index/component.rb', line 17
def row_url(_record); end
|
#rows ⇒ Object
44
45
46
|
# File 'app/components/solidus_admin/ui/pages/index/component.rb', line 44
def rows
@page.records
end
|
#scopes ⇒ Object
19
|
# File 'app/components/solidus_admin/ui/pages/index/component.rb', line 19
def scopes; []; end
|
#search_key ⇒ Object
12
|
# File 'app/components/solidus_admin/ui/pages/index/component.rb', line 12
def search_key; end
|
#search_name ⇒ Object
40
41
42
|
# File 'app/components/solidus_admin/ui/pages/index/component.rb', line 40
def search_name
:q
end
|
#search_options ⇒ Object
56
57
58
59
60
61
62
63
64
65
66
67
|
# File 'app/components/solidus_admin/ui/pages/index/component.rb', line 56
def search_options
return unless search_url
{
name: search_name,
value: search_params,
url: search_url,
searchbar_key: search_key,
filters:,
scopes:,
}
end
|
#search_params ⇒ Object
36
37
38
|
# File 'app/components/solidus_admin/ui/pages/index/component.rb', line 36
def search_params
params[:q]
end
|
#search_url ⇒ Object
13
|
# File 'app/components/solidus_admin/ui/pages/index/component.rb', line 13
def search_url; end
|
15
|
# File 'app/components/solidus_admin/ui/pages/index/component.rb', line 15
def ; end
|
#sortable_options ⇒ Object
16
|
# File 'app/components/solidus_admin/ui/pages/index/component.rb', line 16
def sortable_options; end
|
#tabs ⇒ Object
9
|
# File 'app/components/solidus_admin/ui/pages/index/component.rb', line 9
def tabs; end
|
#title ⇒ Object
32
33
34
|
# File 'app/components/solidus_admin/ui/pages/index/component.rb', line 32
def title
model_class.model_name.human.pluralize
end
|
#turbo_frames ⇒ Object
102
103
104
|
# File 'app/components/solidus_admin/ui/pages/index/component.rb', line 102
def turbo_frames
[]
end
|