ndr_ui 4.1.2 → 5.0.0
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/CHANGELOG.md +7 -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 +5 -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 +68 -64
- 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 +50 -19
- 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, 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"><button type="button" class="close"
|
42
|
-
# data-dismiss="alert"
|
54
|
+
# # => <div class="alert alert-info"><button type="button" class="btn-close"
|
55
|
+
# data-bs-dismiss="alert"></button>Check it out!!</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 = button_tag('', type: 'button', class: 'btn-close', 'data-bs-dismiss': 'alert') + message
|
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,16 @@ module NdrUi
|
|
184
203
|
# ==== Examples
|
185
204
|
#
|
186
205
|
# <%= bootstrap_tab_nav_tag("Fruits", "#fruits", true) %>
|
187
|
-
# # => <li class="active"><a href="#fruits" data-toggle="tab">Fruits</a></li>
|
206
|
+
# # => <li class="active"><a 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,
|
209
|
+
link_to(title, linkto, 'data-bs-toggle': 'tab'),
|
191
210
|
active ? { class: 'active' } : {})
|
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') + name
|
197
216
|
bootstrap_list_link_to(html, path)
|
198
217
|
end
|
199
218
|
|
@@ -219,25 +238,21 @@ module NdrUi
|
|
219
238
|
|
220
239
|
# Identical signature to form_for, but uses NdrUi::BootstrapBuilder.
|
221
240
|
# See ActionView::Helpers::FormHelper for details
|
222
|
-
def bootstrap_form_for(record_or_name_or_array, *args, &
|
241
|
+
def bootstrap_form_for(record_or_name_or_array, *args, &_proc)
|
223
242
|
options = args.extract_options!
|
224
243
|
options[:html] ||= {}
|
225
244
|
|
226
245
|
# :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
|
246
|
+
horizontal = options.delete(:horizontal)
|
233
247
|
|
234
248
|
# stimuls controller, default `form_controller`
|
235
249
|
options[:html][:'data-controller'] ||= ''
|
236
|
-
controllers = (options[:html][:'data-controller'].split
|
250
|
+
controllers = (options[:html][:'data-controller'].split << 'form').uniq.join(' ')
|
237
251
|
options[:html][:'data-controller'] = controllers
|
238
252
|
|
239
253
|
# We switch autocomplete off by default
|
240
254
|
raise 'autocomplete should be defined an html option' if options[:autocomplete]
|
255
|
+
|
241
256
|
options[:html][:autocomplete] ||= 'off'
|
242
257
|
|
243
258
|
form_for(record_or_name_or_array, *(args << options.merge(builder: NdrUi::BootstrapBuilder))) do |form|
|
@@ -256,21 +271,14 @@ module NdrUi
|
|
256
271
|
options[:builder] = NdrUi::BootstrapBuilder
|
257
272
|
horizontal = options.delete(:horizontal)
|
258
273
|
|
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
274
|
# stimuls controller, default `form_controller`
|
268
275
|
options[:html][:'data-controller'] ||= ''
|
269
|
-
controllers = (options[:html][:'data-controller'].split
|
276
|
+
controllers = (options[:html][:'data-controller'].split << 'form').uniq.join(' ')
|
270
277
|
options[:html][:'data-controller'] = controllers
|
271
278
|
|
272
279
|
# We switch autocomplete off by default
|
273
280
|
raise 'autocomplete should be defined an html option' if options[:autocomplete]
|
281
|
+
|
274
282
|
options[:html][:autocomplete] ||= 'off'
|
275
283
|
|
276
284
|
form_with(**options) do |form|
|
@@ -331,7 +339,7 @@ module NdrUi
|
|
331
339
|
#
|
332
340
|
# <%= bootstrap_progressbar_tag(40), type: :danger %>
|
333
341
|
# # => <div class="progress progress-striped active" title="40%"><div
|
334
|
-
# class="progress-bar
|
342
|
+
# class="progress-bar bg-danger" style="width:40%"></div></div>
|
335
343
|
#
|
336
344
|
# ==== Browser compatibility
|
337
345
|
#
|
@@ -349,7 +357,7 @@ module NdrUi
|
|
349
357
|
classes << 'progress-striped'
|
350
358
|
|
351
359
|
type = options.delete('type').to_s
|
352
|
-
type = "
|
360
|
+
type = " bg-#{type}" if type.present?
|
353
361
|
|
354
362
|
# Animate the progress bar unless something has broken:
|
355
363
|
classes << 'active' unless type == 'danger'
|
@@ -372,22 +380,18 @@ module NdrUi
|
|
372
380
|
# bootstrap_horizontal_form_group("The Label", [3, 9]) { 'This is the content' }
|
373
381
|
# # =>
|
374
382
|
# <div class="form-group">
|
375
|
-
# <label class="col-sm-3
|
383
|
+
# <label class="col-sm-3 col-form-label">The Label</label>
|
376
384
|
# <div class="col-sm-9">This is the content</div>
|
377
385
|
# </div>
|
378
386
|
#
|
379
387
|
def bootstrap_horizontal_form_group(label = nil, ratio = [2, 10], &block)
|
380
|
-
label, ratio = nil, label if label.is_a?(Array)
|
381
|
-
|
382
388
|
l, r = ratio[0..1].map(&:to_i)
|
383
389
|
offset = label.nil? ? " col-sm-offset-#{l}" : ''
|
384
390
|
|
385
391
|
# Main content:
|
386
392
|
content = content_tag(:div, class: "col-sm-#{r}" + offset, &block)
|
387
393
|
# Prepend optional label:
|
388
|
-
unless label.nil?
|
389
|
-
content = content_tag(:label, label, class: "col-sm-#{l} control-label") + content
|
390
|
-
end
|
394
|
+
content = content_tag(:label, label, class: "col-sm-#{l} col-form-label") + content unless label.nil?
|
391
395
|
|
392
396
|
content_tag(:div, content, class: 'form-group')
|
393
397
|
end
|
@@ -454,12 +458,12 @@ module NdrUi
|
|
454
458
|
# ==== Examples
|
455
459
|
#
|
456
460
|
# <%= new_link('#') %>
|
457
|
-
# # => <a title="New" class="btn btn-primary btn-
|
461
|
+
# # => <a title="New" class="btn btn-primary btn-sm" href="#">
|
458
462
|
# <span class="glyphicon glyphicon-plus-sign"></span>
|
459
463
|
# </a>
|
460
464
|
#
|
461
465
|
# <%= new_link(Post.new) %>
|
462
|
-
# # => <a title="New" class="btn btn-primary btn-
|
466
|
+
# # => <a title="New" class="btn btn-primary btn-sm" href="/posts/new">
|
463
467
|
# <span class="glyphicon glyphicon-plus-sign"></span>
|
464
468
|
# </a>
|
465
469
|
#
|
@@ -469,7 +473,7 @@ module NdrUi
|
|
469
473
|
path = new_polymorphic_path(path) if can_generate_polymorphic_path?(path)
|
470
474
|
|
471
475
|
defaults = {
|
472
|
-
icon: 'plus-sign', title: 'New', path: path, class: 'btn btn-primary btn-
|
476
|
+
icon: 'plus-sign', title: 'New', path: path, class: 'btn btn-primary btn-sm'
|
473
477
|
}
|
474
478
|
|
475
479
|
link_to_with_icon(defaults.merge(options))
|
@@ -484,7 +488,7 @@ module NdrUi
|
|
484
488
|
# ==== Examples
|
485
489
|
#
|
486
490
|
# <%= details_link('#') %>
|
487
|
-
# # => <a title="Details" class="btn btn-default btn-
|
491
|
+
# # => <a title="Details" class="btn btn-default btn-sm" href="#">
|
488
492
|
# <span class="glyphicon glyphicon-share-alt"></span>
|
489
493
|
# </a>
|
490
494
|
#
|
@@ -503,7 +507,7 @@ module NdrUi
|
|
503
507
|
# ==== Examples
|
504
508
|
#
|
505
509
|
# <%= edit_link(#) %>
|
506
|
-
# # => <a title="Edit" class="btn btn-default btn-
|
510
|
+
# # => <a title="Edit" class="btn btn-default btn-sm" href="#">
|
507
511
|
# <span class="glyphicon glyphicon-pencil"></span>
|
508
512
|
# </a>
|
509
513
|
#
|
@@ -524,7 +528,7 @@ module NdrUi
|
|
524
528
|
# ==== Examples
|
525
529
|
#
|
526
530
|
# <%= delete_link('#') %>
|
527
|
-
# # => <a title="Delete" class="btn btn-
|
531
|
+
# # => <a title="Delete" class="btn btn-sm btn-outline-danger" rel="nofollow" href="#"
|
528
532
|
# data-method="delete" data-confirm="Are you sure?">
|
529
533
|
# <span class="glyphicon glyphicon-trash icon-white"></span>
|
530
534
|
# </a>'
|
@@ -533,8 +537,8 @@ module NdrUi
|
|
533
537
|
|
534
538
|
defaults = {
|
535
539
|
icon: 'trash icon-white', title: 'Delete', path: path,
|
536
|
-
class: 'btn btn-
|
537
|
-
'data-confirm': I18n.
|
540
|
+
class: 'btn btn-sm btn-outline-danger', method: :delete,
|
541
|
+
'data-confirm': I18n.t(:'ndr_ui.confirm_delete', locale: options[:locale])
|
538
542
|
}
|
539
543
|
|
540
544
|
link_to_with_icon(defaults.merge(options))
|
@@ -575,13 +579,13 @@ module NdrUi
|
|
575
579
|
# ==== Examples
|
576
580
|
#
|
577
581
|
# <%= link_to_with_icon( { icon: 'trash icon-white', title: 'Delete', path: '#' } ) %>
|
578
|
-
# # => <a title="Delete" class="btn btn-default btn-
|
582
|
+
# # => <a title="Delete" class="btn btn-default btn-sm" href="#">
|
579
583
|
# <span class="glyphicon glyphicon-trash icon-white"></span>
|
580
584
|
# </a>'
|
581
585
|
def link_to_with_icon(options = {})
|
582
|
-
options[:class] ||= 'btn btn-default btn-
|
586
|
+
options[:class] ||= 'btn btn-default btn-sm'
|
583
587
|
icon = bootstrap_icon_tag(options.delete(:icon))
|
584
|
-
content = options.delete(:text) ? icon
|
588
|
+
content = options.delete(:text) ? "#{icon} #{options[:title]}" : icon
|
585
589
|
link_to content, options.delete(:path), options
|
586
590
|
end
|
587
591
|
|
@@ -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,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ndr_ui
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 5.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- NDR Development Team
|
@@ -11,39 +11,33 @@ cert_chain: []
|
|
11
11
|
date: 2025-01-24 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
|
@@ -1,87 +0,0 @@
|
|
1
|
-
module NdrUi
|
2
|
-
module Bootstrap
|
3
|
-
# This provides accordion
|
4
|
-
module PanelHelper
|
5
|
-
PANEL_SUBCLASSES = %w(
|
6
|
-
panel-default
|
7
|
-
panel-primary
|
8
|
-
panel-success
|
9
|
-
panel-info
|
10
|
-
panel-warning
|
11
|
-
panel-danger
|
12
|
-
).freeze
|
13
|
-
|
14
|
-
# Creates an accordion wrapper and creates a new NdrUi::Bootstrap::Accordion instance
|
15
|
-
# Creates an plain or nested bootstrap accordion along with bootstrap_accordion_group
|
16
|
-
# method at NdrUi::Bootstrap::Accordion class.
|
17
|
-
#
|
18
|
-
# ==== Signatures
|
19
|
-
#
|
20
|
-
# bootstrap_accordion_tag(dom_id) do |accordion|
|
21
|
-
# #content for accordion items
|
22
|
-
# end
|
23
|
-
#
|
24
|
-
# ==== Examples
|
25
|
-
#
|
26
|
-
# <%= bootstrap_accordion_group :fruit do |fruit_accordion| %>
|
27
|
-
# <% end %>
|
28
|
-
# # => <div id="fruit" class="accordion"></div>
|
29
|
-
def bootstrap_accordion_tag(dom_id, &block)
|
30
|
-
return unless block_given?
|
31
|
-
accordion = ::NdrUi::Bootstrap::Accordion.new(dom_id, self)
|
32
|
-
'<div id="'.html_safe + accordion.dom_id.to_s + '" class="panel-group">'.html_safe +
|
33
|
-
capture { yield(accordion) } +
|
34
|
-
'</div>'.html_safe
|
35
|
-
end
|
36
|
-
|
37
|
-
# Creates a bootstrap panel wrapper. the heading is wrapped in a panel-heading.
|
38
|
-
# The content is not wrapped in a panel-body to enable seamless tables and lists.
|
39
|
-
#
|
40
|
-
# ==== Signatures
|
41
|
-
#
|
42
|
-
# bootstrap_panel_tag(heading, options = {}) do
|
43
|
-
# #content for panel
|
44
|
-
# end
|
45
|
-
#
|
46
|
-
# ==== Examples
|
47
|
-
#
|
48
|
-
# <%= bootstrap_panel_tag 'Apples', class: 'panel-warning', id: 'fruit' do %>
|
49
|
-
# Check it out!!
|
50
|
-
# <% end %>
|
51
|
-
# # => <div id="fruit" class="panel panel-warning"><div class="panel-heading">Apples</div>
|
52
|
-
# Check it out!!</div>
|
53
|
-
def bootstrap_panel_tag(heading, options = {}, &block)
|
54
|
-
return unless block_given?
|
55
|
-
options.stringify_keys!
|
56
|
-
classes = %w(panel)
|
57
|
-
classes += options['class'].to_s.split(' ') if options.include?('class')
|
58
|
-
classes << 'panel-default' if (classes & PANEL_SUBCLASSES).empty?
|
59
|
-
options['class'] = classes.uniq.join(' ')
|
60
|
-
|
61
|
-
content_tag(:div,
|
62
|
-
content_tag(:div, heading, class: 'panel-heading') +
|
63
|
-
capture(&block),
|
64
|
-
options)
|
65
|
-
end
|
66
|
-
|
67
|
-
# Creates a simple bootstrap panel body.
|
68
|
-
#
|
69
|
-
# ==== Signatures
|
70
|
-
#
|
71
|
-
# bootstrap_panel_body_tag do
|
72
|
-
# #content for panel body
|
73
|
-
# end
|
74
|
-
#
|
75
|
-
# ==== Examples
|
76
|
-
#
|
77
|
-
# <%= bootstrap_panel_body_tag do %>
|
78
|
-
# Check it out!!
|
79
|
-
# <% end %>
|
80
|
-
# # => <div class="panel-body">Check it out!!</div>
|
81
|
-
def bootstrap_panel_body_tag(&block)
|
82
|
-
return unless block_given?
|
83
|
-
content_tag(:div, capture(&block), class: 'panel-body')
|
84
|
-
end
|
85
|
-
end
|
86
|
-
end
|
87
|
-
end
|