tabnav 1.0.3 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/{spec/spec.opts → .rspec} +0 -0
- data/README.rdoc +4 -0
- data/Rakefile +5 -14
- data/VERSION +1 -1
- data/lib/tabnav/navbar.rb +2 -2
- data/spec/spec_helper.rb +2 -12
- data/spec/tabnav/helper_spec.rb +1 -1
- data/spec/tabnav/integration_spec.rb +14 -14
- metadata +24 -28
data/{spec/spec.opts → .rspec}
RENAMED
File without changes
|
data/README.rdoc
CHANGED
@@ -121,6 +121,10 @@ On froobles/index the output will be:
|
|
121
121
|
|
122
122
|
-----
|
123
123
|
|
124
|
+
== Attributions
|
125
|
+
|
126
|
+
The concept for this is based on the tabnav component from rails_widgets: http://github.com/paolodona/rails-widgets
|
127
|
+
|
124
128
|
== Note on Patches/Pull Requests
|
125
129
|
|
126
130
|
* Fork the project.
|
data/Rakefile
CHANGED
@@ -10,9 +10,9 @@ begin
|
|
10
10
|
gem.email = "github@unboxedconsulting.com"
|
11
11
|
gem.homepage = "http://github.com/unboxed/tabnav"
|
12
12
|
gem.authors = ["Unboxed"]
|
13
|
-
gem.add_dependency "actionpack", ">= 2.3.
|
14
|
-
gem.add_development_dependency "rspec", "
|
15
|
-
gem.add_development_dependency "rspec-rails", "
|
13
|
+
gem.add_dependency "actionpack", ">= 2.3.8"
|
14
|
+
gem.add_development_dependency "rspec", "~> 2.6.0"
|
15
|
+
gem.add_development_dependency "rspec-rails", "~> 2.6.1"
|
16
16
|
gem.files.exclude "*.gemspec", '.gitignore', 'doc/*'
|
17
17
|
end
|
18
18
|
Jeweler::GemcutterTasks.new
|
@@ -20,17 +20,8 @@ rescue LoadError
|
|
20
20
|
puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
|
21
21
|
end
|
22
22
|
|
23
|
-
require '
|
24
|
-
|
25
|
-
spec.libs << 'lib' << 'spec'
|
26
|
-
spec.spec_files = FileList['spec/**/*_spec.rb']
|
27
|
-
end
|
28
|
-
|
29
|
-
Spec::Rake::SpecTask.new(:rcov) do |spec|
|
30
|
-
spec.libs << 'lib' << 'spec'
|
31
|
-
spec.pattern = 'spec/**/*_spec.rb'
|
32
|
-
spec.rcov = true
|
33
|
-
end
|
23
|
+
require 'rspec/core/rake_task'
|
24
|
+
RSpec::Core::RakeTask.new(:spec)
|
34
25
|
|
35
26
|
task :spec => :check_dependencies
|
36
27
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0
|
1
|
+
1.1.0
|
data/lib/tabnav/navbar.rb
CHANGED
@@ -25,9 +25,9 @@ module Tabnav
|
|
25
25
|
def render # :nodoc:
|
26
26
|
return '' if @tabs.empty?
|
27
27
|
@template.content_tag :ul, @html_options do
|
28
|
-
contents = ''
|
28
|
+
contents = ''.html_safe
|
29
29
|
@tabs.each do |tab|
|
30
|
-
contents
|
30
|
+
contents << tab.render
|
31
31
|
end
|
32
32
|
contents
|
33
33
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -4,17 +4,7 @@ require 'rubygems'
|
|
4
4
|
require 'action_controller'
|
5
5
|
require 'tabnav'
|
6
6
|
|
7
|
-
require '
|
8
|
-
require 'spec/autorun'
|
7
|
+
require 'rspec'
|
9
8
|
|
10
|
-
|
11
|
-
class ApplicationController < ActionController::Base
|
12
|
-
end
|
13
|
-
require 'active_support/test_case'
|
14
|
-
require 'spec/test/unit'
|
15
|
-
require 'spec/rails/example'
|
16
|
-
require 'spec/rails/interop/testcase'
|
9
|
+
require 'rspec/rails'
|
17
10
|
|
18
|
-
Spec::Runner.configure do |config|
|
19
|
-
|
20
|
-
end
|
data/spec/tabnav/helper_spec.rb
CHANGED
@@ -11,7 +11,7 @@ describe Tabnav::Helper, :type => :helper do
|
|
11
11
|
helper.output_buffer = ''
|
12
12
|
end
|
13
13
|
it "should create a new navbar with the template and params and yield it to the block" do
|
14
|
-
params[
|
14
|
+
controller.params["foo"] = "bar"
|
15
15
|
Tabnav::Navbar.should_receive(:new).with(@template, {"foo" => "bar"}, {}).and_return(@navbar)
|
16
16
|
helper.render_tabnav do |n|
|
17
17
|
n.should == @navbar
|
@@ -56,14 +56,14 @@ describe Tabnav::Helper, :type => :helper do
|
|
56
56
|
describe "highlighting logic" do
|
57
57
|
context "params based rules" do
|
58
58
|
it "should highlight the tab if the rules match the params hash" do
|
59
|
-
params[
|
60
|
-
params[
|
61
|
-
params[
|
59
|
+
controller.params["controller"] = 'home'
|
60
|
+
controller.params["action"] = 'index'
|
61
|
+
controller.params["foo"] = 'bar'
|
62
62
|
helper.render_tabnav :id => "main_navigation", :class => "clearfix" do |n|
|
63
63
|
n.add_tab :class => "home_tab" do |t|
|
64
64
|
t.named "Home"
|
65
65
|
t.links_to '/'
|
66
|
-
t.highlights_on :controller =>
|
66
|
+
t.highlights_on :controller => 'home', :action => 'index'
|
67
67
|
end
|
68
68
|
n.add_tab :class => "heading" do |t|
|
69
69
|
t.named "Froobles Heading"
|
@@ -81,9 +81,9 @@ describe Tabnav::Helper, :type => :helper do
|
|
81
81
|
end
|
82
82
|
|
83
83
|
it "should allow multiple tabs to be active at once" do
|
84
|
-
params[
|
85
|
-
params[
|
86
|
-
params[
|
84
|
+
controller.params['controller'] = 'froobles'
|
85
|
+
controller.params['action'] = 'index'
|
86
|
+
controller.params['foo'] = 'bar'
|
87
87
|
helper.render_tabnav do |n|
|
88
88
|
n.add_tab :class => "home_tab" do |t|
|
89
89
|
t.named "Home"
|
@@ -106,9 +106,9 @@ describe Tabnav::Helper, :type => :helper do
|
|
106
106
|
end
|
107
107
|
|
108
108
|
it "should highlight tabs where any of the highlighting rules match" do
|
109
|
-
params[
|
110
|
-
params[
|
111
|
-
params[
|
109
|
+
controller.params['controller'] = 'home'
|
110
|
+
controller.params['action'] = 'froobles'
|
111
|
+
controller.params['foo'] = 'bar'
|
112
112
|
helper.render_tabnav do |n|
|
113
113
|
n.add_tab do |t|
|
114
114
|
t.named "Home"
|
@@ -145,9 +145,9 @@ describe Tabnav::Helper, :type => :helper do
|
|
145
145
|
end
|
146
146
|
|
147
147
|
it "should allow a mixture of rule types" do
|
148
|
-
params[
|
149
|
-
params[
|
150
|
-
params[
|
148
|
+
controller.params['controller'] = 'home'
|
149
|
+
controller.params['action'] = 'index'
|
150
|
+
controller.params['foo'] = 'bar'
|
151
151
|
helper.render_tabnav do |n|
|
152
152
|
n.add_tab :class => "home_tab" do |t|
|
153
153
|
t.named "Home"
|
@@ -194,4 +194,4 @@ describe Tabnav::Helper, :type => :helper do
|
|
194
194
|
'<li>Custom markup for Froobles</li></ul>'
|
195
195
|
end
|
196
196
|
end
|
197
|
-
end
|
197
|
+
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tabnav
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 19
|
5
|
+
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
|
+
- 1
|
8
9
|
- 0
|
9
|
-
|
10
|
-
version: 1.0.3
|
10
|
+
version: 1.1.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Unboxed
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date:
|
18
|
+
date: 2011-07-15 00:00:00 +01:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -26,12 +26,12 @@ dependencies:
|
|
26
26
|
requirements:
|
27
27
|
- - ">="
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
hash:
|
29
|
+
hash: 19
|
30
30
|
segments:
|
31
31
|
- 2
|
32
32
|
- 3
|
33
|
-
-
|
34
|
-
version: 2.3.
|
33
|
+
- 8
|
34
|
+
version: 2.3.8
|
35
35
|
type: :runtime
|
36
36
|
version_requirements: *id001
|
37
37
|
- !ruby/object:Gem::Dependency
|
@@ -40,14 +40,14 @@ dependencies:
|
|
40
40
|
requirement: &id002 !ruby/object:Gem::Requirement
|
41
41
|
none: false
|
42
42
|
requirements:
|
43
|
-
- -
|
43
|
+
- - ~>
|
44
44
|
- !ruby/object:Gem::Version
|
45
|
-
hash:
|
45
|
+
hash: 23
|
46
46
|
segments:
|
47
|
-
- 1
|
48
47
|
- 2
|
49
|
-
-
|
50
|
-
|
48
|
+
- 6
|
49
|
+
- 0
|
50
|
+
version: 2.6.0
|
51
51
|
type: :development
|
52
52
|
version_requirements: *id002
|
53
53
|
- !ruby/object:Gem::Dependency
|
@@ -56,14 +56,14 @@ dependencies:
|
|
56
56
|
requirement: &id003 !ruby/object:Gem::Requirement
|
57
57
|
none: false
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - ~>
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
hash:
|
61
|
+
hash: 21
|
62
62
|
segments:
|
63
|
-
- 1
|
64
63
|
- 2
|
65
|
-
-
|
66
|
-
|
64
|
+
- 6
|
65
|
+
- 1
|
66
|
+
version: 2.6.1
|
67
67
|
type: :development
|
68
68
|
version_requirements: *id003
|
69
69
|
description: Rails helper for generating navbars in a declarative manner
|
@@ -77,6 +77,7 @@ extra_rdoc_files:
|
|
77
77
|
- README.rdoc
|
78
78
|
files:
|
79
79
|
- .document
|
80
|
+
- .rspec
|
80
81
|
- LICENSE
|
81
82
|
- README.rdoc
|
82
83
|
- Rakefile
|
@@ -85,7 +86,6 @@ files:
|
|
85
86
|
- lib/tabnav/helper.rb
|
86
87
|
- lib/tabnav/navbar.rb
|
87
88
|
- lib/tabnav/tab.rb
|
88
|
-
- spec/spec.opts
|
89
89
|
- spec/spec_helper.rb
|
90
90
|
- spec/tabnav/helper_spec.rb
|
91
91
|
- spec/tabnav/integration_spec.rb
|
@@ -96,8 +96,8 @@ homepage: http://github.com/unboxed/tabnav
|
|
96
96
|
licenses: []
|
97
97
|
|
98
98
|
post_install_message:
|
99
|
-
rdoc_options:
|
100
|
-
|
99
|
+
rdoc_options: []
|
100
|
+
|
101
101
|
require_paths:
|
102
102
|
- lib
|
103
103
|
required_ruby_version: !ruby/object:Gem::Requirement
|
@@ -121,13 +121,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
121
121
|
requirements: []
|
122
122
|
|
123
123
|
rubyforge_project:
|
124
|
-
rubygems_version: 1.
|
124
|
+
rubygems_version: 1.4.2
|
125
125
|
signing_key:
|
126
126
|
specification_version: 3
|
127
127
|
summary: Rails helper for generating navbars
|
128
|
-
test_files:
|
129
|
-
|
130
|
-
- spec/tabnav/helper_spec.rb
|
131
|
-
- spec/tabnav/navbar_spec.rb
|
132
|
-
- spec/tabnav/integration_spec.rb
|
133
|
-
- spec/spec_helper.rb
|
128
|
+
test_files: []
|
129
|
+
|