navGATE 0.1.21 → 0.1.23
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +1 -1
- data/lib/navgate.rb +21 -6
- data/navGATE.gemspec +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cfffca90e5a8c00a84fd93e7a425e0bfdaae75c1
|
4
|
+
data.tar.gz: 6c41bbb8e738392546be1d2e7f28b28af562728e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e43a5e747a2a6205b6993289b732fe3e3fc0500910446c92cc00ace3dbaa717f21caae97cf524e1361d14a8212f6bb2c87f0d5f5a0657f72b96417aa6640ec05
|
7
|
+
data.tar.gz: e4aebc4c1a2e42989efc237dddfad22345da5d6e4cb3d50092ccb4ecfeee764d1935558cc32324ecb2539d42a1c2e6b0ca95b9c35f7c1ff52c0d6ede882d30f3
|
data/Rakefile
CHANGED
@@ -3,7 +3,7 @@ require 'rake'
|
|
3
3
|
require 'echoe'
|
4
4
|
|
5
5
|
|
6
|
-
Echoe.new('navGATE','0.1.
|
6
|
+
Echoe.new('navGATE','0.1.23') do |p|
|
7
7
|
p.summary = "Allows the easy creation of navigation with config files"
|
8
8
|
p.description = "Can create navigation from objects using the nav builder,from database tables or from a yaml file"
|
9
9
|
p.url = "https://github.com/Thermatix/navGATE"
|
data/lib/navgate.rb
CHANGED
@@ -125,7 +125,7 @@ class Navgate
|
|
125
125
|
|
126
126
|
|
127
127
|
def render_nav selection, controller, options
|
128
|
-
nav =
|
128
|
+
nav = nav_cache(controller.split('/').last).render_it_with(options,selection).html_safe
|
129
129
|
nav
|
130
130
|
end
|
131
131
|
|
@@ -133,22 +133,37 @@ class Navgate
|
|
133
133
|
if selection
|
134
134
|
return selection
|
135
135
|
else
|
136
|
-
|
137
|
-
return select_nav(controller).default.to_s
|
136
|
+
return nav_cache(controller.split('/').last).default.to_s
|
138
137
|
end
|
139
138
|
end
|
140
139
|
private
|
140
|
+
|
141
|
+
def nav_cache controller
|
142
|
+
if @selected_nav
|
143
|
+
if @selected_nav.controller.is_a?(Array)
|
144
|
+
return @selected_nav if @selected_nav.controller.include?(controller)
|
145
|
+
else
|
146
|
+
return @selected_nav unless @selected_nav.controller != controller
|
147
|
+
end
|
148
|
+
@selected_nav = nil
|
149
|
+
nav_cache(controller)
|
150
|
+
else
|
151
|
+
@selected_nav ||= select_nav(controller)
|
152
|
+
end
|
153
|
+
end
|
154
|
+
|
141
155
|
def select_nav controller
|
156
|
+
nav_to_return = nil
|
142
157
|
self.navs.each do |nav|
|
143
158
|
if nav.controller.is_a?(String)
|
144
|
-
|
159
|
+
nav_to_return = nav if (nav.controller) == controller
|
145
160
|
elsif nav.controller.is_a?(Array)
|
146
|
-
|
161
|
+
nav_to_return = nav if nav.controller.include?(controller)
|
147
162
|
else
|
148
163
|
raise TypeError, "expecting nav.controller to be a String or an Array, got #{nav.controller.class} "
|
149
164
|
end
|
150
165
|
end
|
151
|
-
raise ArgumentError, "No matching controllers for #{controller}"
|
166
|
+
nav_to_return ? (return nav_to_return) : (raise ArgumentError, "No matching controllers for #{controller}")
|
152
167
|
end
|
153
168
|
|
154
169
|
def not_bad_type? navs
|
data/navGATE.gemspec
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = "navGATE"
|
5
|
-
s.version = "0.1.
|
5
|
+
s.version = "0.1.23"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Martin Becker"]
|
9
|
-
s.date = "2013-10-
|
9
|
+
s.date = "2013-10-24"
|
10
10
|
s.description = "Can create navigation from objects using the nav builder,from database tables or from a yaml file"
|
11
11
|
s.email = "mbeckerwork@gmail.com"
|
12
12
|
s.extra_rdoc_files = ["lib/navgate.rb", "lib/navgate/base.rb", "lib/navgate/navgatehelpers.rb", "lib/readme.rdoc"]
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: navGATE
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.23
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Martin Becker
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-10-
|
11
|
+
date: 2013-10-24 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Can create navigation from objects using the nav builder,from database
|
14
14
|
tables or from a yaml file
|