breadcrumb_helper 0.2.0 → 0.2.1
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2fa9a30f0ec3eedc95d916111dbf872419688b19daec79e173c49cee43371d6e
|
4
|
+
data.tar.gz: eedc22821b27bfc109d2befb5b2acab44d1a50d17278a39792319ad57e5a0557
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e7267778e1dcd2cb4b180ef960e9cd9a42cdfdbb1277ab9e9d4055bd9e2a0fb88d6ff60f05ca70b5cad81d434646fe3c9147d411481c45156d30cf30f1d4ce2c
|
7
|
+
data.tar.gz: 47a75adb804d962359342b4e034e45b1b9cce8ee7c7926933b9d73f1d22329927b18cc97cd103783177effbc2874f8b8a4dacd69ded869de40c423140d2db203
|
@@ -17,27 +17,14 @@ module BreadcrumbHelper
|
|
17
17
|
# Render the items to view as a string and html_safe on.
|
18
18
|
# Expected to find the partial in various locations thanks to Rails rendering.
|
19
19
|
def render_breadcrumb_items
|
20
|
-
|
20
|
+
begin
|
21
|
+
try("#{action_name}_breadcrumbs")
|
22
|
+
rescue NoMethodError
|
23
|
+
Rails.logger.warn("An error occurred in #{action_name}_breadcrumbs in #{controller_namespace}.")
|
24
|
+
end
|
21
25
|
render('breadcrumb_items', items: breadcrumb_items)
|
22
26
|
end
|
23
27
|
|
24
|
-
# Tries to render the item name.
|
25
|
-
# This is a dynamic value, hence this method exists so that it can become the interface for displaying item names
|
26
|
-
# with the benefit of added guard clauses.
|
27
|
-
# It is recommended to use this in the view files.
|
28
|
-
def render_breadcrumb_item_name(item)
|
29
|
-
item[:name].to_s
|
30
|
-
rescue NoMethodError
|
31
|
-
nil
|
32
|
-
end
|
33
|
-
|
34
|
-
# Tries to render the item path.
|
35
|
-
# It does nothing special, but support for it is added just in case there are updates.
|
36
|
-
# It is still more recommended to use this in the view files.
|
37
|
-
def render_breadcrumb_item_path(item)
|
38
|
-
item[:path]
|
39
|
-
end
|
40
|
-
|
41
28
|
private
|
42
29
|
|
43
30
|
# Absolute source of truth for breadcrumb items, only modifiable through add_breadcrumb method.
|
@@ -1,15 +1,11 @@
|
|
1
1
|
<% items.each do |item| %>
|
2
|
-
<%
|
3
|
-
<% break unless item_name %>
|
4
|
-
|
5
|
-
<% item_path = render_breadcrumb_item_path(item) %>
|
6
|
-
<% if item_path %>
|
2
|
+
<% if item[:path] %>
|
7
3
|
<li class="breadcrumb-item">
|
8
|
-
<a href="<%=
|
4
|
+
<a href="<%= item[:path] %>"><%= item[:name] %></a>
|
9
5
|
</li>
|
10
6
|
<% else %>
|
11
7
|
<li class="breadcrumb-item active" aria-current="page">
|
12
|
-
<%=
|
8
|
+
<%= item[:name] %>
|
13
9
|
</li>
|
14
10
|
<% end %>
|
15
11
|
<% end %>
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: breadcrumb_helper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tien
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-02-
|
11
|
+
date: 2025-02-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -24,7 +24,7 @@ dependencies:
|
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '7'
|
27
|
-
description:
|
27
|
+
description:
|
28
28
|
email:
|
29
29
|
- tieeeeen1994@gmail.com
|
30
30
|
executables: []
|
@@ -50,7 +50,7 @@ licenses:
|
|
50
50
|
metadata:
|
51
51
|
homepage_uri: https://github.com/tieeeeen1994/rails-breadcrumb-helpers
|
52
52
|
rubygems_mfa_required: 'true'
|
53
|
-
post_install_message:
|
53
|
+
post_install_message:
|
54
54
|
rdoc_options: []
|
55
55
|
require_paths:
|
56
56
|
- lib
|
@@ -65,8 +65,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
65
65
|
- !ruby/object:Gem::Version
|
66
66
|
version: '0'
|
67
67
|
requirements: []
|
68
|
-
rubygems_version: 3.
|
69
|
-
signing_key:
|
68
|
+
rubygems_version: 3.5.23
|
69
|
+
signing_key:
|
70
70
|
specification_version: 4
|
71
71
|
summary: Provides easy helper methods to generate breadcrumbs in Rails views.
|
72
72
|
test_files: []
|