simple-navigation 4.3.0 → 4.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 32593dd3a7c2dd75f81fe21b56e89ec3fff2570b73461eac762b7911fc096297
4
- data.tar.gz: afed0ee3fdf40f71edb92446191699482c52e8cea2bcaf5cf4a9430f55b4e0a2
3
+ metadata.gz: 66e6c73b8c96a17a4730125ae741fc1f11f3c9495578cafdb2795223a251614c
4
+ data.tar.gz: 2b7e406ee541892f12e459eb2218a382f4f3ac26b89f11c382dfa92424146312
5
5
  SHA512:
6
- metadata.gz: b70cf93db548b4521e4ee41d8df47c782f7ea1b849935e157dc5d1f686eb32b285daa42bad75a643c208b739097083ce94d90554c7826288cc38724198cba6a0
7
- data.tar.gz: 5a376e9eeca42af65b8e23b37b30b3947c3b1d2554e55a3e2527705a80a077fd655d4fddff29b9f744b461f4affdd17ee2640a27fda924e3872882106bcbab8c
6
+ metadata.gz: 252b910e666cd652c25bc42823c3366d4d7f88b541684d6123b4644bcb121657ea22b59415c8333ffa0e69eff6586f2bee75c754426899ab4b8895f9e66a2814
7
+ data.tar.gz: c4b8fa52310cda2c367e24e88c0366d49d6cbfff41443be5c50092445a80fe14f27f014df47e08e19b4c75cf8d55d55678e606df9a7f2866feb7ea6d1f2e7859
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 4.4.0
4
+
5
+ * add options rendering to json renderer. Credits to Mikhail Kytyzov.
6
+
3
7
  ## 4.3.0
4
8
 
5
9
  * removed warnings from rspec. Thanks mgrunberg.
data/README.md CHANGED
@@ -60,4 +60,4 @@ In this situation `/Users/username/.rubies/ruby-2.2.3/bin/rake` is the command y
60
60
 
61
61
  ## License
62
62
 
63
- Copyright (c) 2021 codeplant GmbH, released under the MIT license
63
+ Copyright (c) 2022 codeplant GmbH, released under the MIT license
@@ -5,7 +5,8 @@ module SimpleNavigation
5
5
  attr_reader :key,
6
6
  :name,
7
7
  :sub_navigation,
8
- :url
8
+ :url,
9
+ :options
9
10
 
10
11
  # see ItemContainer#item
11
12
  #
@@ -121,13 +122,13 @@ module SimpleNavigation
121
122
 
122
123
  private
123
124
 
124
- attr_accessor :container,
125
- :options
125
+ attr_accessor :container
126
126
 
127
127
  attr_writer :key,
128
128
  :name,
129
129
  :sub_navigation,
130
- :url
130
+ :url,
131
+ :options
131
132
 
132
133
  def config
133
134
  SimpleNavigation.config
@@ -20,7 +20,8 @@ module SimpleNavigation
20
20
  items: hash_render(item.sub_navigation),
21
21
  name: item.name,
22
22
  selected: item.selected?,
23
- url: item.url
23
+ url: item.url,
24
+ options: item.options
24
25
  }
25
26
  end
26
27
  end
@@ -1,3 +1,3 @@
1
1
  module SimpleNavigation
2
- VERSION = '4.3.0'
2
+ VERSION = '4.4.0'
3
3
  end
@@ -20,12 +20,15 @@ module SimpleNavigation
20
20
  end
21
21
  end
22
22
 
23
- # FIXME: not sure if :as_hash returning an array makes sense...
24
23
  context 'when the :as_hash option is true' do
25
24
  let(:options) {{ level: :all, as_hash: true }}
26
25
 
27
- it 'returns a hash' do
26
+ it 'returns every item as a hash' do
28
27
  expect(output).to be_an Array
28
+
29
+ output.each do |item|
30
+ expect(item).to be_an Hash
31
+ end
29
32
  end
30
33
 
31
34
  it 'renders the selected page' do
@@ -34,6 +37,14 @@ module SimpleNavigation
34
37
  end
35
38
  end
36
39
 
40
+ context 'with options' do
41
+ it 'should render options for each item' do
42
+ parsed_output.each do |item|
43
+ expect(item).to have_key('options')
44
+ end
45
+ end
46
+ end
47
+
37
48
  context 'when a sub navigation item is selected' do
38
49
  let(:invoices_item) do
39
50
  parsed_output.find { |item| item['name'] == 'Invoices' }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple-navigation
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.3.0
4
+ version: 4.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andi Schacke
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2021-05-13 00:00:00.000000000 Z
13
+ date: 2022-05-24 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activesupport
@@ -259,7 +259,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
259
259
  - !ruby/object:Gem::Version
260
260
  version: '0'
261
261
  requirements: []
262
- rubygems_version: 3.0.9
262
+ rubygems_version: 3.2.3
263
263
  signing_key:
264
264
  specification_version: 4
265
265
  summary: simple-navigation is a ruby library for creating navigations (with multiple