effective_bootstrap 0.9.34 → 0.9.35

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 58f7d739c4c9d00ead21293bee0bcceefbca0b57e8ac958bec112f5aadeee535
4
- data.tar.gz: 9a069cd5fefdce47db3f69095fef7e0f8eed3829036c264bf1ee3c3b36f36f51
3
+ metadata.gz: 724c9c09be1863a089556b42c8569d61c0dc8c5a94efde7406bad1c2835fe359
4
+ data.tar.gz: 8deca06ebd23e4ac4c572c82caf861847f8932c169e6f32ebe2c052f4634cc40
5
5
  SHA512:
6
- metadata.gz: 513dcea0768e7af3828d1742d0929e021b02ce7041ebbd5e24208a7a452f109ad62a8367bed9f851b01b43f5cc82d102bc6d7c680036333ee94eb9fbda743d66
7
- data.tar.gz: 82c31a8d062c6070bdc6d146150f169757be27979a4d429218af739f7d45cba797a22e0e5ed11263eb3b920a02c68476e9269cbc80e50950fcba7363bbaac913
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/
@@ -1,3 +1,3 @@
1
1
  module EffectiveBootstrap
2
- VERSION = '0.9.34'.freeze
2
+ VERSION = '0.9.35'.freeze
3
3
  end
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.34
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-21 00:00:00.000000000 Z
11
+ date: 2021-06-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails