smart_navigation 0.1.5 → 0.1.6

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: fbcc8862d61d716f665d737c6b508e263cad6b27
4
- data.tar.gz: 1296c9751364f5c601530482d232baea9db4f3cf
3
+ metadata.gz: ed1f29d3bce463186436db71fa5e7c764709e673
4
+ data.tar.gz: 8388ed7cb48cc2160111e67918806eef9d07ce20
5
5
  SHA512:
6
- metadata.gz: dbe7d62f64aa3e30579b7b40da141864a7826f8294814f28bb05da20308a892dfca502cf11a4b74b31d9526f94fdd7b5f20f426346755508a53305be6f7f39ec
7
- data.tar.gz: a9360276495a37bf0339c493a6e18104a54ebdcdae063b4ba72566605ce2175774aa49a1479f76bf6de3c5330aa08b31c151ae7b0d25014010484a613a18cfdd
6
+ metadata.gz: 72991d8c0cb882768760a783b209b97a1d455a5549be960a1c247e42b7ee92b6db0721e7ca4814e2b741b345a2430ce39471ab7f590a1c3200740fdfa9005ab2
7
+ data.tar.gz: 7b8e4fafbdb894826abfe260248ae722fd0f3548f9e17cdfb9e187645dd5929c61f3aef5a2b7e278655a8d7378367962518366295fa7c2e66f9096eea8d2be15
@@ -20,9 +20,11 @@ module SmartNavigation
20
20
  menu_class: 'menu',
21
21
  menu_html: {},
22
22
  menu_icons: true,
23
+ item_class: 'menu-item',
23
24
  separator_class: 'separator',
24
25
  submenu_parent_class: 'has-submenu',
25
26
  submenu_class: 'submenu',
27
+ submenu_item_class: 'submenu-item',
26
28
  active_class: 'active',
27
29
  active_submenu_class: 'open',
28
30
  submenu_icons: false,
@@ -116,16 +118,16 @@ module SmartNavigation
116
118
  url = item_url(item)
117
119
 
118
120
  if url.nil?
119
- tag :a, label.html_safe, Hash(item[:html])
121
+ tag :a, label.html_safe
120
122
  else
121
- @context.link_to label.html_safe, url, Hash(item[:html])
123
+ @context.link_to label.html_safe, url
122
124
  end
123
125
  end
124
126
 
125
127
  # Create submenu item
126
128
  def submenu_item_tag(item, active=false)
127
129
  items = sort_items item[:children]
128
- items = items.map { |_k, v| item_tag(v, @options[:submenu_icons]) }.join
130
+ items = items.map { |_k, v| item_tag(v, @options[:submenu_icons], true) }.join
129
131
  active = @options[:active_submenu_class] if active.present?
130
132
 
131
133
  tag(:ul, items.html_safe, class: "#{active} #{@options[:submenu_class]}".strip)
@@ -142,11 +144,14 @@ module SmartNavigation
142
144
  end
143
145
 
144
146
  # Create single menu item
145
- def single_item_tag(item, icons=false)
147
+ def single_item_tag(item, icons=false, subitem=false)
146
148
  active = @options[:active_class] if current_page?(item)
149
+ iclass = subitem ? @options[:submenu_item_class] : @options[:item_class]
147
150
  link = item_link_tag(item, icons)
151
+ opts = Hash(item[:html])
152
+ opts = opts.merge(class: "#{opts[:class]} #{active} #{iclass}".strip)
148
153
 
149
- tag :li, link.html_safe, class: "#{active}"
154
+ tag :li, link.html_safe, opts
150
155
  end
151
156
 
152
157
  # Create menu list item
@@ -1,3 +1,3 @@
1
1
  module SmartNavigation
2
- VERSION = '0.1.5'
2
+ VERSION = '0.1.6'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: smart_navigation
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonian Guveli
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-12-07 00:00:00.000000000 Z
11
+ date: 2017-12-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionview