baldur 0.2.0 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile +1 -1
- data/TODO.md +7 -1
- data/app/assets/stylesheets/baldur/application/components/auth-page.css +7 -0
- data/app/assets/tailwind/baldur/engine.css +2 -2
- data/app/helpers/baldur/marketing_helper.rb +71 -69
- data/app/helpers/baldur/optional/auth_page_helper.rb +4 -2
- data/app/helpers/baldur/optional/google_auth_helper.rb +2 -2
- data/app/helpers/baldur/optional/panel_secondary_helper.rb +3 -2
- data/app/helpers/baldur/ui_helper.rb +151 -138
- data/app/helpers/baldur/ui_helper_feedback.rb +38 -36
- data/app/helpers/baldur/ui_helper_forms.rb +81 -76
- data/app/helpers/baldur/ui_helper_sidebar.rb +6 -5
- data/app/helpers/baldur/ui_helper_unavailable.rb +17 -15
- data/app/views/baldur/components/_theme_toggle.html.erb +23 -0
- data/app/views/baldur/optional/_auth_page.html.erb +6 -0
- data/baldur.gemspec +23 -23
- data/config/importmap.rb +2 -2
- data/lib/baldur/configuration.rb +6 -6
- data/lib/baldur/engine.rb +3 -3
- data/lib/baldur/version.rb +1 -1
- data/lib/baldur.rb +5 -5
- data/lib/generators/baldur/install/install_generator.rb +19 -19
- data/lib/generators/baldur/install/templates/baldur_initializer.rb +7 -7
- data/lib/generators/baldur/install/templates/theme.css +32 -6
- data/lib/generators/baldur/install_google_auth/install_google_auth_generator.rb +2 -2
- data/lib/generators/baldur/install_panel_right/install_panel_right_generator.rb +2 -2
- data/lib/generators/baldur/install_panel_secondary/install_panel_secondary_generator.rb +3 -3
- data/script/verify_host_install +59 -31
- data/test/confirmation_modal_helper_test.rb +34 -34
- data/test/csp_rendering_test.rb +21 -21
- data/test/engine_css_test.rb +36 -0
- data/test/fixtures/shared/_brand_lockup.html.erb +1 -0
- data/test/gemspec_test.rb +7 -5
- data/test/install_generator_test.rb +25 -21
- data/test/install_panel_secondary_generator_test.rb +12 -9
- data/test/marketing_helper_test.rb +7 -7
- data/test/run_all.rb +1 -1
- data/test/sidebar_helper_test.rb +16 -16
- data/test/test_helper.rb +14 -14
- data/test/theme_toggle_helper_test.rb +119 -0
- data/test/tmp/install_generator/app/assets/stylesheets/theme.css +32 -6
- data/test/tmp/install_generator/config/initializers/baldur.rb +7 -7
- metadata +5 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
require
|
|
1
|
+
require 'securerandom'
|
|
2
2
|
|
|
3
3
|
module Baldur
|
|
4
4
|
module UiHelper
|
|
@@ -9,14 +9,14 @@ module Baldur
|
|
|
9
9
|
include Baldur::UiHelperForms
|
|
10
10
|
|
|
11
11
|
def ui_icon(name, class_name: nil)
|
|
12
|
-
normalized_name = name.to_s.tr(
|
|
13
|
-
svg_options = LucideRails.default_options.merge(
|
|
12
|
+
normalized_name = name.to_s.tr('_', '-')
|
|
13
|
+
svg_options = LucideRails.default_options.merge('class' => class_name, 'aria-hidden' => 'true')
|
|
14
14
|
|
|
15
15
|
content_tag(:svg, LucideRails::IconProvider.icon(normalized_name).html_safe, svg_options)
|
|
16
16
|
end
|
|
17
17
|
|
|
18
18
|
def ui_button(**options)
|
|
19
|
-
baldur_render
|
|
19
|
+
baldur_render 'baldur/components/button', **options
|
|
20
20
|
end
|
|
21
21
|
|
|
22
22
|
def ui_action_row(primary_button:, secondary_button: nil, extra_buttons: [], classes: nil)
|
|
@@ -25,208 +25,221 @@ module Baldur
|
|
|
25
25
|
buttons.concat(Array(extra_buttons).compact)
|
|
26
26
|
buttons << primary_button if primary_button.present?
|
|
27
27
|
|
|
28
|
-
baldur_render
|
|
28
|
+
baldur_render 'baldur/components/action_row', buttons: buttons, class: classes
|
|
29
29
|
end
|
|
30
30
|
|
|
31
|
-
def ui_card(title:, description: nil, badge: nil, icon: nil, actions: nil, variant: :default, classes: nil,
|
|
31
|
+
def ui_card(title:, description: nil, badge: nil, icon: nil, actions: nil, variant: :default, classes: nil,
|
|
32
|
+
body_class: nil, body: nil, &block)
|
|
32
33
|
body_content = body
|
|
33
34
|
body_content = capture(&block) if block_given?
|
|
34
|
-
baldur_render
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
end
|
|
45
|
-
|
|
46
|
-
def ui_table(columns:, rows:, empty_state:
|
|
47
|
-
card_options = options.slice(:title, :title_meta, :description, :actions, :controls, :controls_position, :footer,
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
35
|
+
baldur_render 'baldur/components/card',
|
|
36
|
+
title: title,
|
|
37
|
+
description: description,
|
|
38
|
+
badge: badge,
|
|
39
|
+
icon: icon,
|
|
40
|
+
actions: actions,
|
|
41
|
+
variant: variant,
|
|
42
|
+
class: classes,
|
|
43
|
+
body_class: body_class,
|
|
44
|
+
body: body_content
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def ui_table(columns:, rows:, empty_state: 'No records yet', **options)
|
|
48
|
+
card_options = options.slice(:title, :title_meta, :description, :actions, :controls, :controls_position, :footer,
|
|
49
|
+
:classes)
|
|
50
|
+
table_options = options.except(:title, :title_meta, :description, :actions, :controls, :controls_position,
|
|
51
|
+
:footer, :classes)
|
|
52
|
+
table_markup = baldur_render 'baldur/components/table',
|
|
53
|
+
**{
|
|
54
|
+
columns: columns,
|
|
55
|
+
rows: rows,
|
|
56
|
+
empty_state: empty_state
|
|
57
|
+
}.merge(table_options)
|
|
55
58
|
return table_markup if card_options.values.all?(&:blank?)
|
|
56
59
|
|
|
57
60
|
ui_table_card(**card_options, body: table_markup)
|
|
58
61
|
end
|
|
59
62
|
|
|
60
|
-
def ui_table_card(title: nil, title_meta: nil, description: nil, actions: nil, controls: nil,
|
|
63
|
+
def ui_table_card(title: nil, title_meta: nil, description: nil, actions: nil, controls: nil,
|
|
64
|
+
controls_position: :row, footer: nil, classes: nil, body: nil, &block)
|
|
61
65
|
body_content = body
|
|
62
66
|
body_content = capture(&block) if block_given?
|
|
63
|
-
baldur_render
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
67
|
+
baldur_render 'baldur/components/table_card',
|
|
68
|
+
title: title,
|
|
69
|
+
title_meta: title_meta,
|
|
70
|
+
description: description,
|
|
71
|
+
actions: actions,
|
|
72
|
+
controls: controls,
|
|
73
|
+
controls_position: controls_position,
|
|
74
|
+
footer: footer,
|
|
75
|
+
class: classes,
|
|
76
|
+
body: body_content
|
|
73
77
|
end
|
|
74
78
|
|
|
75
79
|
def ui_chart_card(title: nil, description: nil, actions: nil, footer: nil, classes: nil, body: nil, &block)
|
|
76
80
|
body_content = body
|
|
77
81
|
body_content = capture(&block) if block_given?
|
|
78
|
-
baldur_render
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
end
|
|
86
|
-
|
|
87
|
-
def ui_table_footer(current_page:, total_pages:, path_builder:, total_count: nil, per_page: nil,
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
82
|
+
baldur_render 'baldur/components/chart_card',
|
|
83
|
+
title: title,
|
|
84
|
+
description: description,
|
|
85
|
+
actions: actions,
|
|
86
|
+
footer: footer,
|
|
87
|
+
class: classes,
|
|
88
|
+
body: body_content
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
def ui_table_footer(current_page:, total_pages:, path_builder:, total_count: nil, per_page: nil,
|
|
92
|
+
rows_per_page_param: nil, rows_per_page_options: [], rows_per_page_selected: nil)
|
|
93
|
+
baldur_render 'baldur/components/table_footer',
|
|
94
|
+
current_page: current_page.to_i,
|
|
95
|
+
total_pages: total_pages.to_i,
|
|
96
|
+
total_count: total_count,
|
|
97
|
+
per_page: per_page,
|
|
98
|
+
rows_per_page_param: rows_per_page_param,
|
|
99
|
+
rows_per_page_options: Array(rows_per_page_options),
|
|
100
|
+
rows_per_page_selected: rows_per_page_selected,
|
|
101
|
+
path_builder: path_builder
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
def ui_table_truncated_text(text, class_name: 'block truncate', title: nil)
|
|
100
105
|
value = text.to_s.strip
|
|
101
|
-
return
|
|
106
|
+
return '—' if value.blank?
|
|
102
107
|
|
|
103
|
-
content_tag(:span, value, class: class_name, title:
|
|
108
|
+
content_tag(:span, value, class: class_name, title: title.presence || value)
|
|
104
109
|
end
|
|
105
110
|
|
|
106
111
|
def ui_expandable_table_list(items)
|
|
107
112
|
values = Array(items).compact.map(&:to_s).map(&:strip).reject(&:blank?)
|
|
108
|
-
return
|
|
113
|
+
return '—' if values.empty?
|
|
109
114
|
|
|
110
|
-
summary = values.join(
|
|
115
|
+
summary = values.join(', ')
|
|
111
116
|
return ui_table_truncated_text(summary) if values.size <= 2
|
|
112
117
|
|
|
113
|
-
content_tag(:div, class:
|
|
118
|
+
content_tag(:div, class: 'table-disclosure', data: { controller: 'table-disclosure' }) do
|
|
114
119
|
safe_join(
|
|
115
120
|
[
|
|
116
121
|
content_tag(
|
|
117
122
|
:button,
|
|
118
|
-
type:
|
|
119
|
-
class:
|
|
120
|
-
aria: { expanded:
|
|
123
|
+
type: 'button',
|
|
124
|
+
class: 'table-disclosure__trigger',
|
|
125
|
+
aria: { expanded: 'false' },
|
|
121
126
|
data: {
|
|
122
|
-
action:
|
|
123
|
-
table_disclosure_target:
|
|
127
|
+
action: 'click->table-disclosure#toggle',
|
|
128
|
+
table_disclosure_target: 'trigger'
|
|
124
129
|
}
|
|
125
130
|
) do
|
|
126
131
|
safe_join(
|
|
127
132
|
[
|
|
128
|
-
content_tag(:span, "#{values.size} items", class:
|
|
129
|
-
content_tag(:span,
|
|
130
|
-
content_tag(:span,
|
|
133
|
+
content_tag(:span, "#{values.size} items", class: 'table-disclosure__summary', title: summary),
|
|
134
|
+
content_tag(:span, 'Expand', class: 'table-disclosure__toggle table-disclosure__toggle--collapsed'),
|
|
135
|
+
content_tag(:span, 'Collapse', class: 'table-disclosure__toggle table-disclosure__toggle--expanded')
|
|
131
136
|
]
|
|
132
137
|
)
|
|
133
138
|
end,
|
|
134
|
-
content_tag(:div, class:
|
|
135
|
-
safe_join(values.map { |value| content_tag(:div, value, class:
|
|
139
|
+
content_tag(:div, class: 'table-disclosure__content', data: { table_disclosure_target: 'content' }) do
|
|
140
|
+
safe_join(values.map { |value| content_tag(:div, value, class: 'table-disclosure__content-item') })
|
|
136
141
|
end
|
|
137
142
|
]
|
|
138
143
|
)
|
|
139
144
|
end
|
|
140
145
|
end
|
|
141
146
|
|
|
142
|
-
def ui_pagination(current_page:, total_pages:, path_builder:, total_count: nil, per_page: nil, window: 2,
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
147
|
+
def ui_pagination(current_page:, total_pages:, path_builder:, total_count: nil, per_page: nil, window: 2,
|
|
148
|
+
rows_per_page_param: nil, rows_per_page_options: [], rows_per_page_selected: nil)
|
|
149
|
+
baldur_render 'baldur/components/pagination',
|
|
150
|
+
current_page: current_page.to_i,
|
|
151
|
+
total_pages: total_pages.to_i,
|
|
152
|
+
total_count: total_count,
|
|
153
|
+
per_page: per_page,
|
|
154
|
+
rows_per_page_param: rows_per_page_param,
|
|
155
|
+
rows_per_page_options: Array(rows_per_page_options),
|
|
156
|
+
rows_per_page_selected: rows_per_page_selected,
|
|
157
|
+
path_builder: path_builder,
|
|
158
|
+
pages: ui_pagination_pages(current_page: current_page.to_i, total_pages: total_pages.to_i,
|
|
159
|
+
window: window.to_i)
|
|
153
160
|
end
|
|
154
161
|
|
|
155
|
-
def ui_modal(id:, title:, description: nil, submit_label:
|
|
162
|
+
def ui_modal(id:, title:, description: nil, submit_label: 'Continue', close_label: 'Cancel', **options, &block)
|
|
156
163
|
body = block_given? ? capture(&block) : nil
|
|
157
|
-
baldur_render
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
164
|
+
baldur_render 'baldur/components/modal',
|
|
165
|
+
**{
|
|
166
|
+
id: id,
|
|
167
|
+
title: title,
|
|
168
|
+
description: description,
|
|
169
|
+
submit_label: submit_label,
|
|
170
|
+
close_label: close_label,
|
|
171
|
+
body: body
|
|
172
|
+
}.merge(options)
|
|
166
173
|
end
|
|
167
174
|
|
|
168
175
|
def ui_modal_host(id:, classes: nil, &block)
|
|
169
176
|
body = block_given? ? capture(&block) : nil
|
|
170
|
-
baldur_render
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
177
|
+
baldur_render 'baldur/components/modal_host',
|
|
178
|
+
id: id,
|
|
179
|
+
classes: classes,
|
|
180
|
+
body: body
|
|
174
181
|
end
|
|
175
182
|
|
|
176
|
-
def ui_confirmation_modal(host_id:, dialog_id:, title:, description: nil, tone: :default, confirm_label:
|
|
183
|
+
def ui_confirmation_modal(host_id:, dialog_id:, title:, description: nil, tone: :default, confirm_label: 'Confirm',
|
|
184
|
+
cancel_label: 'Cancel', confirm_button_options: {}, cancel_button_options: {}, type_to_confirm: nil, body: nil, &block)
|
|
177
185
|
body = block_given? ? capture(&block) : body
|
|
178
186
|
type_to_confirm = nil unless type_to_confirm.is_a?(Hash)
|
|
179
|
-
baldur_render
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
187
|
+
baldur_render 'baldur/components/confirmation_modal',
|
|
188
|
+
host_id: host_id,
|
|
189
|
+
dialog_id: dialog_id,
|
|
190
|
+
title: title,
|
|
191
|
+
description: description,
|
|
192
|
+
tone: tone,
|
|
193
|
+
confirm_label: confirm_label,
|
|
194
|
+
cancel_label: cancel_label,
|
|
195
|
+
confirm_button_options: confirm_button_options,
|
|
196
|
+
cancel_button_options: cancel_button_options,
|
|
197
|
+
type_to_confirm: type_to_confirm,
|
|
198
|
+
body: body
|
|
191
199
|
end
|
|
192
200
|
|
|
193
201
|
def ui_badge(text:, variant: :default, size: :sm, html_options: {})
|
|
194
|
-
baldur_render
|
|
202
|
+
baldur_render 'baldur/components/badge', text: text, variant: variant, size: size, html_options: html_options
|
|
203
|
+
end
|
|
204
|
+
|
|
205
|
+
def ui_kpi(label:, value:, id: nil, caption: nil, trend: nil, variant: :default, caption_icon: nil, action: nil)
|
|
206
|
+
baldur_render 'baldur/components/kpi',
|
|
207
|
+
id: id,
|
|
208
|
+
label: label,
|
|
209
|
+
value: value,
|
|
210
|
+
caption: caption,
|
|
211
|
+
trend: trend,
|
|
212
|
+
variant: variant,
|
|
213
|
+
caption_icon: caption_icon,
|
|
214
|
+
action: action
|
|
195
215
|
end
|
|
196
216
|
|
|
197
|
-
def
|
|
198
|
-
baldur_render
|
|
199
|
-
id: id,
|
|
200
|
-
label: label,
|
|
201
|
-
value: value,
|
|
202
|
-
caption: caption,
|
|
203
|
-
trend: trend,
|
|
204
|
-
variant: variant,
|
|
205
|
-
caption_icon: caption_icon,
|
|
206
|
-
action: action
|
|
217
|
+
def ui_segmented_buttons(items:, aria_label: 'Tabs', classes: nil)
|
|
218
|
+
baldur_render 'baldur/components/segmented_buttons', items: items, aria_label: aria_label, classes: classes
|
|
207
219
|
end
|
|
208
220
|
|
|
209
|
-
def
|
|
210
|
-
|
|
221
|
+
def ui_tooltip(text:, content:, show_icon: true, icon: 'circle-help', variant: :link, wrapper_class: nil,
|
|
222
|
+
trigger_class: nil, bubble_class: nil, inline: false)
|
|
223
|
+
baldur_render 'baldur/components/tooltip',
|
|
224
|
+
text: text,
|
|
225
|
+
content: content,
|
|
226
|
+
show_icon: show_icon,
|
|
227
|
+
icon: icon,
|
|
228
|
+
variant: variant,
|
|
229
|
+
wrapper_class: wrapper_class,
|
|
230
|
+
trigger_class: trigger_class,
|
|
231
|
+
bubble_class: bubble_class,
|
|
232
|
+
inline: inline
|
|
211
233
|
end
|
|
212
234
|
|
|
213
|
-
def
|
|
214
|
-
baldur_render
|
|
215
|
-
text: text,
|
|
216
|
-
content: content,
|
|
217
|
-
show_icon: show_icon,
|
|
218
|
-
icon: icon,
|
|
219
|
-
variant: variant,
|
|
220
|
-
wrapper_class: wrapper_class,
|
|
221
|
-
trigger_class: trigger_class,
|
|
222
|
-
bubble_class: bubble_class,
|
|
223
|
-
inline: inline
|
|
235
|
+
def ui_theme_toggle(aria_label: "Toggle theme", classes: nil)
|
|
236
|
+
baldur_render 'baldur/components/theme_toggle', aria_label: aria_label, classes: classes
|
|
224
237
|
end
|
|
225
238
|
|
|
226
239
|
def ui_pagination_pages(current_page:, total_pages:, window:)
|
|
227
240
|
return [] if total_pages <= 1
|
|
228
241
|
|
|
229
|
-
raw_pages = [
|
|
242
|
+
raw_pages = [1]
|
|
230
243
|
raw_pages.concat(((current_page - window)..(current_page + window)).to_a)
|
|
231
244
|
raw_pages << total_pages
|
|
232
245
|
normalized = raw_pages.select { |page| page.between?(1, total_pages) }.uniq.sort
|
|
@@ -1,44 +1,46 @@
|
|
|
1
1
|
module Baldur
|
|
2
2
|
module UiHelperFeedback
|
|
3
|
-
def ui_alert(body: nil, variant: :notice, title: nil, icon: nil, actions: nil, collapsible: false,
|
|
3
|
+
def ui_alert(body: nil, variant: :notice, title: nil, icon: nil, actions: nil, collapsible: false,
|
|
4
|
+
collapse_key: nil, collapsed_summary_action_label: 'More', class_name: nil, &block)
|
|
4
5
|
content = body
|
|
5
6
|
content = capture(&block) if block_given?
|
|
6
7
|
storage_key = collapsible ? ui_alert_storage_key(collapse_key) : nil
|
|
7
8
|
|
|
8
|
-
baldur_render
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
9
|
+
baldur_render 'baldur/components/alert',
|
|
10
|
+
variant: variant,
|
|
11
|
+
title: title,
|
|
12
|
+
icon: icon,
|
|
13
|
+
body: content,
|
|
14
|
+
actions: actions,
|
|
15
|
+
collapsible: collapsible,
|
|
16
|
+
collapse_storage_key: storage_key,
|
|
17
|
+
collapsed: collapsible && ui_alert_collapsed?(storage_key),
|
|
18
|
+
collapsed_summary_action_label: collapsed_summary_action_label,
|
|
19
|
+
class_name: class_name
|
|
19
20
|
end
|
|
20
21
|
|
|
21
22
|
def ui_snackbar_stack(snackbars: [])
|
|
22
|
-
baldur_render
|
|
23
|
+
baldur_render 'baldur/components/snackbar_stack', snackbars: normalize_snackbars(snackbars)
|
|
23
24
|
end
|
|
24
25
|
|
|
25
|
-
def ui_checkbox_tag(name, label: nil, description: nil, value:
|
|
26
|
+
def ui_checkbox_tag(name, label: nil, description: nil, value: '1', checked: false, required: false,
|
|
27
|
+
disabled: false, id: nil, data: nil, aria: nil, form: nil, wrapper_class: nil, input_class: nil, &block)
|
|
26
28
|
body = block_given? ? capture(&block) : nil
|
|
27
|
-
baldur_render
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
29
|
+
baldur_render 'baldur/components/checkbox',
|
|
30
|
+
name: name,
|
|
31
|
+
label: label,
|
|
32
|
+
description: description,
|
|
33
|
+
value: value,
|
|
34
|
+
checked: checked,
|
|
35
|
+
required: required,
|
|
36
|
+
disabled: disabled,
|
|
37
|
+
id: id,
|
|
38
|
+
data: data,
|
|
39
|
+
aria: aria,
|
|
40
|
+
form: form,
|
|
41
|
+
wrapper_class: wrapper_class,
|
|
42
|
+
input_class: input_class,
|
|
43
|
+
body: body
|
|
42
44
|
end
|
|
43
45
|
|
|
44
46
|
private
|
|
@@ -54,12 +56,12 @@ module Baldur
|
|
|
54
56
|
|
|
55
57
|
def normalize_snackbar_payload(snackbar)
|
|
56
58
|
payload = if snackbar.respond_to?(:with_indifferent_access)
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
59
|
+
snackbar.with_indifferent_access
|
|
60
|
+
elsif snackbar.respond_to?(:to_h)
|
|
61
|
+
snackbar.to_h.with_indifferent_access
|
|
62
|
+
else
|
|
63
|
+
{ message: snackbar }.with_indifferent_access
|
|
64
|
+
end
|
|
63
65
|
|
|
64
66
|
{
|
|
65
67
|
variant: (payload[:variant].presence || :notice).to_sym,
|
|
@@ -85,7 +87,7 @@ module Baldur
|
|
|
85
87
|
def ui_alert_collapsed?(storage_key)
|
|
86
88
|
return false if storage_key.blank?
|
|
87
89
|
|
|
88
|
-
cookies[storage_key] ==
|
|
90
|
+
cookies[storage_key] == 'true'
|
|
89
91
|
rescue NoMethodError
|
|
90
92
|
false
|
|
91
93
|
end
|