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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 50aeb1e3d4da2ff847558e659609b7c05eb9943b
4
- data.tar.gz: a5d04fbcb4d629600980986a8c393fab5f7fbc18
3
+ metadata.gz: 2a11b6a19132990de70a6d893a6c07853467cdf7
4
+ data.tar.gz: a188cf95ab843f75dd9905ff3a3bc3cbe5acc5aa
5
5
  SHA512:
6
- metadata.gz: efb8decf8ffa561b31ea79bb521e5998dec794c7e409d9b6baac45283fd91b56a69dfe563176526ef1059c922543e1337f29fe1f2a655c2a94de0fac1c656a14
7
- data.tar.gz: 62ae481797701da993c1fa1c9a656574c433e6f02c147e0aefe9ca2ea50b637048aaed266eb9db7fd869eb37ad721bc8d7006ac7efba0ddb88073c2595e4fe43
6
+ metadata.gz: 707fc48650e9a14065c432b36728482ff828feeeade12b999f0b5bd6eb2cbba31962172ae0ee19aee9be584cd51cf56e39462c23175fd7bdebc762dd730e5aea
7
+ data.tar.gz: bc525f9d29980668aad48cbb10c0a2a751ca6f6f0c325919bab2e32363e9665e2e313a4424a9d60f10840e64ba1633d66caa160fa03420c2d05c0991724ee814
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.x.x](http://rubyonrails.org).
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:
@@ -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"
@@ -0,0 +1,11 @@
1
+ module Navigator
2
+ class Engine < ::Rails::Engine
3
+ isolate_namespace Navigator
4
+
5
+ initializer "navigator.action_controller" do |app|
6
+ ActiveSupport.on_load :action_controller do
7
+ helper Navigator::Engine.helpers
8
+ end
9
+ end
10
+ end
11
+ end
@@ -11,7 +11,7 @@ module Navigator
11
11
  end
12
12
 
13
13
  def prefix
14
- ["<#{name}", formatted_attributes, '>'].compact * ''
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 attributes.key? :data
31
- attributes[:data].each { |key, value| attributes["data-#{key}"] = value }
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 formatted_attributes
37
- expand_data_attributes!
38
- attrs = activator.activate(attributes).map { |key, value| %(#{key}="#{value}") } * ' '
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
@@ -1,3 +1,3 @@
1
1
  module Navigator
2
- VERSION = "0.8.0"
2
+ VERSION = "0.9.0"
3
3
  end
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.8.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-10 00:00:00.000000000 Z
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.0'
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.0'
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/action_view/instance_methods.rb
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