tabulous 1.0.3 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG.rdoc +5 -0
- data/Rakefile +2 -30
- data/lib/generators/tabs/templates/tabulous.rb +7 -4
- data/lib/tabulous/options.rb +14 -2
- data/lib/tabulous/tabulous.rb +15 -10
- data/lib/tabulous/version.rb +1 -1
- data/tabulous.gemspec +4 -1
- data/test/applications/rails30/main/app/controllers/no_tabs_controller.rb +4 -0
- data/test/applications/rails30/main/app/tabs/tabulous.rb +7 -4
- data/test/applications/rails30/main/app/views/no_tabs/index.html.erb +4 -0
- data/test/applications/rails30/main/config/routes.rb +1 -0
- data/test/applications/rails30/main/db/test.sqlite3 +0 -0
- data/test/applications/rails30/main/test/integration/when_action_has_no_tab_test.rb +77 -0
- data/test/applications/rails30/simple_tabs/app/tabs/tabulous.rb +7 -4
- data/test/applications/rails30/subtabs/app/tabs/tabulous.rb +7 -4
- data/test/applications/rails31/main/app/controllers/no_tabs_controller.rb +4 -0
- data/test/applications/rails31/main/app/tabs/tabulous.rb +7 -4
- data/test/applications/rails31/main/app/views/no_tabs/index.html.erb +4 -0
- data/test/applications/rails31/main/config/routes.rb +1 -0
- data/test/applications/rails31/main/test/integration/when_action_has_no_tab_test.rb +77 -0
- data/test/applications/rails31/simple_tabs/app/tabs/tabulous.rb +7 -4
- data/test/applications/rails31/subtabs/app/tabs/tabulous.rb +7 -4
- data/test/test_application_gemfile.rb +3 -2
- data/test/test_application_integration_test_helper.rb +1 -1
- metadata +43 -54
data/CHANGELOG.rdoc
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
== 1.1.0 (January 10, 2012)
|
2
|
+
* Deprecated the raise_error_if_no_tab_found configuration setting. Replaced it with
|
3
|
+
config.when_action_has_no_tab.
|
4
|
+
* Changed some gem versions in the development dependencies.
|
5
|
+
|
1
6
|
== 1.0.3 (November 6, 2011)
|
2
7
|
* Added support for Rails 3.1 (finally!).
|
3
8
|
|
data/Rakefile
CHANGED
@@ -9,34 +9,6 @@ require 'rake/rdoctask'
|
|
9
9
|
require 'rake/testtask'
|
10
10
|
|
11
11
|
namespace :test do
|
12
|
-
namespace :rails30 do
|
13
|
-
Dir['test/applications/rails30/*'].each do |filename|
|
14
|
-
if File.directory?(filename)
|
15
|
-
name = filename.split('/').last
|
16
|
-
desc "run tests for the Rails 3.0 test application #{name}"
|
17
|
-
Rake::TestTask.new(name) do |t|
|
18
|
-
t.libs << 'lib'
|
19
|
-
t.libs << 'test'
|
20
|
-
t.pattern = "test/applications/rails30/#{name}/**/*_test.rb"
|
21
|
-
t.verbose = false
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
namespace :rails31 do
|
27
|
-
Dir['test/applications/rails31/*'].each do |filename|
|
28
|
-
if File.directory?(filename)
|
29
|
-
name = filename.split('/').last
|
30
|
-
desc "run tests for the Rails 3.1 test application #{name}"
|
31
|
-
Rake::TestTask.new(name) do |t|
|
32
|
-
t.libs << 'lib'
|
33
|
-
t.libs << 'test'
|
34
|
-
t.pattern = "test/applications/rails31/#{name}/**/*_test.rb"
|
35
|
-
t.verbose = false
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
40
12
|
desc "run unit tests for tabulous"
|
41
13
|
Rake::TestTask.new(:units) do |t|
|
42
14
|
t.libs << 'lib'
|
@@ -52,14 +24,14 @@ task :test do
|
|
52
24
|
if File.directory?(filename)
|
53
25
|
name = filename.split('/').last
|
54
26
|
puts "Running tests for the Rails 3.0 test application \"#{name}\"".magenta
|
55
|
-
puts %x{rake test
|
27
|
+
puts %x{cd #{filename} && bundle exec rake test}
|
56
28
|
end
|
57
29
|
end
|
58
30
|
Dir['test/applications/rails31/*'].each do |filename|
|
59
31
|
if File.directory?(filename)
|
60
32
|
name = filename.split('/').last
|
61
33
|
puts "Running tests for the Rails 3.1 test application \"#{name}\"".magenta
|
62
|
-
puts %x{rake test
|
34
|
+
puts %x{cd #{filename} && bundle exec rake test}
|
63
35
|
end
|
64
36
|
end
|
65
37
|
puts "Running unit tests".magenta
|
@@ -132,10 +132,13 @@ Tabulous.setup do |config|
|
|
132
132
|
# By default, the subtabs HTML element is not rendered if it is empty.
|
133
133
|
config.always_render_subtabs = false
|
134
134
|
|
135
|
-
#
|
136
|
-
# an
|
137
|
-
#
|
138
|
-
config.
|
135
|
+
# Tabulous expects every controller action to be associated with a tab.
|
136
|
+
# When an action does not have an associated tab (or subtab), you can
|
137
|
+
# instruct tabulous how to behave:
|
138
|
+
config.when_action_has_no_tab = :raise_error # the default behavior
|
139
|
+
# config.when_action_has_no_tab = :do_not_render # no tab navigation HTML will be generated
|
140
|
+
# config.when_action_has_no_tab = :render # the tab navigation HTML will be generated,
|
141
|
+
# but no tab or subtab will be active
|
139
142
|
|
140
143
|
# By default, div elements are used in the tab markup. When html5 is
|
141
144
|
# true, nav elements are used instead.
|
data/lib/tabulous/options.rb
CHANGED
@@ -25,8 +25,8 @@ module Tabulous
|
|
25
25
|
mattr_accessor :active_tab_clickable
|
26
26
|
@@active_tab_clickable = false
|
27
27
|
|
28
|
-
mattr_accessor :
|
29
|
-
@@
|
28
|
+
mattr_accessor :when_action_has_no_tab
|
29
|
+
@@when_action_has_no_tab = :raise_error
|
30
30
|
|
31
31
|
mattr_accessor :css
|
32
32
|
@@css = Css.new
|
@@ -34,4 +34,16 @@ module Tabulous
|
|
34
34
|
mattr_accessor :html5
|
35
35
|
@@html5 = false
|
36
36
|
|
37
|
+
def self.raise_error_if_no_tab_found=(value)
|
38
|
+
msg = "DEPRECATION WARNING: Tabulous's config.raise_error_if_no_tab_found "
|
39
|
+
msg << "has been replaced by config.when_action_has_no_tab. "
|
40
|
+
msg << "Acceptable values are :raise_error, :do_not_render, or :render."
|
41
|
+
Rails.logger.warn msg
|
42
|
+
if value
|
43
|
+
self.when_action_has_no_tab = :raise_error
|
44
|
+
else
|
45
|
+
self.when_action_has_no_tab = :do_not_render
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
37
49
|
end
|
data/lib/tabulous/tabulous.rb
CHANGED
@@ -14,18 +14,18 @@ module Tabulous
|
|
14
14
|
|
15
15
|
def self.render_tabs(view)
|
16
16
|
initialize_tabs(view)
|
17
|
-
return
|
17
|
+
return if !tab_defined?(view) && @@when_action_has_no_tab == :do_not_render
|
18
18
|
html = ''
|
19
19
|
html << embed_styles
|
20
20
|
active_tab = active_tab(view)
|
21
|
-
active_tab_name = active_tab.name
|
21
|
+
active_tab_name = (active_tab ? active_tab.name : nil);
|
22
22
|
html << (@@html5 ? '<nav id="tabs">' : '<div id="tabs">')
|
23
23
|
html << '<ul>'
|
24
24
|
for tab in main_tabs
|
25
25
|
next if !tab.visible?(view)
|
26
26
|
html << render_tab(:text => tab.text(view),
|
27
27
|
:path => tab.path(view),
|
28
|
-
:active => (tab.name == active_tab_name),
|
28
|
+
:active => (active_tab_name && tab.name == active_tab_name),
|
29
29
|
:enabled => tab.enabled?(view))
|
30
30
|
end
|
31
31
|
html << '</ul>'
|
@@ -35,14 +35,18 @@ module Tabulous
|
|
35
35
|
|
36
36
|
def self.render_subtabs(view)
|
37
37
|
initialize_tabs(view)
|
38
|
-
return
|
38
|
+
return if !tab_defined?(view) && @@when_action_has_no_tab == :do_not_render
|
39
39
|
controller = view.controller_name.to_sym
|
40
40
|
action = view.action_name.to_sym
|
41
41
|
tab = active_tab(view)
|
42
42
|
html = ''
|
43
43
|
html << (@@html5 ? '<nav id="subtabs">' : '<div id="subtabs">')
|
44
44
|
html << '<ul>'
|
45
|
-
|
45
|
+
if tab.nil?
|
46
|
+
subtabs = []
|
47
|
+
else
|
48
|
+
subtabs = tab.subtabs.select{|subtab| subtab.visible?(view)}
|
49
|
+
end
|
46
50
|
return if subtabs.empty? && !@@always_render_subtabs
|
47
51
|
for subtab in subtabs
|
48
52
|
html << render_tab(:text => subtab.text(view),
|
@@ -137,31 +141,32 @@ module Tabulous
|
|
137
141
|
end
|
138
142
|
|
139
143
|
def self.active?(controller, action, tab_name)
|
144
|
+
return false if @@actions[controller].nil?
|
140
145
|
(@@actions[controller][action] && @@actions[controller][action].include?(tab_name)) ||
|
141
|
-
|
146
|
+
(@@actions[controller][:all_actions] && @@actions[controller][:all_actions].include?(tab_name))
|
142
147
|
end
|
143
148
|
|
144
149
|
def self.tab_defined?(view)
|
145
150
|
controller = view.controller_name.to_sym
|
146
151
|
action = view.action_name.to_sym
|
147
152
|
if @@actions[controller].nil?
|
148
|
-
if @@
|
153
|
+
if @@when_action_has_no_tab == :raise_error
|
149
154
|
raise NoTabFoundError,
|
150
155
|
"No tabs are defined for the controller '#{controller}'. " +
|
151
156
|
"You can define a tab for this controller in app/tabs/tabulous.rb " +
|
152
157
|
"in the 'config.actions =' section. You can also turn off NoTabFoundErrors " +
|
153
|
-
"by
|
158
|
+
"by changing the value of config.when_action_has_no_tab."
|
154
159
|
else
|
155
160
|
return false
|
156
161
|
end
|
157
162
|
end
|
158
163
|
if @@actions[controller][action].nil? && !@@actions[controller][:all_actions]
|
159
|
-
if @@
|
164
|
+
if @@when_action_has_no_tab == :raise_error
|
160
165
|
raise NoTabFoundError,
|
161
166
|
"No tab is defined for the action '#{action}' in the controller '#{controller}'. " +
|
162
167
|
"You can define a tab for this action in app/tabs/tabulous.rb " +
|
163
168
|
"in the 'config.actions =' section. You can also turn off NoTabFoundErrors " +
|
164
|
-
"by
|
169
|
+
"by changing the value of config.when_action_has_no_tab."
|
165
170
|
else
|
166
171
|
return false
|
167
172
|
end
|
data/lib/tabulous/version.rb
CHANGED
data/tabulous.gemspec
CHANGED
@@ -17,12 +17,15 @@ Gem::Specification.new do |s|
|
|
17
17
|
s.add_dependency "colored", "~> 1.2.0"
|
18
18
|
s.add_dependency "rails", "~> 3.0"
|
19
19
|
s.add_development_dependency "bundler", "~> 1.0.10"
|
20
|
-
s.add_development_dependency "capybara", "~>
|
20
|
+
s.add_development_dependency "capybara", "~> 1.1.2"
|
21
|
+
s.add_development_dependency "rake", "=0.8.7"
|
21
22
|
if RUBY_VERSION < "1.9"
|
22
23
|
s.add_development_dependency "redgreen"
|
23
24
|
end
|
24
25
|
s.add_development_dependency "launchy"
|
25
26
|
s.add_development_dependency "diffy"
|
27
|
+
s.add_development_dependency 'sqlite3-ruby', '~> 1.3.3'
|
28
|
+
s.add_development_dependency 'sqlite3', '=1.3.4'
|
26
29
|
|
27
30
|
s.files = `git ls-files`.split("\n")
|
28
31
|
s.executables = `git ls-files`.split("\n").map{|f| f =~ /^bin\/(.*)/ ? $1 : nil}.compact
|
@@ -113,10 +113,13 @@ Tabulous.setup do |config|
|
|
113
113
|
# By default, the subtabs HTML element is not rendered if it is empty.
|
114
114
|
config.always_render_subtabs = false
|
115
115
|
|
116
|
-
#
|
117
|
-
# an
|
118
|
-
#
|
119
|
-
config.
|
116
|
+
# Tabulous expects every controller action to be associated with a tab.
|
117
|
+
# When an action does not have an associated tab (or subtab), you can
|
118
|
+
# instruct tabulous how to behave:
|
119
|
+
config.when_action_has_no_tab = :raise_error # the default behavior
|
120
|
+
# config.when_action_has_no_tab = :do_not_render # no tab navigation HTML will be generated
|
121
|
+
# config.when_action_has_no_tab = :render # the tab navigation HTML will be generated,
|
122
|
+
# but no tab or subtab will be active
|
120
123
|
|
121
124
|
# By default, div elements are used in the tab markup. When html5 is
|
122
125
|
# true, nav elements are used instead.
|
Binary file
|
@@ -0,0 +1,77 @@
|
|
1
|
+
require File.expand_path("../integration_test_helper", File.dirname(__FILE__))
|
2
|
+
|
3
|
+
class WhenActionHasNoTabTest < ActionController::IntegrationTest
|
4
|
+
|
5
|
+
def init(behavior)
|
6
|
+
use_tab_file %Q{
|
7
|
+
Tabulous.setup do |config|
|
8
|
+
|
9
|
+
config.tabs do
|
10
|
+
[
|
11
|
+
#------------------------------------------------------------------------------------------------------#
|
12
|
+
# TAB NAME | DISPLAY TEXT | PATH | VISIBLE? | ENABLED? #
|
13
|
+
#------------------------------------------------------------------------------------------------------#
|
14
|
+
[ :home_tab , 'Explanation' , "/" , true , true ],
|
15
|
+
[ :galaxies_tab , 'Galaxies' , "/galaxies" , true , true ],
|
16
|
+
[ :stars_tab , 'Stars' , "/stars" , true , true ],
|
17
|
+
[ :planets_tab , 'Planets' , "/planets" , true , true ],
|
18
|
+
[ :subtabs_tab , 'Subtabs' , "/subtabs/one" , true , true ],
|
19
|
+
[ :one_subtab , 'One' , "/subtabs/one" , true , true ],
|
20
|
+
[ :two_subtab , 'Two' , "/subtabs/two" , true , true ],
|
21
|
+
[ :three_subtab , 'Three' , "/subtabs/three" , true , true ],
|
22
|
+
#------------------------------------------------------------------------------------------------------#
|
23
|
+
# TAB NAME | DISPLAY TEXT | PATH | VISIBLE? | ENABLED? #
|
24
|
+
#------------------------------------------------------------------------------------------------------#
|
25
|
+
]
|
26
|
+
end
|
27
|
+
|
28
|
+
config.actions do
|
29
|
+
[
|
30
|
+
#-------------------------------------------------------------#
|
31
|
+
# CONTROLLER | ACTION | TAB #
|
32
|
+
#-------------------------------------------------------------#
|
33
|
+
[ :home , :all_actions , :home_tab ],
|
34
|
+
[ :galaxies , :all_actions , :galaxies_tab ],
|
35
|
+
[ :stars , :all_actions , :stars_tab ],
|
36
|
+
[ :planets , :all_actions , :planets_tab ],
|
37
|
+
[ :subtabs , :one , :one_subtab ],
|
38
|
+
[ :subtabs , :two , :two_subtab ],
|
39
|
+
[ :subtabs , :three , :three_subtab ],
|
40
|
+
#-------------------------------------------------------------#
|
41
|
+
# CONTROLLER | ACTION | TAB #
|
42
|
+
#-------------------------------------------------------------#
|
43
|
+
]
|
44
|
+
end
|
45
|
+
|
46
|
+
config.when_action_has_no_tab = :#{behavior}
|
47
|
+
|
48
|
+
end
|
49
|
+
}
|
50
|
+
end
|
51
|
+
|
52
|
+
test "raise error" do
|
53
|
+
init(:raise_error)
|
54
|
+
assert_raise(ActionView::Template::Error) { visit '/notabs' }
|
55
|
+
end
|
56
|
+
|
57
|
+
test "render" do
|
58
|
+
init(:render)
|
59
|
+
visit '/notabs'
|
60
|
+
assert_tab_present 'Explanation'
|
61
|
+
assert_tab_present 'Galaxies'
|
62
|
+
assert_tab_present 'Stars'
|
63
|
+
assert_tab_present 'Planets'
|
64
|
+
assert_tab_present 'Subtabs'
|
65
|
+
end
|
66
|
+
|
67
|
+
test "do not render" do
|
68
|
+
init(:do_not_render)
|
69
|
+
visit '/notabs'
|
70
|
+
assert_tab_not_present 'Explanation'
|
71
|
+
assert_tab_not_present 'Galaxies'
|
72
|
+
assert_tab_not_present 'Stars'
|
73
|
+
assert_tab_not_present 'Planets'
|
74
|
+
assert_tab_not_present 'Subtabs'
|
75
|
+
end
|
76
|
+
|
77
|
+
end
|
@@ -106,10 +106,13 @@ Tabulous.setup do |config|
|
|
106
106
|
# By default, the subtabs HTML element is not rendered if it is empty.
|
107
107
|
# config.always_render_subtabs = false
|
108
108
|
|
109
|
-
#
|
110
|
-
# an
|
111
|
-
#
|
112
|
-
# config.
|
109
|
+
# Tabulous expects every controller action to be associated with a tab.
|
110
|
+
# When an action does not have an associated tab (or subtab), you can
|
111
|
+
# instruct tabulous how to behave:
|
112
|
+
# config.when_action_has_no_tab = :raise_error # the default behavior
|
113
|
+
# config.when_action_has_no_tab = :do_not_render # no tab navigation HTML will be generated
|
114
|
+
# config.when_action_has_no_tab = :render # the tab navigation HTML will be generated,
|
115
|
+
# but no tab or subtab will be active
|
113
116
|
|
114
117
|
# By default, div elements are used in the tab markup. When html5 is
|
115
118
|
# true, nav elements are used instead.
|
@@ -124,10 +124,13 @@ Tabulous.setup do |config|
|
|
124
124
|
# By default, the subtabs HTML element is not rendered if it is empty.
|
125
125
|
config.always_render_subtabs = false
|
126
126
|
|
127
|
-
#
|
128
|
-
# an
|
129
|
-
#
|
130
|
-
config.
|
127
|
+
# Tabulous expects every controller action to be associated with a tab.
|
128
|
+
# When an action does not have an associated tab (or subtab), you can
|
129
|
+
# instruct tabulous how to behave:
|
130
|
+
config.when_action_has_no_tab = :raise_error # the default behavior
|
131
|
+
# config.when_action_has_no_tab = :do_not_render # no tab navigation HTML will be generated
|
132
|
+
# config.when_action_has_no_tab = :render # the tab navigation HTML will be generated,
|
133
|
+
# but no tab or subtab will be active
|
131
134
|
|
132
135
|
# By default, div elements are used in the tab markup. When html5 is
|
133
136
|
# true, nav elements are used instead.
|
@@ -113,10 +113,13 @@ Tabulous.setup do |config|
|
|
113
113
|
# By default, the subtabs HTML element is not rendered if it is empty.
|
114
114
|
config.always_render_subtabs = false
|
115
115
|
|
116
|
-
#
|
117
|
-
# an
|
118
|
-
#
|
119
|
-
config.
|
116
|
+
# Tabulous expects every controller action to be associated with a tab.
|
117
|
+
# When an action does not have an associated tab (or subtab), you can
|
118
|
+
# instruct tabulous how to behave:
|
119
|
+
config.when_action_has_no_tab = :raise_error # the default behavior
|
120
|
+
# config.when_action_has_no_tab = :do_not_render # no tab navigation HTML will be generated
|
121
|
+
# config.when_action_has_no_tab = :render # the tab navigation HTML will be generated,
|
122
|
+
# but no tab or subtab will be active
|
120
123
|
|
121
124
|
# By default, div elements are used in the tab markup. When html5 is
|
122
125
|
# true, nav elements are used instead.
|
@@ -0,0 +1,77 @@
|
|
1
|
+
require File.expand_path("../integration_test_helper", File.dirname(__FILE__))
|
2
|
+
|
3
|
+
class WhenActionHasNoTabTest < ActionController::IntegrationTest
|
4
|
+
|
5
|
+
def init(behavior)
|
6
|
+
use_tab_file %Q{
|
7
|
+
Tabulous.setup do |config|
|
8
|
+
|
9
|
+
config.tabs do
|
10
|
+
[
|
11
|
+
#------------------------------------------------------------------------------------------------------#
|
12
|
+
# TAB NAME | DISPLAY TEXT | PATH | VISIBLE? | ENABLED? #
|
13
|
+
#------------------------------------------------------------------------------------------------------#
|
14
|
+
[ :home_tab , 'Explanation' , "/" , true , true ],
|
15
|
+
[ :galaxies_tab , 'Galaxies' , "/galaxies" , true , true ],
|
16
|
+
[ :stars_tab , 'Stars' , "/stars" , true , true ],
|
17
|
+
[ :planets_tab , 'Planets' , "/planets" , true , true ],
|
18
|
+
[ :subtabs_tab , 'Subtabs' , "/subtabs/one" , true , true ],
|
19
|
+
[ :one_subtab , 'One' , "/subtabs/one" , true , true ],
|
20
|
+
[ :two_subtab , 'Two' , "/subtabs/two" , true , true ],
|
21
|
+
[ :three_subtab , 'Three' , "/subtabs/three" , true , true ],
|
22
|
+
#------------------------------------------------------------------------------------------------------#
|
23
|
+
# TAB NAME | DISPLAY TEXT | PATH | VISIBLE? | ENABLED? #
|
24
|
+
#------------------------------------------------------------------------------------------------------#
|
25
|
+
]
|
26
|
+
end
|
27
|
+
|
28
|
+
config.actions do
|
29
|
+
[
|
30
|
+
#-------------------------------------------------------------#
|
31
|
+
# CONTROLLER | ACTION | TAB #
|
32
|
+
#-------------------------------------------------------------#
|
33
|
+
[ :home , :all_actions , :home_tab ],
|
34
|
+
[ :galaxies , :all_actions , :galaxies_tab ],
|
35
|
+
[ :stars , :all_actions , :stars_tab ],
|
36
|
+
[ :planets , :all_actions , :planets_tab ],
|
37
|
+
[ :subtabs , :one , :one_subtab ],
|
38
|
+
[ :subtabs , :two , :two_subtab ],
|
39
|
+
[ :subtabs , :three , :three_subtab ],
|
40
|
+
#-------------------------------------------------------------#
|
41
|
+
# CONTROLLER | ACTION | TAB #
|
42
|
+
#-------------------------------------------------------------#
|
43
|
+
]
|
44
|
+
end
|
45
|
+
|
46
|
+
config.when_action_has_no_tab = :#{behavior}
|
47
|
+
|
48
|
+
end
|
49
|
+
}
|
50
|
+
end
|
51
|
+
|
52
|
+
test "raise error" do
|
53
|
+
init(:raise_error)
|
54
|
+
assert_raise(ActionView::Template::Error) { visit '/notabs' }
|
55
|
+
end
|
56
|
+
|
57
|
+
test "render" do
|
58
|
+
init(:render)
|
59
|
+
visit '/notabs'
|
60
|
+
assert_tab_present 'Explanation'
|
61
|
+
assert_tab_present 'Galaxies'
|
62
|
+
assert_tab_present 'Stars'
|
63
|
+
assert_tab_present 'Planets'
|
64
|
+
assert_tab_present 'Subtabs'
|
65
|
+
end
|
66
|
+
|
67
|
+
test "do not render" do
|
68
|
+
init(:do_not_render)
|
69
|
+
visit '/notabs'
|
70
|
+
assert_tab_not_present 'Explanation'
|
71
|
+
assert_tab_not_present 'Galaxies'
|
72
|
+
assert_tab_not_present 'Stars'
|
73
|
+
assert_tab_not_present 'Planets'
|
74
|
+
assert_tab_not_present 'Subtabs'
|
75
|
+
end
|
76
|
+
|
77
|
+
end
|
@@ -106,10 +106,13 @@ Tabulous.setup do |config|
|
|
106
106
|
# By default, the subtabs HTML element is not rendered if it is empty.
|
107
107
|
# config.always_render_subtabs = false
|
108
108
|
|
109
|
-
#
|
110
|
-
# an
|
111
|
-
#
|
112
|
-
# config.
|
109
|
+
# Tabulous expects every controller action to be associated with a tab.
|
110
|
+
# When an action does not have an associated tab (or subtab), you can
|
111
|
+
# instruct tabulous how to behave:
|
112
|
+
# config.when_action_has_no_tab = :raise_error # the default behavior
|
113
|
+
# config.when_action_has_no_tab = :do_not_render # no tab navigation HTML will be generated
|
114
|
+
# config.when_action_has_no_tab = :render # the tab navigation HTML will be generated,
|
115
|
+
# but no tab or subtab will be active
|
113
116
|
|
114
117
|
# By default, div elements are used in the tab markup. When html5 is
|
115
118
|
# true, nav elements are used instead.
|
@@ -124,10 +124,13 @@ Tabulous.setup do |config|
|
|
124
124
|
# By default, the subtabs HTML element is not rendered if it is empty.
|
125
125
|
config.always_render_subtabs = false
|
126
126
|
|
127
|
-
#
|
128
|
-
# an
|
129
|
-
#
|
130
|
-
config.
|
127
|
+
# Tabulous expects every controller action to be associated with a tab.
|
128
|
+
# When an action does not have an associated tab (or subtab), you can
|
129
|
+
# instruct tabulous how to behave:
|
130
|
+
config.when_action_has_no_tab = :raise_error # the default behavior
|
131
|
+
# config.when_action_has_no_tab = :do_not_render # no tab navigation HTML will be generated
|
132
|
+
# config.when_action_has_no_tab = :render # the tab navigation HTML will be generated,
|
133
|
+
# but no tab or subtab will be active
|
131
134
|
|
132
135
|
# By default, div elements are used in the tab markup. When html5 is
|
133
136
|
# true, nav elements are used instead.
|
@@ -2,8 +2,10 @@
|
|
2
2
|
|
3
3
|
def shared_test_application_gems(bundler, rails_version)
|
4
4
|
bundler.instance_eval do
|
5
|
+
gem 'rake', '=0.8.7'
|
5
6
|
if rails_version == '3.0'
|
6
7
|
gem 'rails', '~>3.0.0'
|
8
|
+
gem 'sqlite3-ruby', :require => 'sqlite3'
|
7
9
|
elsif rails_version == '3.1'
|
8
10
|
gem 'rails', '~>3.1.0'
|
9
11
|
group :assets do
|
@@ -16,10 +18,9 @@ def shared_test_application_gems(bundler, rails_version)
|
|
16
18
|
else
|
17
19
|
raise "Unknown rails version '#{rails_version}'."
|
18
20
|
end
|
19
|
-
gem 'sqlite3-ruby', :require => 'sqlite3'
|
20
21
|
gem 'tabulous', :path => "../../../.."
|
21
22
|
group :test do
|
22
|
-
gem 'capybara'
|
23
|
+
gem 'capybara', "~> 1.1.2"
|
23
24
|
gem 'launchy'
|
24
25
|
gem 'redgreen' unless RUBY_VERSION >= "1.9"
|
25
26
|
if rails_version == '3.1'
|
metadata
CHANGED
@@ -1,13 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tabulous
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash: 17
|
5
4
|
prerelease:
|
6
|
-
|
7
|
-
- 1
|
8
|
-
- 0
|
9
|
-
- 3
|
10
|
-
version: 1.0.3
|
5
|
+
version: 1.1.0
|
11
6
|
platform: ruby
|
12
7
|
authors:
|
13
8
|
- Wyatt Greene
|
@@ -15,114 +10,107 @@ autorequire:
|
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
12
|
|
18
|
-
date:
|
13
|
+
date: 2012-01-11 00:00:00 Z
|
19
14
|
dependencies:
|
20
15
|
- !ruby/object:Gem::Dependency
|
21
16
|
name: colored
|
22
|
-
prerelease: false
|
23
17
|
requirement: &id001 !ruby/object:Gem::Requirement
|
24
18
|
none: false
|
25
19
|
requirements:
|
26
20
|
- - ~>
|
27
21
|
- !ruby/object:Gem::Version
|
28
|
-
hash: 31
|
29
|
-
segments:
|
30
|
-
- 1
|
31
|
-
- 2
|
32
|
-
- 0
|
33
22
|
version: 1.2.0
|
34
23
|
type: :runtime
|
24
|
+
prerelease: false
|
35
25
|
version_requirements: *id001
|
36
26
|
- !ruby/object:Gem::Dependency
|
37
27
|
name: rails
|
38
|
-
prerelease: false
|
39
28
|
requirement: &id002 !ruby/object:Gem::Requirement
|
40
29
|
none: false
|
41
30
|
requirements:
|
42
31
|
- - ~>
|
43
32
|
- !ruby/object:Gem::Version
|
44
|
-
hash: 7
|
45
|
-
segments:
|
46
|
-
- 3
|
47
|
-
- 0
|
48
33
|
version: "3.0"
|
49
34
|
type: :runtime
|
35
|
+
prerelease: false
|
50
36
|
version_requirements: *id002
|
51
37
|
- !ruby/object:Gem::Dependency
|
52
38
|
name: bundler
|
53
|
-
prerelease: false
|
54
39
|
requirement: &id003 !ruby/object:Gem::Requirement
|
55
40
|
none: false
|
56
41
|
requirements:
|
57
42
|
- - ~>
|
58
43
|
- !ruby/object:Gem::Version
|
59
|
-
hash: 3
|
60
|
-
segments:
|
61
|
-
- 1
|
62
|
-
- 0
|
63
|
-
- 10
|
64
44
|
version: 1.0.10
|
65
45
|
type: :development
|
46
|
+
prerelease: false
|
66
47
|
version_requirements: *id003
|
67
48
|
- !ruby/object:Gem::Dependency
|
68
49
|
name: capybara
|
69
|
-
prerelease: false
|
70
50
|
requirement: &id004 !ruby/object:Gem::Requirement
|
71
51
|
none: false
|
72
52
|
requirements:
|
73
53
|
- - ~>
|
74
54
|
- !ruby/object:Gem::Version
|
75
|
-
|
76
|
-
segments:
|
77
|
-
- 0
|
78
|
-
- 4
|
79
|
-
- 1
|
80
|
-
- 2
|
81
|
-
version: 0.4.1.2
|
55
|
+
version: 1.1.2
|
82
56
|
type: :development
|
57
|
+
prerelease: false
|
83
58
|
version_requirements: *id004
|
84
59
|
- !ruby/object:Gem::Dependency
|
85
|
-
name:
|
86
|
-
prerelease: false
|
60
|
+
name: rake
|
87
61
|
requirement: &id005 !ruby/object:Gem::Requirement
|
88
62
|
none: false
|
89
63
|
requirements:
|
90
|
-
- - "
|
64
|
+
- - "="
|
91
65
|
- !ruby/object:Gem::Version
|
92
|
-
|
93
|
-
segments:
|
94
|
-
- 0
|
95
|
-
version: "0"
|
66
|
+
version: 0.8.7
|
96
67
|
type: :development
|
68
|
+
prerelease: false
|
97
69
|
version_requirements: *id005
|
98
70
|
- !ruby/object:Gem::Dependency
|
99
71
|
name: launchy
|
100
|
-
prerelease: false
|
101
72
|
requirement: &id006 !ruby/object:Gem::Requirement
|
102
73
|
none: false
|
103
74
|
requirements:
|
104
75
|
- - ">="
|
105
76
|
- !ruby/object:Gem::Version
|
106
|
-
hash: 3
|
107
|
-
segments:
|
108
|
-
- 0
|
109
77
|
version: "0"
|
110
78
|
type: :development
|
79
|
+
prerelease: false
|
111
80
|
version_requirements: *id006
|
112
81
|
- !ruby/object:Gem::Dependency
|
113
82
|
name: diffy
|
114
|
-
prerelease: false
|
115
83
|
requirement: &id007 !ruby/object:Gem::Requirement
|
116
84
|
none: false
|
117
85
|
requirements:
|
118
86
|
- - ">="
|
119
87
|
- !ruby/object:Gem::Version
|
120
|
-
hash: 3
|
121
|
-
segments:
|
122
|
-
- 0
|
123
88
|
version: "0"
|
124
89
|
type: :development
|
90
|
+
prerelease: false
|
125
91
|
version_requirements: *id007
|
92
|
+
- !ruby/object:Gem::Dependency
|
93
|
+
name: sqlite3-ruby
|
94
|
+
requirement: &id008 !ruby/object:Gem::Requirement
|
95
|
+
none: false
|
96
|
+
requirements:
|
97
|
+
- - ~>
|
98
|
+
- !ruby/object:Gem::Version
|
99
|
+
version: 1.3.3
|
100
|
+
type: :development
|
101
|
+
prerelease: false
|
102
|
+
version_requirements: *id008
|
103
|
+
- !ruby/object:Gem::Dependency
|
104
|
+
name: sqlite3
|
105
|
+
requirement: &id009 !ruby/object:Gem::Requirement
|
106
|
+
none: false
|
107
|
+
requirements:
|
108
|
+
- - "="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: 1.3.4
|
111
|
+
type: :development
|
112
|
+
prerelease: false
|
113
|
+
version_requirements: *id009
|
126
114
|
description: Tabulous provides an easy way to add tabs to your Rails application.
|
127
115
|
email:
|
128
116
|
- techiferous@gmail.com
|
@@ -160,6 +148,7 @@ files:
|
|
160
148
|
- test/applications/rails30/main/app/controllers/application_controller.rb
|
161
149
|
- test/applications/rails30/main/app/controllers/galaxies_controller.rb
|
162
150
|
- test/applications/rails30/main/app/controllers/home_controller.rb
|
151
|
+
- test/applications/rails30/main/app/controllers/no_tabs_controller.rb
|
163
152
|
- test/applications/rails30/main/app/controllers/planets_controller.rb
|
164
153
|
- test/applications/rails30/main/app/controllers/stars_controller.rb
|
165
154
|
- test/applications/rails30/main/app/controllers/subtabs_controller.rb
|
@@ -178,6 +167,7 @@ files:
|
|
178
167
|
- test/applications/rails30/main/app/views/galaxies/show.html.erb
|
179
168
|
- test/applications/rails30/main/app/views/home/index.html.erb
|
180
169
|
- test/applications/rails30/main/app/views/layouts/application.html.erb
|
170
|
+
- test/applications/rails30/main/app/views/no_tabs/index.html.erb
|
181
171
|
- test/applications/rails30/main/app/views/planets/_form.html.erb
|
182
172
|
- test/applications/rails30/main/app/views/planets/edit.html.erb
|
183
173
|
- test/applications/rails30/main/app/views/planets/index.html.erb
|
@@ -236,6 +226,7 @@ files:
|
|
236
226
|
- test/applications/rails30/main/test/integration/main_tabs_test.rb
|
237
227
|
- test/applications/rails30/main/test/integration/path_test.rb
|
238
228
|
- test/applications/rails30/main/test/integration/visible_test.rb
|
229
|
+
- test/applications/rails30/main/test/integration/when_action_has_no_tab_test.rb
|
239
230
|
- test/applications/rails30/main/test/integration_test_helper.rb
|
240
231
|
- test/applications/rails30/main/test/test_helper.rb
|
241
232
|
- test/applications/rails30/main/test/unit/tabs_generator_test.rb
|
@@ -423,6 +414,7 @@ files:
|
|
423
414
|
- test/applications/rails31/main/app/controllers/application_controller.rb
|
424
415
|
- test/applications/rails31/main/app/controllers/galaxies_controller.rb
|
425
416
|
- test/applications/rails31/main/app/controllers/home_controller.rb
|
417
|
+
- test/applications/rails31/main/app/controllers/no_tabs_controller.rb
|
426
418
|
- test/applications/rails31/main/app/controllers/planets_controller.rb
|
427
419
|
- test/applications/rails31/main/app/controllers/stars_controller.rb
|
428
420
|
- test/applications/rails31/main/app/controllers/subtabs_controller.rb
|
@@ -443,6 +435,7 @@ files:
|
|
443
435
|
- test/applications/rails31/main/app/views/galaxies/show.html.erb
|
444
436
|
- test/applications/rails31/main/app/views/home/index.html.erb
|
445
437
|
- test/applications/rails31/main/app/views/layouts/application.html.erb
|
438
|
+
- test/applications/rails31/main/app/views/no_tabs/index.html.erb
|
446
439
|
- test/applications/rails31/main/app/views/planets/_form.html.erb
|
447
440
|
- test/applications/rails31/main/app/views/planets/edit.html.erb
|
448
441
|
- test/applications/rails31/main/app/views/planets/index.html.erb
|
@@ -501,6 +494,7 @@ files:
|
|
501
494
|
- test/applications/rails31/main/test/integration/main_tabs_test.rb
|
502
495
|
- test/applications/rails31/main/test/integration/path_test.rb
|
503
496
|
- test/applications/rails31/main/test/integration/visible_test.rb
|
497
|
+
- test/applications/rails31/main/test/integration/when_action_has_no_tab_test.rb
|
504
498
|
- test/applications/rails31/main/test/integration_test_helper.rb
|
505
499
|
- test/applications/rails31/main/test/test_helper.rb
|
506
500
|
- test/applications/rails31/main/test/unit/.gitkeep
|
@@ -721,7 +715,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
721
715
|
requirements:
|
722
716
|
- - ">="
|
723
717
|
- !ruby/object:Gem::Version
|
724
|
-
hash:
|
718
|
+
hash: 3134524414411715253
|
725
719
|
segments:
|
726
720
|
- 0
|
727
721
|
version: "0"
|
@@ -730,16 +724,11 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
730
724
|
requirements:
|
731
725
|
- - ">="
|
732
726
|
- !ruby/object:Gem::Version
|
733
|
-
hash: 21
|
734
|
-
segments:
|
735
|
-
- 1
|
736
|
-
- 3
|
737
|
-
- 7
|
738
727
|
version: 1.3.7
|
739
728
|
requirements: []
|
740
729
|
|
741
730
|
rubyforge_project: tabulous
|
742
|
-
rubygems_version: 1.8.
|
731
|
+
rubygems_version: 1.8.11
|
743
732
|
signing_key:
|
744
733
|
specification_version: 3
|
745
734
|
summary: Easy tabbed navigation for Rails.
|