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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 032655f9ab35419c26f5b36b2ebb58bc044cee25
4
- data.tar.gz: 54e5513ff6c6954ce05e6e25bdd205279b421a40
3
+ metadata.gz: 2f1a3527ad5902208d2e5c0e2cd50812011c1f1d
4
+ data.tar.gz: d37bc43de96cf264600d03ce06ab94122eea0966
5
5
  SHA512:
6
- metadata.gz: 2413436e93175f1ca0eb2771740962d755a5f50d6775db282176b01fa6eced57d5a1aa8e6eee7504ba9b562f0847e852c0cc2b964d13463b9610e627b5c920b9
7
- data.tar.gz: b23f3b1a58cd012667d80f1835fba875fd06f6e4bc43680c0a2c532989d1b3fd7cfdf2cd003fc91856481fec869698a6c10e53532748f981df84989c0d73c5bd
6
+ metadata.gz: 53129e06fb2130c77f0ebe85d334de74a593b42b6c701eda7562e8148e3b4ff9e06d345186337b58fb7ff71885e4b741353baaa9dfff0003af17d16e3dbc0bd1
7
+ data.tar.gz: de9fd18096ba9895a97cf5493ea1bc5329044429578e17905efbd09106480816c8b8f9460d99215385eff5ec4b06cbc8d6be2463bcd91aed0d38bfae6dbbc697
data/README.md CHANGED
@@ -31,7 +31,8 @@ Define the menu items in a hash:
31
31
  dashboard: {
32
32
  label: 'Dashboard',
33
33
  url: :root_path,
34
- icon: 'dashboard'
34
+ icon: 'dashboard',
35
+ html: { target: :_blank }
35
36
  },
36
37
  pages: {
37
38
  label: 'Pages',
@@ -38,7 +38,11 @@ module SmartNavigation
38
38
 
39
39
  # Get menu item url
40
40
  def item_url(item)
41
- item[:url].present? ? mixed_value(item[:url]) : "##{item[:id]}"
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
- @context.link_to label.html_safe, item_url(item)
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
@@ -1,3 +1,3 @@
1
1
  module SmartNavigation
2
- VERSION = '0.1.1'
2
+ VERSION = '0.1.2'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: smart_navigation
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonian Guveli