smart_navigation 0.1.1 → 0.1.2
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 +4 -4
- data/README.md +2 -1
- data/lib/smart_navigation/renderer.rb +11 -2
- data/lib/smart_navigation/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2f1a3527ad5902208d2e5c0e2cd50812011c1f1d
|
4
|
+
data.tar.gz: d37bc43de96cf264600d03ce06ab94122eea0966
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 53129e06fb2130c77f0ebe85d334de74a593b42b6c701eda7562e8148e3b4ff9e06d345186337b58fb7ff71885e4b741353baaa9dfff0003af17d16e3dbc0bd1
|
7
|
+
data.tar.gz: de9fd18096ba9895a97cf5493ea1bc5329044429578e17905efbd09106480816c8b8f9460d99215385eff5ec4b06cbc8d6be2463bcd91aed0d38bfae6dbbc697
|
data/README.md
CHANGED
@@ -38,7 +38,11 @@ module SmartNavigation
|
|
38
38
|
|
39
39
|
# Get menu item url
|
40
40
|
def item_url(item)
|
41
|
-
item[:url].present?
|
41
|
+
if item[:url].present?
|
42
|
+
mixed_value(item[:url])
|
43
|
+
elsif item[:id].present?
|
44
|
+
"##{item[:id]}"
|
45
|
+
end
|
42
46
|
end
|
43
47
|
|
44
48
|
# Check if should render item
|
@@ -97,8 +101,13 @@ module SmartNavigation
|
|
97
101
|
label = tag :span, item[:label]
|
98
102
|
label = icon_tag("#{item[:icon]}", label) if icons.present?
|
99
103
|
label = label + toggle_tag if item[:children].present?
|
104
|
+
url = item_url(item)
|
100
105
|
|
101
|
-
|
106
|
+
if url.nil?
|
107
|
+
tag :a, label.html_safe, Hash(item[:html])
|
108
|
+
else
|
109
|
+
@context.link_to label.html_safe, url, Hash(item[:html])
|
110
|
+
end
|
102
111
|
end
|
103
112
|
|
104
113
|
# Create submenu item
|