gretel 4.4.0 → 4.5.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e903af36913aacbf98679ae5452d7269b9eba6abf5b2d75ff6a60277c2d64ad1
4
- data.tar.gz: 56bcc5194372d75c357fcde07a542ffcd7440fa3ade06738124573d29d3cbf7b
3
+ metadata.gz: e11382c45e0cd902386dec63fccbfedbbfd7658bc03e2d22a70c8bc88b317431
4
+ data.tar.gz: fd662355346c8e056a71b8b4abc8d83b325b452ae2436339a15307a3355dffd9
5
5
  SHA512:
6
- metadata.gz: e20387223c47146510f79c77f3680ad3f76c8d703a455c7991fd68ec68d5011f79427fe39d56ccd8e0b8e942522632fc1cb448b12e02d6910214b8fe27eb65de
7
- data.tar.gz: 9612998182b479f2e9f023e64ba8527897a8058a1c59268cb86583f3647b818be978e0c91b4f9740abbbd749c02ee03159fd4b8826377e03e6aef578375e9da3
6
+ metadata.gz: 141851ca991537082c0efaa5a7ca487d5a76ee46515f884cf4ced76cdf16df23c65c9472c2926c4962b68ab4f8cdb54ab720d43c51309b49bee19438ebbeffab
7
+ data.tar.gz: 74ad6b5a791c45b1c895f12bea6cb39e761775a99e7ff469ca98297f8ebada132484f6c40db2162cfa32a4f0f9c2defc294b1a516669b4c63b3072a187c4dbd2
@@ -11,39 +11,44 @@ jobs:
11
11
  runs-on: ubuntu-latest
12
12
  strategy:
13
13
  matrix:
14
- rails_version: [5.1.0, 5.2.0, 6.0.0, 6.1.0, master]
15
- ruby_version: [3.0, 2.7, 2.6, 2.5]
14
+ rails_version: [5.1.0, 5.2.0, 6.0.0, 6.1.0, 7.0.0, master]
15
+ ruby_version: ['3.2', '3.1', '3.0', '2.7', '2.6']
16
16
  exclude:
17
- - ruby_version: 2.5
18
- rails_version: master
19
- - ruby_version: 2.6
20
- rails_version: master
21
- - ruby_version: 3.0
22
- rails_version: 5.1.0
23
- - ruby_version: 3.0
24
- rails_version: 5.2.0
17
+ - { ruby_version: '2.6', rails_version: 7.0.0 }
18
+ - { ruby_version: '2.6', rails_version: master }
19
+ - { ruby_version: '3.0', rails_version: 5.1.0 }
20
+ - { ruby_version: '3.0', rails_version: 5.2.0 }
21
+ - { ruby_version: '3.1', rails_version: 5.1.0 }
22
+ - { ruby_version: '3.1', rails_version: 5.2.0 }
23
+ - { ruby_version: '3.1', rails_version: 6.0.0 }
24
+ - { ruby_version: '3.1', rails_version: 6.1.0 }
25
+ - { ruby_version: '3.2', rails_version: 5.1.0 }
26
+ - { ruby_version: '3.2', rails_version: 5.2.0 }
27
+ - { ruby_version: '3.2', rails_version: 6.0.0 }
28
+ - { ruby_version: '3.2', rails_version: 6.1.0 }
25
29
 
26
30
  steps:
27
- - uses: actions/checkout@v2
31
+ - uses: actions/checkout@v3
28
32
 
29
33
  - name: Setup Ruby
30
34
  uses: ruby/setup-ruby@v1
31
35
  with:
32
- ruby-version: ${{ matrix.ruby_version }}
36
+ ruby-version: "${{ matrix.ruby_version }}"
33
37
 
34
38
  - name: Run test
35
39
  env:
36
- RAILS_VERSION: ${{ matrix.rails_version }}
40
+ RAILS_VERSION: "${{ matrix.rails_version }}"
37
41
  run: |
42
+ gem update --system
38
43
  bundle update
39
44
  cd spec/dummy; rake db:migrate db:test:prepare; cd ../..
40
45
  bundle exec rake
41
46
 
42
47
  - name: Upload coverage
43
- uses: actions/upload-artifact@v2
48
+ uses: actions/upload-artifact@v3
44
49
  if: always()
45
50
  with:
46
- name: coverage-ruby-${{ matrix.ruby_version }}-rails-${{ matrix.rails_version }}
51
+ name: "coverage-ruby-${{ matrix.ruby_version }}-rails-${{ matrix.rails_version }}"
47
52
  path: coverage
48
53
 
49
54
  - name: Show coverage
data/CHANGELOG.md CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## Version 4.5.0
6
+ * Use `link` element for link item in semantic markup instead of `meta` element (via #36, thanks @tkawa)
7
+ * Use `link_data` to set data attributes for link item (via #38, thanks @SpaYco)
8
+
5
9
  ## Version 4.4.0
6
10
  * Support Bootstrap 5. See the `:style` option in the readme for more info (via #30, thanks @tochi)
7
11
  * Support Rails 7.0
data/README.md CHANGED
@@ -1,5 +1,5 @@
1
1
  [![Gem Version](https://badge.fury.io/rb/gretel.svg)](http://badge.fury.io/rb/gretel)
2
- ![](https://github.com/kzkn/gretel/workflows/CI/badge.svg)
2
+ [![](https://github.com/kzkn/gretel/workflows/CI/badge.svg)](https://github.com/kzkn/gretel/actions/workflows/ci.yml)
3
3
 
4
4
  <img src="http://i.imgur.com/CAKEaBM.png" alt="Handle breadcrumb trails... like a boss :)" />
5
5
 
@@ -100,6 +100,7 @@ Option | Description
100
100
  :container_tag | Tag type that contains the breadcrumbs. | `:div`
101
101
  :fragment_tag | Tag type to contain each breadcrumb fragment/link. | None
102
102
  :aria_current | Value of `aria-current` attribute. | None
103
+ :link_data | Adds data attributes to breadcrumb | `nil`
103
104
 
104
105
  ### Styles
105
106
 
@@ -19,7 +19,8 @@ module Gretel
19
19
  posttext_class: "posttext",
20
20
  link_class: nil,
21
21
  id: nil,
22
- aria_current: nil
22
+ aria_current: nil,
23
+ link_data: nil
23
24
  }
24
25
 
25
26
  DEFAULT_STYLES = {
@@ -87,7 +88,7 @@ module Gretel
87
88
  end
88
89
 
89
90
  # Set current link to actual path
90
- if options[:link_current_to_request_path] && out.any? && request
91
+ if options[:link_current_to_request_path] && out.any? && request&.fullpath.present?
91
92
  out.last.url = request.fullpath
92
93
  end
93
94
 
@@ -265,7 +266,7 @@ module Gretel
265
266
  end
266
267
 
267
268
  def fragment_options
268
- options.slice(:fragment_class, :link_class)
269
+ options.slice(:fragment_class, :link_class, :link_data)
269
270
  end
270
271
 
271
272
  def join_classes(*classes)
@@ -290,13 +291,13 @@ module Gretel
290
291
 
291
292
  if fragment_tag
292
293
  if url.present?
293
- text = breadcrumb_link_to(text, url, "aria-current": options[:aria_current])
294
+ text = breadcrumb_link_to(text, url, "aria-current": options[:aria_current], data: options[:link_data])
294
295
  content_tag(fragment_tag, text, class: fragment_class)
295
296
  else
296
- content_tag(fragment_tag, text, class: fragment_class, "aria-current": options[:aria_current])
297
+ content_tag(fragment_tag, text, class: fragment_class, "aria-current": options[:aria_current], data: options[:link_data])
297
298
  end
298
299
  elsif url.present?
299
- breadcrumb_link_to(text, url, class: join_classes(fragment_class, options[:link_class]), "aria-current": options[:aria_current])
300
+ breadcrumb_link_to(text, url, class: join_classes(fragment_class, options[:link_class]), "aria-current": options[:aria_current], data: options[:link_data])
300
301
  elsif options[:class].present?
301
302
  content_tag(:span, text, class: fragment_class, "aria-current": options[:aria_current])
302
303
  else
@@ -317,15 +318,14 @@ module Gretel
317
318
 
318
319
  aria_current = options[:aria_current]
319
320
  if url.present?
320
- text = breadcrumb_link_to(text, url, itemprop: "item", "aria-current": aria_current, class: options[:link_class])
321
+ text = breadcrumb_link_to(text, url, itemprop: "item", "aria-current": aria_current, class: options[:link_class], data: options[:link_data])
321
322
  aria_current = nil
322
323
  elsif options[:current_link].present?
323
- current_url = "#{root_url}#{options[:current_link].gsub(/^\//, '')}"
324
- text = text + tag(:meta, itemprop: "item", content: current_url)
324
+ text = text + tag(:link, itemprop: "item", href: options[:current_link])
325
325
  end
326
326
 
327
- text = text + tag(:meta, itemprop:"position", content: "#{position}")
328
- content_tag(fragment_tag.to_sym, text, class: fragment_class, itemprop: "itemListElement", itemscope: "", itemtype: "https://schema.org/ListItem", "aria-current": aria_current)
327
+ text = text + tag(:meta, itemprop: "position", content: "#{position}")
328
+ content_tag(fragment_tag.to_sym, text, class: fragment_class, itemprop: "itemListElement", itemscope: "", itemtype: "https://schema.org/ListItem", "aria-current": aria_current, data: options[:link_data])
329
329
  end
330
330
 
331
331
  def render_container(html)
@@ -1,3 +1,3 @@
1
1
  module Gretel
2
- VERSION = "4.4.0"
2
+ VERSION = "4.5.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gretel
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.4.0
4
+ version: 4.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lasse Bunk
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2021-12-16 00:00:00.000000000 Z
12
+ date: 2023-05-01 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: railties
@@ -156,7 +156,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
156
156
  - !ruby/object:Gem::Version
157
157
  version: '0'
158
158
  requirements: []
159
- rubygems_version: 3.2.15
159
+ rubygems_version: 3.4.6
160
160
  signing_key:
161
161
  specification_version: 4
162
162
  summary: Flexible Ruby on Rails breadcrumbs plugin.