navigator 0.8.0 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/README.md +6 -1
- data/lib/navigator.rb +1 -11
- data/lib/navigator/engine.rb +11 -0
- data/lib/navigator/tag.rb +12 -8
- data/lib/navigator/version.rb +1 -1
- metadata +19 -5
- metadata.gz.sig +0 -0
- data/lib/navigator/action_view/instance_methods.rb +0 -23
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2a11b6a19132990de70a6d893a6c07853467cdf7
|
4
|
+
data.tar.gz: a188cf95ab843f75dd9905ff3a3bc3cbe5acc5aa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 707fc48650e9a14065c432b36728482ff828feeeade12b999f0b5bd6eb2cbba31962172ae0ee19aee9be584cd51cf56e39462c23175fd7bdebc762dd730e5aea
|
7
|
+
data.tar.gz: bc525f9d29980668aad48cbb10c0a2a751ca6f6f0c325919bab2e32363e9665e2e313a4424a9d60f10840e64ba1633d66caa160fa03420c2d05c0991724ee814
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/README.md
CHANGED
@@ -23,7 +23,7 @@ Enhances Rails with a DSL for menu navigation.
|
|
23
23
|
* [MRI 2.x.x](http://www.ruby-lang.org)
|
24
24
|
* [JRuby 1.x.x](http://jruby.org)
|
25
25
|
* [Rubinius 2.x.x](http://rubini.us)
|
26
|
-
0. [Ruby on Rails 4.
|
26
|
+
0. [Ruby on Rails 4.1.x](http://rubyonrails.org).
|
27
27
|
|
28
28
|
# Setup
|
29
29
|
|
@@ -255,6 +255,11 @@ To test, run:
|
|
255
255
|
|
256
256
|
bundle exec rspec spec
|
257
257
|
|
258
|
+
To test the dummy application, run:
|
259
|
+
|
260
|
+
cd spec/dummy
|
261
|
+
bin/rails server
|
262
|
+
|
258
263
|
# Versioning
|
259
264
|
|
260
265
|
Read [Semantic Versioning](http://semver.org) for details. Briefly, it means:
|
data/lib/navigator.rb
CHANGED
@@ -2,14 +2,4 @@ require "navigator/version"
|
|
2
2
|
require "navigator/tag_activator"
|
3
3
|
require "navigator/tag"
|
4
4
|
require "navigator/menu"
|
5
|
-
|
6
|
-
# Rails Enhancements
|
7
|
-
if defined? Rails
|
8
|
-
# Dependencies
|
9
|
-
require "navigator/action_view/instance_methods"
|
10
|
-
|
11
|
-
# View
|
12
|
-
if defined? ActionView
|
13
|
-
ActionView::Base.send :include, Navigator::ActionView
|
14
|
-
end
|
15
|
-
end
|
5
|
+
require "navigator/engine"
|
data/lib/navigator/tag.rb
CHANGED
@@ -11,7 +11,7 @@ module Navigator
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def prefix
|
14
|
-
["<#{name}",
|
14
|
+
["<#{name}", format_attributes, '>'].compact * ''
|
15
15
|
end
|
16
16
|
|
17
17
|
def suffix
|
@@ -26,16 +26,20 @@ module Navigator
|
|
26
26
|
|
27
27
|
attr_reader :attributes, :activator
|
28
28
|
|
29
|
-
def expand_data_attributes!
|
30
|
-
if
|
31
|
-
|
32
|
-
attributes.delete :data
|
29
|
+
def expand_data_attributes! attrs
|
30
|
+
if attrs.key? :data
|
31
|
+
attrs.delete(:data).each { |key, value| attrs["data-#{key}"] = value }
|
33
32
|
end
|
34
33
|
end
|
35
34
|
|
36
|
-
def
|
37
|
-
|
38
|
-
|
35
|
+
def concatenate_attributes attrs
|
36
|
+
activator.activate(attrs).map { |key, value| %(#{key}="#{value}") } * ' '
|
37
|
+
end
|
38
|
+
|
39
|
+
def format_attributes
|
40
|
+
attrs = attributes.clone
|
41
|
+
expand_data_attributes! attrs
|
42
|
+
attrs = concatenate_attributes attrs
|
39
43
|
attrs.empty? ? nil : " #{attrs}"
|
40
44
|
end
|
41
45
|
end
|
data/lib/navigator/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: navigator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brooke Kuhlmann
|
@@ -30,7 +30,7 @@ cert_chain:
|
|
30
30
|
fMlZDUGx3lQarp/vPjK+6XH7DLXjBEKqeIGBIpLthYUvDxJRp23C+T3liGSL32vg
|
31
31
|
mSpxxwmK95GDFuEy2mNPaxnazdkw8c+7DbrSpzd/CnNZkRgitxOavs8=
|
32
32
|
-----END CERTIFICATE-----
|
33
|
-
date: 2014-07-
|
33
|
+
date: 2014-07-13 00:00:00.000000000 Z
|
34
34
|
dependencies:
|
35
35
|
- !ruby/object:Gem::Dependency
|
36
36
|
name: pry-byebug
|
@@ -66,14 +66,14 @@ dependencies:
|
|
66
66
|
requirements:
|
67
67
|
- - "~>"
|
68
68
|
- !ruby/object:Gem::Version
|
69
|
-
version: '4.
|
69
|
+
version: '4.1'
|
70
70
|
type: :runtime
|
71
71
|
prerelease: false
|
72
72
|
version_requirements: !ruby/object:Gem::Requirement
|
73
73
|
requirements:
|
74
74
|
- - "~>"
|
75
75
|
- !ruby/object:Gem::Version
|
76
|
-
version: '4.
|
76
|
+
version: '4.1'
|
77
77
|
- !ruby/object:Gem::Dependency
|
78
78
|
name: rake
|
79
79
|
requirement: !ruby/object:Gem::Requirement
|
@@ -144,6 +144,20 @@ dependencies:
|
|
144
144
|
- - ">="
|
145
145
|
- !ruby/object:Gem::Version
|
146
146
|
version: '0'
|
147
|
+
- !ruby/object:Gem::Dependency
|
148
|
+
name: capybara
|
149
|
+
requirement: !ruby/object:Gem::Requirement
|
150
|
+
requirements:
|
151
|
+
- - ">="
|
152
|
+
- !ruby/object:Gem::Version
|
153
|
+
version: '0'
|
154
|
+
type: :development
|
155
|
+
prerelease: false
|
156
|
+
version_requirements: !ruby/object:Gem::Requirement
|
157
|
+
requirements:
|
158
|
+
- - ">="
|
159
|
+
- !ruby/object:Gem::Version
|
160
|
+
version: '0'
|
147
161
|
- !ruby/object:Gem::Dependency
|
148
162
|
name: rb-fsevent
|
149
163
|
requirement: !ruby/object:Gem::Requirement
|
@@ -198,7 +212,7 @@ files:
|
|
198
212
|
- LICENSE.md
|
199
213
|
- README.md
|
200
214
|
- lib/navigator.rb
|
201
|
-
- lib/navigator/
|
215
|
+
- lib/navigator/engine.rb
|
202
216
|
- lib/navigator/menu.rb
|
203
217
|
- lib/navigator/tag.rb
|
204
218
|
- lib/navigator/tag_activator.rb
|
metadata.gz.sig
CHANGED
Binary file
|
@@ -1,23 +0,0 @@
|
|
1
|
-
module Navigator
|
2
|
-
module ActionView
|
3
|
-
def self.included base
|
4
|
-
base.send :include, InstanceMethods
|
5
|
-
end
|
6
|
-
|
7
|
-
module InstanceMethods
|
8
|
-
def navigation tag = "ul", attributes = {}, activator = navigation_activator, &block
|
9
|
-
raw Menu.new(self, tag, attributes, activator, &block).render
|
10
|
-
end
|
11
|
-
|
12
|
-
module_function
|
13
|
-
|
14
|
-
def current_path
|
15
|
-
request.env["PATH_INFO"]
|
16
|
-
end
|
17
|
-
|
18
|
-
def navigation_activator
|
19
|
-
Navigator::TagActivator.new search_value: current_path
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|