ndr_ui 4.1.2 → 5.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +16 -0
- data/app/assets/fonts/bootstrap-icons.woff +0 -0
- data/app/assets/fonts/bootstrap-icons.woff2 +0 -0
- data/app/assets/javascripts/ndr_ui/index.js +1 -0
- data/app/assets/stylesheets/ndr_ui/bootstrap-icons.scss +2090 -0
- data/app/assets/stylesheets/ndr_ui/index.scss +11 -3
- data/app/builders/ndr_ui/bootstrap/datepicker.rb +4 -4
- data/app/builders/ndr_ui/bootstrap/form_control_class.rb +2 -2
- data/app/builders/ndr_ui/bootstrap/inline_errors_and_warnings.rb +2 -2
- data/app/builders/ndr_ui/bootstrap/input_group_addons.rb +4 -10
- data/app/builders/ndr_ui/bootstrap/readonly.rb +12 -12
- data/app/builders/ndr_ui/bootstrap_builder.rb +32 -25
- data/app/helpers/ndr_ui/bootstrap/{accordion.rb → accordion_helper.rb} +49 -16
- data/app/helpers/ndr_ui/bootstrap/breadcrumbs_helper.rb +4 -4
- data/app/helpers/ndr_ui/bootstrap/card_helper.rb +94 -0
- data/app/helpers/ndr_ui/bootstrap/dropdown_helper.rb +16 -13
- data/app/helpers/ndr_ui/bootstrap/modal_helper.rb +15 -13
- data/app/helpers/ndr_ui/bootstrap_helper.rb +73 -67
- data/app/helpers/ndr_ui/css_helper.rb +1 -4
- data/lib/ndr_ui/engine.rb +2 -1
- data/lib/ndr_ui/version.rb +1 -1
- metadata +51 -20
- data/app/helpers/ndr_ui/bootstrap/panel_helper.rb +0 -87
@@ -50,6 +50,7 @@ module NdrUi
|
|
50
50
|
# # => <div class="modal-header">Check it out!!</div>
|
51
51
|
def bootstrap_modal_header_tag(*args, &block)
|
52
52
|
return bootstrap_modal_header_tag(capture(&block), *args) if block_given?
|
53
|
+
|
53
54
|
options = args.extract_options!
|
54
55
|
options.stringify_keys!
|
55
56
|
|
@@ -58,10 +59,11 @@ module NdrUi
|
|
58
59
|
# end
|
59
60
|
|
60
61
|
heading = content_tag(:h4, args.first, class: 'modal-title')
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
62
|
+
if options.delete('dismissible')
|
63
|
+
heading = button_tag(content_tag(:span, '×', 'aria-hidden': 'true'),
|
64
|
+
type: 'button', class: 'btn-close', 'data-bs-dismiss': 'modal',
|
65
|
+
'aria-label': 'Close') + heading
|
66
|
+
end
|
65
67
|
content_tag(:div, heading, class: 'modal-header')
|
66
68
|
end
|
67
69
|
|
@@ -109,21 +111,21 @@ module NdrUi
|
|
109
111
|
# <%= bootstrap_modal_footer_tag('Button text', readonly: true)
|
110
112
|
# # =>
|
111
113
|
# <div class="modal-footer">
|
112
|
-
# <button name="button" type="submit" class="btn btn-default" data-dismiss="modal">
|
114
|
+
# <button name="button" type="submit" class="btn btn-default" data-bs-dismiss="modal">
|
113
115
|
# Close
|
114
116
|
# </button>
|
115
117
|
# </div>
|
116
118
|
#
|
117
119
|
# <%= bootstrap_modal_footer_tag(readonly: false) do
|
118
|
-
# button_tag('Non-readonly default', class: 'btn btn-default',
|
119
|
-
# button_tag('Non-readonly primary', class: 'btn btn-primary',
|
120
|
+
# button_tag('Non-readonly default', class: 'btn btn-default', 'data-bs-dismiss': 'modal') +
|
121
|
+
# button_tag('Non-readonly primary', class: 'btn btn-primary', 'data-bs-dismiss': 'modal')
|
120
122
|
# end %>
|
121
123
|
# # =>
|
122
124
|
# <div class="modal-footer">
|
123
|
-
# <button name="button" type="submit" class="btn btn-default" data-dismiss="modal">
|
125
|
+
# <button name="button" type="submit" class="btn btn-default" data-bs-dismiss="modal">
|
124
126
|
# Non-readonly default
|
125
127
|
# </button>
|
126
|
-
# <button name="button" type="submit" class="btn btn-primary" data-dismiss="modal">
|
128
|
+
# <button name="button" type="submit" class="btn btn-primary" data-bs-dismiss="modal">
|
127
129
|
# Non-readonly primary
|
128
130
|
# </button>
|
129
131
|
# </div>
|
@@ -131,7 +133,7 @@ module NdrUi
|
|
131
133
|
# <%= bootstrap_modal_footer_tag('Button text') %>
|
132
134
|
# # =>
|
133
135
|
# <div class="modal-footer">
|
134
|
-
# <button name="button" type="submit" class="btn btn-default" data-dismiss="modal">
|
136
|
+
# <button name="button" type="submit" class="btn btn-default" data-bs-dismiss="modal">
|
135
137
|
# Button text
|
136
138
|
# </button>
|
137
139
|
# </div>
|
@@ -139,7 +141,7 @@ module NdrUi
|
|
139
141
|
# <%= bootstrap_modal_footer_tag %>
|
140
142
|
# # =>
|
141
143
|
# <div class="modal-footer">
|
142
|
-
# <button name="button" type="submit" class="btn btn-default" data-dismiss="modal">
|
144
|
+
# <button name="button" type="submit" class="btn btn-default" data-bs-dismiss="modal">
|
143
145
|
# Don't save
|
144
146
|
# </button>
|
145
147
|
# <input type="submit" name="commit" value="Save" class="btn btn-primary"
|
@@ -189,7 +191,7 @@ module NdrUi
|
|
189
191
|
# Pear form
|
190
192
|
# </div>
|
191
193
|
# <div class="modal-footer">
|
192
|
-
# <button type="button" class="btn btn-default" data-dismiss="modal">
|
194
|
+
# <button type="button" class="btn btn-default" data-bs-dismiss="modal">
|
193
195
|
# Don't save
|
194
196
|
# </button>
|
195
197
|
# <input name="commit" class="btn-primary btn" data-disable-with="Saving…"
|
@@ -216,7 +218,7 @@ module NdrUi
|
|
216
218
|
end
|
217
219
|
|
218
220
|
def bootstrap_modal_button(label)
|
219
|
-
button_tag(label, class: 'btn btn-default',
|
221
|
+
button_tag(label, type: 'button', class: 'btn btn-default', 'data-bs-dismiss': 'modal')
|
220
222
|
end
|
221
223
|
|
222
224
|
private
|
@@ -1,10 +1,23 @@
|
|
1
1
|
module NdrUi
|
2
2
|
# Provides helper methods for the Twitter Bootstrap framework
|
3
3
|
module BootstrapHelper # rubocop:disable Metrics/ModuleLength
|
4
|
+
include ::NdrUi::Bootstrap::AccordionHelper
|
4
5
|
include ::NdrUi::Bootstrap::BreadcrumbsHelper
|
6
|
+
include ::NdrUi::Bootstrap::CardHelper
|
5
7
|
include ::NdrUi::Bootstrap::DropdownHelper
|
6
8
|
include ::NdrUi::Bootstrap::ModalHelper
|
7
|
-
|
9
|
+
|
10
|
+
TYPE_STYLE_MAP = {
|
11
|
+
important: :danger,
|
12
|
+
default: :secondary
|
13
|
+
}.freeze
|
14
|
+
|
15
|
+
# ensure `form-control` and `form-select` classes added to select_tag
|
16
|
+
def select_tag(name, option_tags = nil, options = {})
|
17
|
+
options = css_class_options_merge(options, %w[form-control form-select])
|
18
|
+
|
19
|
+
super(name, option_tags, options)
|
20
|
+
end
|
8
21
|
|
9
22
|
# Creates an alert box of the given +type+. It supports the following alert box types
|
10
23
|
# <tt>:alert</tt>, <tt>:danger</tt>, <tt>:info</tt> and <tt>:success</tt>.
|
@@ -29,8 +42,8 @@ module NdrUi
|
|
29
42
|
# ==== Examples
|
30
43
|
#
|
31
44
|
# <%= bootstrap_alert_tag(:info, 'Check it out!!') %>
|
32
|
-
# # => <div class="alert alert-info"><a href="#" class="close"
|
33
|
-
# data-dismiss="alert"
|
45
|
+
# # => <div class="alert alert-info"><a href="#" class="btn-close"
|
46
|
+
# data-bs-dismiss="alert"></a>Check it out!!</div>
|
34
47
|
#
|
35
48
|
# You can use a block as well if your alert message is hard to fit into the message parameter.
|
36
49
|
# ERb example:
|
@@ -38,8 +51,8 @@ module NdrUi
|
|
38
51
|
# <%= bootstrap_alert_tag(:info) do %>
|
39
52
|
# Check it out!!
|
40
53
|
# <% end %>
|
41
|
-
# # => <div class="alert alert-info"
|
42
|
-
#
|
54
|
+
# # => <div class="alert alert-info">Check it out!!
|
55
|
+
# <button type="button" class="btn-close" data-bs-dismiss="alert"></button></div>
|
43
56
|
#
|
44
57
|
# Ids for css and/or javascript are easy to produce:
|
45
58
|
#
|
@@ -51,7 +64,7 @@ module NdrUi
|
|
51
64
|
if block_given?
|
52
65
|
message = capture(&block)
|
53
66
|
options = args[1] || {}
|
54
|
-
|
67
|
+
bootstrap_alert_tag(type, message, options)
|
55
68
|
else
|
56
69
|
message = args[1] || ''
|
57
70
|
options = args[2] || {}
|
@@ -65,10 +78,9 @@ module NdrUi
|
|
65
78
|
end
|
66
79
|
options['class'] = classes.join(' ')
|
67
80
|
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
"data-dismiss": 'alert') + message if options.delete('dismissible')
|
81
|
+
if options.delete('dismissible')
|
82
|
+
message = message.html_safe + button_tag('', type: 'button', class: 'btn-close', 'data-bs-dismiss': 'alert')
|
83
|
+
end
|
72
84
|
content_tag(:div, message, options)
|
73
85
|
end
|
74
86
|
end
|
@@ -87,8 +99,8 @@ module NdrUi
|
|
87
99
|
# # => <span class="label label-info">Check it out!!</span>
|
88
100
|
#
|
89
101
|
def bootstrap_label_tag(type, message)
|
90
|
-
|
91
|
-
content_tag(:span, message, class:
|
102
|
+
style = TYPE_STYLE_MAP[type] || type
|
103
|
+
content_tag(:span, message, class: "badge text-bg-#{style}")
|
92
104
|
end
|
93
105
|
|
94
106
|
# Creates an bootstrap badge of the given +type+. Bootstrap 3 does not support any types.
|
@@ -100,13 +112,11 @@ module NdrUi
|
|
100
112
|
# ==== Examples
|
101
113
|
#
|
102
114
|
# <%= bootstrap_badge_tag(:success, 'Check it out!!') %>
|
103
|
-
# # => <span class="badge">Check it out!!</span>
|
115
|
+
# # => <span class="badge rounded-pill text-bg-success">Check it out!!</span>
|
104
116
|
#
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
def bootstrap_badge_tag(_type, count)
|
109
|
-
content_tag(:span, count, class: 'badge')
|
117
|
+
def bootstrap_badge_tag(type, count)
|
118
|
+
style = TYPE_STYLE_MAP[type] || type
|
119
|
+
content_tag(:span, count, class: "badge rounded-pill text-bg-#{style}")
|
110
120
|
end
|
111
121
|
|
112
122
|
# Creates a simple bootstrap navigation caret.
|
@@ -132,13 +142,15 @@ module NdrUi
|
|
132
142
|
# ==== Examples
|
133
143
|
#
|
134
144
|
# <%= bootstrap_dropdown_toggle_tag('Check it out!!') %>
|
135
|
-
# # => <a href="#" class="dropdown-toggle" data-toggle="dropdown">
|
136
|
-
# out!! <b class="caret"></b></a>
|
145
|
+
# # => <a href="#" role="button" class="nav-link dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false">
|
146
|
+
# Check it out!! <b class="caret"></b></a>
|
137
147
|
def bootstrap_dropdown_toggle_tag(body)
|
138
148
|
link_to(ERB::Util.html_escape(body) + ' '.html_safe + bootstrap_caret_tag,
|
139
149
|
'#',
|
140
|
-
|
141
|
-
'
|
150
|
+
role: 'button',
|
151
|
+
class: 'nav-link dropdown-toggle',
|
152
|
+
'data-bs-toggle': 'dropdown',
|
153
|
+
'aria-expanded': 'false')
|
142
154
|
end
|
143
155
|
|
144
156
|
# Creates a simple bootstrap icon.
|
@@ -149,10 +161,17 @@ module NdrUi
|
|
149
161
|
#
|
150
162
|
# ==== Examples
|
151
163
|
#
|
152
|
-
# <%= bootstrap_icon_tag(:search) %>
|
164
|
+
# <%= bootstrap_icon_tag(:search, :bi) %>
|
165
|
+
# # => <i class="bi-search"></i>
|
166
|
+
#
|
167
|
+
# <%= bootstrap_icon_tag(:search, :glyphicon) %>
|
153
168
|
# # => <span class="glyphicon glyphicon-search"></span>
|
154
|
-
def bootstrap_icon_tag(type)
|
155
|
-
|
169
|
+
def bootstrap_icon_tag(type, set = :glyphicon)
|
170
|
+
if set == :bi
|
171
|
+
content_tag(:i, '', class: "bi-#{type}")
|
172
|
+
else
|
173
|
+
content_tag(:span, '', class: "glyphicon glyphicon-#{type}")
|
174
|
+
end
|
156
175
|
end
|
157
176
|
|
158
177
|
# Creates a simple bootstrap icon spinner.
|
@@ -184,16 +203,18 @@ module NdrUi
|
|
184
203
|
# ==== Examples
|
185
204
|
#
|
186
205
|
# <%= bootstrap_tab_nav_tag("Fruits", "#fruits", true) %>
|
187
|
-
# # => <li class="
|
206
|
+
# # => <li class="nav-item"><a class="nav-link active" href="#fruits" data-bs-toggle="tab">Fruits</a></li>
|
188
207
|
def bootstrap_tab_nav_tag(title, linkto, active = false)
|
189
208
|
content_tag('li',
|
190
|
-
link_to(title, linkto,
|
191
|
-
|
209
|
+
link_to(title, linkto, 'data-bs-toggle': 'tab', class: "nav-link#{active ? ' active' : ''}"),
|
210
|
+
class: 'nav-item')
|
192
211
|
end
|
193
212
|
|
194
213
|
# Convenience wrapper for a bootstrap_list_link_to with badge
|
195
214
|
def bootstrap_list_badge_and_link_to(type, count, name, path)
|
196
|
-
html = content_tag(:div, bootstrap_badge_tag(type, count), class: '
|
215
|
+
html = content_tag(:div, bootstrap_badge_tag(type, count), class: 'float-end') +
|
216
|
+
content_tag(:div, name, class: 'pe-5')
|
217
|
+
|
197
218
|
bootstrap_list_link_to(html, path)
|
198
219
|
end
|
199
220
|
|
@@ -219,25 +240,21 @@ module NdrUi
|
|
219
240
|
|
220
241
|
# Identical signature to form_for, but uses NdrUi::BootstrapBuilder.
|
221
242
|
# See ActionView::Helpers::FormHelper for details
|
222
|
-
def bootstrap_form_for(record_or_name_or_array, *args, &
|
243
|
+
def bootstrap_form_for(record_or_name_or_array, *args, &_proc)
|
223
244
|
options = args.extract_options!
|
224
245
|
options[:html] ||= {}
|
225
246
|
|
226
247
|
# :horizontal
|
227
|
-
|
228
|
-
# set the form html class for horizontal bootstrap forms
|
229
|
-
options[:html][:class] ||= ''
|
230
|
-
classes = (options[:html][:class].split(' ') << 'form-horizontal').uniq.join(' ')
|
231
|
-
options[:html][:class] = classes
|
232
|
-
end
|
248
|
+
horizontal = options.delete(:horizontal)
|
233
249
|
|
234
250
|
# stimuls controller, default `form_controller`
|
235
251
|
options[:html][:'data-controller'] ||= ''
|
236
|
-
controllers = (options[:html][:'data-controller'].split
|
252
|
+
controllers = (options[:html][:'data-controller'].split << 'form').uniq.join(' ')
|
237
253
|
options[:html][:'data-controller'] = controllers
|
238
254
|
|
239
255
|
# We switch autocomplete off by default
|
240
256
|
raise 'autocomplete should be defined an html option' if options[:autocomplete]
|
257
|
+
|
241
258
|
options[:html][:autocomplete] ||= 'off'
|
242
259
|
|
243
260
|
form_for(record_or_name_or_array, *(args << options.merge(builder: NdrUi::BootstrapBuilder))) do |form|
|
@@ -256,21 +273,14 @@ module NdrUi
|
|
256
273
|
options[:builder] = NdrUi::BootstrapBuilder
|
257
274
|
horizontal = options.delete(:horizontal)
|
258
275
|
|
259
|
-
# :horizontal
|
260
|
-
if horizontal
|
261
|
-
# set the form html class for horizontal bootstrap forms
|
262
|
-
options[:html][:class] ||= ''
|
263
|
-
classes = (options[:html][:class].split(' ') << 'form-horizontal').uniq.join(' ')
|
264
|
-
options[:html][:class] = classes
|
265
|
-
end
|
266
|
-
|
267
276
|
# stimuls controller, default `form_controller`
|
268
277
|
options[:html][:'data-controller'] ||= ''
|
269
|
-
controllers = (options[:html][:'data-controller'].split
|
278
|
+
controllers = (options[:html][:'data-controller'].split << 'form').uniq.join(' ')
|
270
279
|
options[:html][:'data-controller'] = controllers
|
271
280
|
|
272
281
|
# We switch autocomplete off by default
|
273
282
|
raise 'autocomplete should be defined an html option' if options[:autocomplete]
|
283
|
+
|
274
284
|
options[:html][:autocomplete] ||= 'off'
|
275
285
|
|
276
286
|
form_with(**options) do |form|
|
@@ -298,7 +308,7 @@ module NdrUi
|
|
298
308
|
# <%= button_control_group("Apples", class: "some_class") %>
|
299
309
|
# # =>
|
300
310
|
# <div class="form-group">
|
301
|
-
# <div class="col-sm-9
|
311
|
+
# <div class="col-sm-9 offset-sm-3">
|
302
312
|
# <div class="some_class">Apples</div>
|
303
313
|
# </div>
|
304
314
|
# </div>
|
@@ -331,7 +341,7 @@ module NdrUi
|
|
331
341
|
#
|
332
342
|
# <%= bootstrap_progressbar_tag(40), type: :danger %>
|
333
343
|
# # => <div class="progress progress-striped active" title="40%"><div
|
334
|
-
# class="progress-bar
|
344
|
+
# class="progress-bar bg-danger" style="width:40%"></div></div>
|
335
345
|
#
|
336
346
|
# ==== Browser compatibility
|
337
347
|
#
|
@@ -349,7 +359,7 @@ module NdrUi
|
|
349
359
|
classes << 'progress-striped'
|
350
360
|
|
351
361
|
type = options.delete('type').to_s
|
352
|
-
type = "
|
362
|
+
type = " bg-#{type}" if type.present?
|
353
363
|
|
354
364
|
# Animate the progress bar unless something has broken:
|
355
365
|
classes << 'active' unless type == 'danger'
|
@@ -372,22 +382,18 @@ module NdrUi
|
|
372
382
|
# bootstrap_horizontal_form_group("The Label", [3, 9]) { 'This is the content' }
|
373
383
|
# # =>
|
374
384
|
# <div class="form-group">
|
375
|
-
# <label class="col-sm-3
|
385
|
+
# <label class="col-sm-3 col-form-label">The Label</label>
|
376
386
|
# <div class="col-sm-9">This is the content</div>
|
377
387
|
# </div>
|
378
388
|
#
|
379
389
|
def bootstrap_horizontal_form_group(label = nil, ratio = [2, 10], &block)
|
380
|
-
label, ratio = nil, label if label.is_a?(Array)
|
381
|
-
|
382
390
|
l, r = ratio[0..1].map(&:to_i)
|
383
|
-
offset = label.nil? ? "
|
391
|
+
offset = label.nil? ? " offset-sm-#{l}" : ''
|
384
392
|
|
385
393
|
# Main content:
|
386
394
|
content = content_tag(:div, class: "col-sm-#{r}" + offset, &block)
|
387
395
|
# Prepend optional label:
|
388
|
-
unless label.nil?
|
389
|
-
content = content_tag(:label, label, class: "col-sm-#{l} control-label") + content
|
390
|
-
end
|
396
|
+
content = content_tag(:label, label, class: "col-sm-#{l} col-form-label") + content unless label.nil?
|
391
397
|
|
392
398
|
content_tag(:div, content, class: 'form-group')
|
393
399
|
end
|
@@ -454,12 +460,12 @@ module NdrUi
|
|
454
460
|
# ==== Examples
|
455
461
|
#
|
456
462
|
# <%= new_link('#') %>
|
457
|
-
# # => <a title="New" class="btn btn-primary btn-
|
463
|
+
# # => <a title="New" class="btn btn-primary btn-sm" href="#">
|
458
464
|
# <span class="glyphicon glyphicon-plus-sign"></span>
|
459
465
|
# </a>
|
460
466
|
#
|
461
467
|
# <%= new_link(Post.new) %>
|
462
|
-
# # => <a title="New" class="btn btn-primary btn-
|
468
|
+
# # => <a title="New" class="btn btn-primary btn-sm" href="/posts/new">
|
463
469
|
# <span class="glyphicon glyphicon-plus-sign"></span>
|
464
470
|
# </a>
|
465
471
|
#
|
@@ -469,7 +475,7 @@ module NdrUi
|
|
469
475
|
path = new_polymorphic_path(path) if can_generate_polymorphic_path?(path)
|
470
476
|
|
471
477
|
defaults = {
|
472
|
-
icon: 'plus-sign', title: 'New', path: path, class: 'btn btn-primary btn-
|
478
|
+
icon: 'plus-sign', title: 'New', path: path, class: 'btn btn-primary btn-sm'
|
473
479
|
}
|
474
480
|
|
475
481
|
link_to_with_icon(defaults.merge(options))
|
@@ -484,7 +490,7 @@ module NdrUi
|
|
484
490
|
# ==== Examples
|
485
491
|
#
|
486
492
|
# <%= details_link('#') %>
|
487
|
-
# # => <a title="Details" class="btn btn-default btn-
|
493
|
+
# # => <a title="Details" class="btn btn-default btn-sm" href="#">
|
488
494
|
# <span class="glyphicon glyphicon-share-alt"></span>
|
489
495
|
# </a>
|
490
496
|
#
|
@@ -503,7 +509,7 @@ module NdrUi
|
|
503
509
|
# ==== Examples
|
504
510
|
#
|
505
511
|
# <%= edit_link(#) %>
|
506
|
-
# # => <a title="Edit" class="btn btn-default btn-
|
512
|
+
# # => <a title="Edit" class="btn btn-default btn-sm" href="#">
|
507
513
|
# <span class="glyphicon glyphicon-pencil"></span>
|
508
514
|
# </a>
|
509
515
|
#
|
@@ -524,7 +530,7 @@ module NdrUi
|
|
524
530
|
# ==== Examples
|
525
531
|
#
|
526
532
|
# <%= delete_link('#') %>
|
527
|
-
# # => <a title="Delete" class="btn btn-
|
533
|
+
# # => <a title="Delete" class="btn btn-sm btn-outline-danger" rel="nofollow" href="#"
|
528
534
|
# data-method="delete" data-confirm="Are you sure?">
|
529
535
|
# <span class="glyphicon glyphicon-trash icon-white"></span>
|
530
536
|
# </a>'
|
@@ -533,8 +539,8 @@ module NdrUi
|
|
533
539
|
|
534
540
|
defaults = {
|
535
541
|
icon: 'trash icon-white', title: 'Delete', path: path,
|
536
|
-
class: 'btn btn-
|
537
|
-
'data-confirm': I18n.
|
542
|
+
class: 'btn btn-sm btn-outline-danger', method: :delete,
|
543
|
+
'data-confirm': I18n.t(:'ndr_ui.confirm_delete', locale: options[:locale])
|
538
544
|
}
|
539
545
|
|
540
546
|
link_to_with_icon(defaults.merge(options))
|
@@ -575,13 +581,13 @@ module NdrUi
|
|
575
581
|
# ==== Examples
|
576
582
|
#
|
577
583
|
# <%= link_to_with_icon( { icon: 'trash icon-white', title: 'Delete', path: '#' } ) %>
|
578
|
-
# # => <a title="Delete" class="btn btn-default btn-
|
584
|
+
# # => <a title="Delete" class="btn btn-default btn-sm" href="#">
|
579
585
|
# <span class="glyphicon glyphicon-trash icon-white"></span>
|
580
586
|
# </a>'
|
581
587
|
def link_to_with_icon(options = {})
|
582
|
-
options[:class] ||= 'btn btn-default btn-
|
588
|
+
options[:class] ||= 'btn btn-default btn-sm'
|
583
589
|
icon = bootstrap_icon_tag(options.delete(:icon))
|
584
|
-
content = options.delete(:text) ? icon
|
590
|
+
content = options.delete(:text) ? "#{icon} #{options[:title]}" : icon
|
585
591
|
link_to content, options.delete(:path), options
|
586
592
|
end
|
587
593
|
|
@@ -6,10 +6,7 @@ module NdrUi
|
|
6
6
|
options = options.symbolize_keys
|
7
7
|
css_classes += options[:class].split(' ') if options.include?(:class)
|
8
8
|
yield(css_classes) if block_given?
|
9
|
-
options[:class] = css_classes.join(' ') unless css_classes.empty?
|
10
|
-
unless css_classes == css_classes.uniq
|
11
|
-
fail "Multiple css class definitions: #{css_classes.inspect}"
|
12
|
-
end
|
9
|
+
options[:class] = css_classes.uniq.join(' ') unless css_classes.empty?
|
13
10
|
|
14
11
|
options
|
15
12
|
end
|
data/lib/ndr_ui/engine.rb
CHANGED
data/lib/ndr_ui/version.rb
CHANGED
metadata
CHANGED
@@ -1,49 +1,43 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ndr_ui
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 5.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- NDR Development Team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-
|
11
|
+
date: 2025-02-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: bootstrap
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '6.1'
|
20
|
-
- - "<"
|
17
|
+
- - "~>"
|
21
18
|
- !ruby/object:Gem::Version
|
22
|
-
version:
|
19
|
+
version: 5.3.3
|
23
20
|
type: :runtime
|
24
21
|
prerelease: false
|
25
22
|
version_requirements: !ruby/object:Gem::Requirement
|
26
23
|
requirements:
|
27
|
-
- - "
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
version: '6.1'
|
30
|
-
- - "<"
|
24
|
+
- - "~>"
|
31
25
|
- !ruby/object:Gem::Version
|
32
|
-
version:
|
26
|
+
version: 5.3.3
|
33
27
|
- !ruby/object:Gem::Dependency
|
34
|
-
name:
|
28
|
+
name: dartsass-sprockets
|
35
29
|
requirement: !ruby/object:Gem::Requirement
|
36
30
|
requirements:
|
37
|
-
- - "
|
31
|
+
- - ">="
|
38
32
|
- !ruby/object:Gem::Version
|
39
|
-
version:
|
33
|
+
version: '0'
|
40
34
|
type: :runtime
|
41
35
|
prerelease: false
|
42
36
|
version_requirements: !ruby/object:Gem::Requirement
|
43
37
|
requirements:
|
44
|
-
- - "
|
38
|
+
- - ">="
|
45
39
|
- !ruby/object:Gem::Version
|
46
|
-
version:
|
40
|
+
version: '0'
|
47
41
|
- !ruby/object:Gem::Dependency
|
48
42
|
name: jquery-rails
|
49
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -58,6 +52,26 @@ dependencies:
|
|
58
52
|
- - "~>"
|
59
53
|
- !ruby/object:Gem::Version
|
60
54
|
version: '4.6'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rails
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '6.1'
|
62
|
+
- - "<"
|
63
|
+
- !ruby/object:Gem::Version
|
64
|
+
version: '7.3'
|
65
|
+
type: :runtime
|
66
|
+
prerelease: false
|
67
|
+
version_requirements: !ruby/object:Gem::Requirement
|
68
|
+
requirements:
|
69
|
+
- - ">="
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
version: '6.1'
|
72
|
+
- - "<"
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: '7.3'
|
61
75
|
- !ruby/object:Gem::Dependency
|
62
76
|
name: sprockets
|
63
77
|
requirement: !ruby/object:Gem::Requirement
|
@@ -100,6 +114,20 @@ dependencies:
|
|
100
114
|
- - ">="
|
101
115
|
- !ruby/object:Gem::Version
|
102
116
|
version: '0'
|
117
|
+
- !ruby/object:Gem::Dependency
|
118
|
+
name: psych
|
119
|
+
requirement: !ruby/object:Gem::Requirement
|
120
|
+
requirements:
|
121
|
+
- - "<"
|
122
|
+
- !ruby/object:Gem::Version
|
123
|
+
version: '5'
|
124
|
+
type: :development
|
125
|
+
prerelease: false
|
126
|
+
version_requirements: !ruby/object:Gem::Requirement
|
127
|
+
requirements:
|
128
|
+
- - "<"
|
129
|
+
- !ruby/object:Gem::Version
|
130
|
+
version: '5'
|
103
131
|
- !ruby/object:Gem::Dependency
|
104
132
|
name: mocha
|
105
133
|
requirement: !ruby/object:Gem::Requirement
|
@@ -210,6 +238,8 @@ files:
|
|
210
238
|
- LICENSE.txt
|
211
239
|
- README.md
|
212
240
|
- Rakefile
|
241
|
+
- app/assets/fonts/bootstrap-icons.woff
|
242
|
+
- app/assets/fonts/bootstrap-icons.woff2
|
213
243
|
- app/assets/images/ndr_ui/indicator-danger.gif
|
214
244
|
- app/assets/images/ndr_ui/indicator-white.gif
|
215
245
|
- app/assets/images/ndr_ui/logo-partition.svg
|
@@ -218,6 +248,7 @@ files:
|
|
218
248
|
- app/assets/javascripts/ndr_ui/datepicker.js
|
219
249
|
- app/assets/javascripts/ndr_ui/index.js
|
220
250
|
- app/assets/javascripts/ndr_ui/timeago.js
|
251
|
+
- app/assets/stylesheets/ndr_ui/bootstrap-icons.scss
|
221
252
|
- app/assets/stylesheets/ndr_ui/datepicker.scss
|
222
253
|
- app/assets/stylesheets/ndr_ui/index.scss
|
223
254
|
- app/assets/stylesheets/ndr_ui/ndrs_styling.scss
|
@@ -229,11 +260,11 @@ files:
|
|
229
260
|
- app/builders/ndr_ui/bootstrap/label_tooltips.rb
|
230
261
|
- app/builders/ndr_ui/bootstrap/readonly.rb
|
231
262
|
- app/builders/ndr_ui/bootstrap_builder.rb
|
232
|
-
- app/helpers/ndr_ui/bootstrap/
|
263
|
+
- app/helpers/ndr_ui/bootstrap/accordion_helper.rb
|
233
264
|
- app/helpers/ndr_ui/bootstrap/breadcrumbs_helper.rb
|
265
|
+
- app/helpers/ndr_ui/bootstrap/card_helper.rb
|
234
266
|
- app/helpers/ndr_ui/bootstrap/dropdown_helper.rb
|
235
267
|
- app/helpers/ndr_ui/bootstrap/modal_helper.rb
|
236
|
-
- app/helpers/ndr_ui/bootstrap/panel_helper.rb
|
237
268
|
- app/helpers/ndr_ui/bootstrap_helper.rb
|
238
269
|
- app/helpers/ndr_ui/css_helper.rb
|
239
270
|
- app/helpers/ndr_ui/timeago_helper.rb
|