effective_bootstrap 0.9.34 → 0.9.35
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/helpers/effective_bootstrap_helper.rb +46 -0
- data/lib/effective_bootstrap/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 724c9c09be1863a089556b42c8569d61c0dc8c5a94efde7406bad1c2835fe359
|
4
|
+
data.tar.gz: 8deca06ebd23e4ac4c572c82caf861847f8932c169e6f32ebe2c052f4634cc40
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3b7b872f2f83381421e3511b2b6401ccc672c68a8e550760e0e093002ec691f709f8ff39d936909ad9013125d8924bffe739309b6f30431488195d78600d7b1e
|
7
|
+
data.tar.gz: 2ed3d029a6f61ba2100df032d078c9d93e51a062d9d97acc8aefea7ed951f5947749d9c875f580efde85eadc1e15b3c2795683f7f7b7decea5b4070bd84d0ac7
|
@@ -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/
|
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.35
|
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-06-
|
11
|
+
date: 2021-06-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|