rocket_navigation 0.2.3 → 0.3.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: 104c3a6dfd7bc95f49b6c3c5933e8062e5148729a603f8d8ff43ce763be547d2
4
- data.tar.gz: e530d9a3ebf80dde0e3e1a9c7893c34448e35bf5953cc9633a1487ce37a3950c
3
+ metadata.gz: 1bda4eea4427dca7e696a419ed59935489a7b41bdc0f35274c32256eea50107d
4
+ data.tar.gz: d72002ac33c69eb54749a6e1747ed1223c1833849993208406580e00b544e205
5
5
  SHA512:
6
- metadata.gz: f0e0b2a732b3962bb9973a22c7216e64adb74e5ecae5726986c62ef57ecfec1401cbfb58ed325d3c1beb0e3b866a4f9c1cd171604be498528fecc9aa1e74d07e
7
- data.tar.gz: 96da5e101d0a76bf2fadc921773b01bac05c6a275f2d86d481712254da28b210a322f4f8e0dd22680e0edd870e782f96fa942be1293c20afc90e1ec9ca8ded67
6
+ metadata.gz: b19a6ca3a23474aff13ede41d847a1fa8c6c32b5a90bf49c2513dcea5ea802c788c5ff808126e0129ab9c0ae26a6cfa91c53b54dfe20689a9edecba8d16e6808
7
+ data.tar.gz: 5fe86c6c2ad64fb7b6686de748c070a2db0842af84ba821a42330ea48113066cd30031ecfd02aba55aeaa894f4029e8d4984609d538e0b2bbb23216f20c4cccd
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rocket_navigation (0.2.2)
4
+ rocket_navigation (0.3.0)
5
5
  actionpack (>= 5.0)
6
6
  actionview (>= 5.0)
7
7
  activesupport (>= 5.0)
@@ -9,69 +9,70 @@ PATH
9
9
  GEM
10
10
  remote: https://rubygems.org/
11
11
  specs:
12
- actioncable (5.2.0)
13
- actionpack (= 5.2.0)
12
+ actioncable (5.2.2)
13
+ actionpack (= 5.2.2)
14
14
  nio4r (~> 2.0)
15
15
  websocket-driver (>= 0.6.1)
16
- actionmailer (5.2.0)
17
- actionpack (= 5.2.0)
18
- actionview (= 5.2.0)
19
- activejob (= 5.2.0)
16
+ actionmailer (5.2.2)
17
+ actionpack (= 5.2.2)
18
+ actionview (= 5.2.2)
19
+ activejob (= 5.2.2)
20
20
  mail (~> 2.5, >= 2.5.4)
21
21
  rails-dom-testing (~> 2.0)
22
- actionpack (5.2.0)
23
- actionview (= 5.2.0)
24
- activesupport (= 5.2.0)
22
+ actionpack (5.2.2)
23
+ actionview (= 5.2.2)
24
+ activesupport (= 5.2.2)
25
25
  rack (~> 2.0)
26
26
  rack-test (>= 0.6.3)
27
27
  rails-dom-testing (~> 2.0)
28
28
  rails-html-sanitizer (~> 1.0, >= 1.0.2)
29
- actionview (5.2.0)
30
- activesupport (= 5.2.0)
29
+ actionview (5.2.2)
30
+ activesupport (= 5.2.2)
31
31
  builder (~> 3.1)
32
32
  erubi (~> 1.4)
33
33
  rails-dom-testing (~> 2.0)
34
34
  rails-html-sanitizer (~> 1.0, >= 1.0.3)
35
- activejob (5.2.0)
36
- activesupport (= 5.2.0)
35
+ activejob (5.2.2)
36
+ activesupport (= 5.2.2)
37
37
  globalid (>= 0.3.6)
38
- activemodel (5.2.0)
39
- activesupport (= 5.2.0)
40
- activerecord (5.2.0)
41
- activemodel (= 5.2.0)
42
- activesupport (= 5.2.0)
38
+ activemodel (5.2.2)
39
+ activesupport (= 5.2.2)
40
+ activerecord (5.2.2)
41
+ activemodel (= 5.2.2)
42
+ activesupport (= 5.2.2)
43
43
  arel (>= 9.0)
44
- activestorage (5.2.0)
45
- actionpack (= 5.2.0)
46
- activerecord (= 5.2.0)
44
+ activestorage (5.2.2)
45
+ actionpack (= 5.2.2)
46
+ activerecord (= 5.2.2)
47
47
  marcel (~> 0.3.1)
48
- activesupport (5.2.0)
48
+ activesupport (5.2.2)
49
49
  concurrent-ruby (~> 1.0, >= 1.0.2)
50
50
  i18n (>= 0.7, < 2)
51
51
  minitest (~> 5.1)
52
52
  tzinfo (~> 1.1)
53
- addressable (2.5.2)
53
+ addressable (2.6.0)
54
54
  public_suffix (>= 2.0.2, < 4.0)
55
55
  arel (9.0.0)
56
56
  builder (3.2.3)
57
- capybara (3.2.1)
57
+ capybara (3.13.2)
58
58
  addressable
59
59
  mini_mime (>= 0.1.3)
60
60
  nokogiri (~> 1.8)
61
61
  rack (>= 1.6.0)
62
62
  rack-test (>= 0.6.3)
63
- xpath (~> 3.1)
63
+ regexp_parser (~> 1.2)
64
+ xpath (~> 3.2)
64
65
  coderay (1.1.2)
65
- concurrent-ruby (1.0.5)
66
+ concurrent-ruby (1.1.4)
66
67
  crass (1.0.4)
67
68
  diff-lcs (1.3)
68
69
  docile (1.3.1)
69
- erubi (1.7.1)
70
- ffi (1.9.25)
70
+ erubi (1.8.0)
71
+ ffi (1.10.0)
71
72
  formatador (0.2.5)
72
- globalid (0.4.1)
73
+ globalid (0.4.2)
73
74
  activesupport (>= 4.2.0)
74
- guard (2.14.2)
75
+ guard (2.15.0)
75
76
  formatador (>= 0.2.4)
76
77
  listen (>= 2.7, < 4.0)
77
78
  lumberjack (>= 1.0.12, < 2.0)
@@ -85,90 +86,91 @@ GEM
85
86
  guard (~> 2.1)
86
87
  guard-compat (~> 1.1)
87
88
  rspec (>= 2.99.0, < 4.0)
88
- i18n (1.0.1)
89
+ i18n (1.5.3)
89
90
  concurrent-ruby (~> 1.0)
90
91
  json (2.1.0)
91
92
  listen (3.1.5)
92
93
  rb-fsevent (~> 0.9, >= 0.9.4)
93
94
  rb-inotify (~> 0.9, >= 0.9.7)
94
95
  ruby_dep (~> 1.2)
95
- loofah (2.2.2)
96
+ loofah (2.2.3)
96
97
  crass (~> 1.0.2)
97
98
  nokogiri (>= 1.5.9)
98
99
  lumberjack (1.0.13)
99
- mail (2.7.0)
100
+ mail (2.7.1)
100
101
  mini_mime (>= 0.1.1)
101
- marcel (0.3.2)
102
+ marcel (0.3.3)
102
103
  mimemagic (~> 0.3.2)
103
- method_source (0.9.0)
104
- mimemagic (0.3.2)
105
- mini_mime (1.0.0)
106
- mini_portile2 (2.3.0)
104
+ method_source (0.9.2)
105
+ mimemagic (0.3.3)
106
+ mini_mime (1.0.1)
107
+ mini_portile2 (2.4.0)
107
108
  minitest (5.11.3)
108
109
  nenv (0.3.0)
109
110
  nio4r (2.3.1)
110
- nokogiri (1.8.2)
111
- mini_portile2 (~> 2.3.0)
111
+ nokogiri (1.10.1)
112
+ mini_portile2 (~> 2.4.0)
112
113
  notiffany (0.1.1)
113
114
  nenv (~> 0.1)
114
115
  shellany (~> 0.0)
115
- pry (0.11.3)
116
+ pry (0.12.2)
116
117
  coderay (~> 1.1.0)
117
118
  method_source (~> 0.9.0)
118
- public_suffix (3.0.2)
119
- rack (2.0.5)
120
- rack-test (1.0.0)
119
+ public_suffix (3.0.3)
120
+ rack (2.0.6)
121
+ rack-test (1.1.0)
121
122
  rack (>= 1.0, < 3)
122
- rails (5.2.0)
123
- actioncable (= 5.2.0)
124
- actionmailer (= 5.2.0)
125
- actionpack (= 5.2.0)
126
- actionview (= 5.2.0)
127
- activejob (= 5.2.0)
128
- activemodel (= 5.2.0)
129
- activerecord (= 5.2.0)
130
- activestorage (= 5.2.0)
131
- activesupport (= 5.2.0)
123
+ rails (5.2.2)
124
+ actioncable (= 5.2.2)
125
+ actionmailer (= 5.2.2)
126
+ actionpack (= 5.2.2)
127
+ actionview (= 5.2.2)
128
+ activejob (= 5.2.2)
129
+ activemodel (= 5.2.2)
130
+ activerecord (= 5.2.2)
131
+ activestorage (= 5.2.2)
132
+ activesupport (= 5.2.2)
132
133
  bundler (>= 1.3.0)
133
- railties (= 5.2.0)
134
+ railties (= 5.2.2)
134
135
  sprockets-rails (>= 2.0.0)
135
136
  rails-dom-testing (2.0.3)
136
137
  activesupport (>= 4.2.0)
137
138
  nokogiri (>= 1.6)
138
139
  rails-html-sanitizer (1.0.4)
139
140
  loofah (~> 2.2, >= 2.2.2)
140
- railties (5.2.0)
141
- actionpack (= 5.2.0)
142
- activesupport (= 5.2.0)
141
+ railties (5.2.2)
142
+ actionpack (= 5.2.2)
143
+ activesupport (= 5.2.2)
143
144
  method_source
144
145
  rake (>= 0.8.7)
145
- thor (>= 0.18.1, < 2.0)
146
- rake (12.3.1)
146
+ thor (>= 0.19.0, < 2.0)
147
+ rake (12.3.2)
147
148
  rb-fsevent (0.10.3)
148
- rb-inotify (0.9.10)
149
- ffi (>= 0.5.0, < 2)
150
- rdoc (6.0.4)
151
- rspec (3.7.0)
152
- rspec-core (~> 3.7.0)
153
- rspec-expectations (~> 3.7.0)
154
- rspec-mocks (~> 3.7.0)
155
- rspec-core (3.7.1)
156
- rspec-support (~> 3.7.0)
157
- rspec-expectations (3.7.0)
149
+ rb-inotify (0.10.0)
150
+ ffi (~> 1.0)
151
+ rdoc (6.1.1)
152
+ regexp_parser (1.3.0)
153
+ rspec (3.8.0)
154
+ rspec-core (~> 3.8.0)
155
+ rspec-expectations (~> 3.8.0)
156
+ rspec-mocks (~> 3.8.0)
157
+ rspec-core (3.8.0)
158
+ rspec-support (~> 3.8.0)
159
+ rspec-expectations (3.8.2)
158
160
  diff-lcs (>= 1.2.0, < 2.0)
159
- rspec-support (~> 3.7.0)
160
- rspec-mocks (3.7.0)
161
+ rspec-support (~> 3.8.0)
162
+ rspec-mocks (3.8.0)
161
163
  diff-lcs (>= 1.2.0, < 2.0)
162
- rspec-support (~> 3.7.0)
163
- rspec-rails (3.7.2)
164
+ rspec-support (~> 3.8.0)
165
+ rspec-rails (3.8.2)
164
166
  actionpack (>= 3.0)
165
167
  activesupport (>= 3.0)
166
168
  railties (>= 3.0)
167
- rspec-core (~> 3.7.0)
168
- rspec-expectations (~> 3.7.0)
169
- rspec-mocks (~> 3.7.0)
170
- rspec-support (~> 3.7.0)
171
- rspec-support (3.7.1)
169
+ rspec-core (~> 3.8.0)
170
+ rspec-expectations (~> 3.8.0)
171
+ rspec-mocks (~> 3.8.0)
172
+ rspec-support (~> 3.8.0)
173
+ rspec-support (3.8.0)
172
174
  ruby_dep (1.5.0)
173
175
  shellany (0.0.1)
174
176
  simplecov (0.16.1)
@@ -176,21 +178,21 @@ GEM
176
178
  json (>= 1.8, < 3)
177
179
  simplecov-html (~> 0.10.0)
178
180
  simplecov-html (0.10.2)
179
- sprockets (3.7.1)
181
+ sprockets (3.7.2)
180
182
  concurrent-ruby (~> 1.0)
181
183
  rack (> 1, < 3)
182
184
  sprockets-rails (3.2.1)
183
185
  actionpack (>= 4.0)
184
186
  activesupport (>= 4.0)
185
187
  sprockets (>= 3.0.0)
186
- thor (0.20.0)
188
+ thor (0.20.3)
187
189
  thread_safe (0.3.6)
188
190
  tzinfo (1.2.5)
189
191
  thread_safe (~> 0.1)
190
192
  websocket-driver (0.7.0)
191
193
  websocket-extensions (>= 0.1.0)
192
194
  websocket-extensions (0.1.3)
193
- xpath (3.1.0)
195
+ xpath (3.2.0)
194
196
  nokogiri (~> 1.8)
195
197
 
196
198
  PLATFORMS
@@ -210,4 +212,4 @@ DEPENDENCIES
210
212
  tzinfo
211
213
 
212
214
  BUNDLED WITH
213
- 1.16.1
215
+ 1.17.2
@@ -53,12 +53,50 @@ module RocketNavigation
53
53
  # end
54
54
  #
55
55
  def render_navigation(options = {}, &block)
56
+ options[:level] = options.delete(:levels) if options[:levels]
57
+
58
+ first_level = 1
59
+ unless options[:level].nil?
60
+ case options[:level]
61
+ when :all
62
+ fist_level = 1
63
+ when Integer
64
+ first_level = options[:level]
65
+ options[:level] = [options[:level]]
66
+ when Array, Range
67
+ options[:level] = options[:level].to_a
68
+ first_level = options[:level].first
69
+ end
70
+ end
71
+
56
72
  container = ItemContainer.new(1, options)
57
73
  container.view_context = view_context
58
74
  if block_given?
59
75
  yield container
60
76
  end
61
- container.render(options)
77
+
78
+ if first_level == 1
79
+ container.render(options)
80
+ else
81
+ # need to render not from first level
82
+ # drop down active tree to find a subtree to render
83
+ level = 1
84
+ while level < 50 #guard
85
+ selected_item = container.selected_item
86
+ if selected_item.nil?
87
+ return "".html_safe
88
+ end
89
+ if selected_item.level == first_level - 1
90
+ if selected_item.sub_navigation.nil?
91
+ return "".html_safe
92
+ end
93
+ return selected_item.sub_navigation.render(options)
94
+ end
95
+
96
+ level += 1
97
+ container = selected_item.sub_navigation
98
+ end
99
+ end
62
100
  end
63
101
 
64
102
  # Returns true or false based on the provided path and condition
@@ -1,3 +1,3 @@
1
1
  module RocketNavigation
2
- VERSION = "0.2.3"
2
+ VERSION = "0.3.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rocket_navigation
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gleb Tv
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-07-04 00:00:00.000000000 Z
11
+ date: 2019-01-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -248,8 +248,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
248
248
  - !ruby/object:Gem::Version
249
249
  version: '0'
250
250
  requirements: []
251
- rubyforge_project:
252
- rubygems_version: 2.7.7
251
+ rubygems_version: 3.0.2
253
252
  signing_key:
254
253
  specification_version: 4
255
254
  summary: rocket_navigation is a gem for creating navigation / menu (for Rails).