effective_bootstrap 0.9.34 → 0.9.38
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b22f36af611b8928951e32da7674994739220cf189d8b1486359e58507a66bff
|
4
|
+
data.tar.gz: 884b64100e7d832a0ba995f6b0e14b1ac12e147e560b0a583cb40ea52dd57f69
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4ffe5bbd7785815688f74a8e0c3304438dff1d12f3213c20220e664f40c0d4f71fc37e06f09de4beb15994cc63ff2dd766c79a666b58353ce52b4919f57f7c2e
|
7
|
+
data.tar.gz: 28330b3adfa44c418270d85ace2339960d2664eb5d44fa56158a0ff23aea940648567a3422b7a6f81d5466a13bcab6a2549580bfc1ad53dd24135b4e9633a963
|
@@ -10,7 +10,7 @@ module EffectiveBootstrapHelper
|
|
10
10
|
def accordion(options = nil, &block)
|
11
11
|
(options ||= {})[:class] = "accordion #{options.delete(:class)}".strip
|
12
12
|
|
13
|
-
id = "accordion-#{
|
13
|
+
id = "accordion-#{effective_bootstrap_unique_id}"
|
14
14
|
|
15
15
|
@_accordion_active = id
|
16
16
|
content = content_tag(:div, capture(&block), options.merge(id: id))
|
@@ -62,7 +62,7 @@ module EffectiveBootstrapHelper
|
|
62
62
|
def collapse(label, opts = {}, &block)
|
63
63
|
raise 'expected a block' unless block_given?
|
64
64
|
|
65
|
-
id = "collapse-#{
|
65
|
+
id = "collapse-#{effective_bootstrap_unique_id}"
|
66
66
|
show = (opts.delete(:show) == true)
|
67
67
|
|
68
68
|
link_opts = { 'data-toggle': 'collapse', role: 'button', href: "##{id}", 'aria-controls': "##{id}", 'aria-expanded': show }
|
@@ -259,7 +259,7 @@ module EffectiveBootstrapHelper
|
|
259
259
|
def nav_dropdown(label, right: false, link_class: [], list_class: [], &block)
|
260
260
|
raise 'expected a block' unless block_given?
|
261
261
|
|
262
|
-
id = "dropdown-#{
|
262
|
+
id = "dropdown-#{effective_bootstrap_unique_id}"
|
263
263
|
|
264
264
|
content_tag(:li, class: 'nav-item dropdown') do
|
265
265
|
content_tag(:a, class: 'nav-link dropdown-toggle', href: '#', id: id, role: 'button', 'data-toggle': 'dropdown', 'aria-haspopup': true, 'aria-expanded': false) do
|
@@ -274,6 +274,52 @@ module EffectiveBootstrapHelper
|
|
274
274
|
content_tag(:div, '', class: 'dropdown-divider')
|
275
275
|
end
|
276
276
|
|
277
|
+
# Breadcrumb
|
278
|
+
#
|
279
|
+
# https://getbootstrap.com/docs/4.0/components/breadcrumb/
|
280
|
+
# Builds a breadcrumb based on the controller namespace, action and @page_title instance variable
|
281
|
+
#
|
282
|
+
def bootstrap_breadcrumb(root_title: nil, root_path: nil, index_title: nil, index_path: nil, page_title: nil)
|
283
|
+
effective_resource = (@_effective_resource || Effective::Resource.new(controller_path))
|
284
|
+
resource = instance_variable_get('@' + effective_resource.name) if effective_resource.name
|
285
|
+
|
286
|
+
root_title ||= 'Home'
|
287
|
+
root_path ||= '/'
|
288
|
+
|
289
|
+
index_title ||= controller.class.name.split('::').last.sub('Controller', '').titleize
|
290
|
+
index_path ||= effective_resource.action_path(:index) || request.path.split('/')[0...-1].join('/')
|
291
|
+
|
292
|
+
page_title ||= (@page_title || resource&.to_s || controller.action_name.titleize)
|
293
|
+
|
294
|
+
# Build items
|
295
|
+
# An array of arrays [[title, url]]
|
296
|
+
items = []
|
297
|
+
|
298
|
+
# Namespaces
|
299
|
+
Array(effective_resource.namespace).each do |namespace|
|
300
|
+
items << [namespace.titleize, '/' + namespace]
|
301
|
+
end
|
302
|
+
|
303
|
+
# Home
|
304
|
+
items << [root_title, '/'] unless items.present?
|
305
|
+
|
306
|
+
# Controller index action
|
307
|
+
items << [index_title, index_path] unless controller.action_name == 'index'
|
308
|
+
|
309
|
+
# Always
|
310
|
+
items << [page_title, nil]
|
311
|
+
|
312
|
+
# Now take items and turn them into breadcrumbs
|
313
|
+
content_tag(:ol, class: 'breadcrumb') do
|
314
|
+
(items[0...-1].map do |title, path|
|
315
|
+
content_tag(:li, link_to(title, path, title: title), class: 'breadcrumb-item')
|
316
|
+
end + items[-1..-1].map do |title, path|
|
317
|
+
content_tag(:li, title, class: 'breadcrumb-item active', 'aria-current': 'page')
|
318
|
+
end).join.html_safe
|
319
|
+
end
|
320
|
+
end
|
321
|
+
|
322
|
+
|
277
323
|
# Pagination
|
278
324
|
#
|
279
325
|
# https://getbootstrap.com/docs/4.0/components/pagination/
|
@@ -390,7 +436,7 @@ module EffectiveBootstrapHelper
|
|
390
436
|
|
391
437
|
@_tab_mode = :tablist
|
392
438
|
@_tab_active = (active || :first)
|
393
|
-
@_tab_unique =
|
439
|
+
@_tab_unique = effective_bootstrap_unique_id if unique
|
394
440
|
|
395
441
|
content_tag(:ul, {class: 'nav nav-tabs', role: 'tablist'}.merge(list)) do
|
396
442
|
yield # Yield to tab the first time
|
@@ -430,7 +476,7 @@ module EffectiveBootstrapHelper
|
|
430
476
|
|
431
477
|
@_tab_mode = :tablist_vertical
|
432
478
|
@_tab_active = (active || :first)
|
433
|
-
@_tab_unique =
|
479
|
+
@_tab_unique = effective_bootstrap_unique_id if unique
|
434
480
|
|
435
481
|
content_tag(:div, class: 'row border') do
|
436
482
|
content_tag(:div, class: 'col-3 border-right') do
|
@@ -458,4 +504,15 @@ module EffectiveBootstrapHelper
|
|
458
504
|
end
|
459
505
|
end
|
460
506
|
|
507
|
+
def effective_bootstrap_unique_id
|
508
|
+
# Set the first unique value
|
509
|
+
@_effective_bootstrap_unique_id ||= Time.zone.now.to_i
|
510
|
+
|
511
|
+
# Everytime we access this function make a new one
|
512
|
+
@_effective_bootstrap_unique_id = @_effective_bootstrap_unique_id + 1
|
513
|
+
|
514
|
+
# Return the updated value
|
515
|
+
@_effective_bootstrap_unique_id
|
516
|
+
end
|
517
|
+
|
461
518
|
end
|
@@ -6,9 +6,9 @@ module Effective
|
|
6
6
|
def self.defaults
|
7
7
|
{
|
8
8
|
active_storage: nil,
|
9
|
-
css: '/assets/article_editor/',
|
9
|
+
css: ['/assets/article_editor/arx-frame.min.css'],
|
10
10
|
custom: {
|
11
|
-
css: ['/assets/
|
11
|
+
css: ['/assets/effective_bootstrap_article_editor.css']
|
12
12
|
},
|
13
13
|
classes: {
|
14
14
|
body: 'article-editor-body',
|
@@ -40,7 +40,7 @@ module Effective
|
|
40
40
|
'12': 'col-sm-12'
|
41
41
|
}
|
42
42
|
},
|
43
|
-
plugins: ['blockcode', 'cellcolor', 'imageposition', 'imageresize', 'inlineformat', 'removeformat', 'reorder', 'style'],
|
43
|
+
plugins: ['blockcode', 'cellcolor', 'imageposition', 'imageresize', 'inlineformat', 'listitem', 'removeformat', 'reorder', 'style'],
|
44
44
|
quote: {
|
45
45
|
template: '<blockquote><p></p></blockquote>'
|
46
46
|
},
|
@@ -75,7 +75,15 @@ module Effective
|
|
75
75
|
end
|
76
76
|
|
77
77
|
def input_js_options
|
78
|
-
self.class.defaults.merge(active_storage: active_storage)
|
78
|
+
self.class.defaults.merge(active_storage: active_storage, custom: { css: custom_css })
|
79
|
+
end
|
80
|
+
|
81
|
+
def custom_css
|
82
|
+
[
|
83
|
+
(@template.asset_pack_path('application.css') if @template.respond_to?(:asset_pack_path)),
|
84
|
+
(@template.asset_path('application.css') if @template.respond_to?(:asset_path)),
|
85
|
+
('/assets/effective_bootstrap_article_editor.css')
|
86
|
+
]
|
79
87
|
end
|
80
88
|
|
81
89
|
def active_storage
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: effective_bootstrap
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.38
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Code and Effect
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-07-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|