tabulous 0.0.2 → 1.0.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 +4 -0
- data/README.rdoc +6 -4
- data/lib/generators/tabs/tabs_generator.rb +3 -3
- data/lib/generators/tabs/templates/tabulous.rb +24 -25
- data/lib/tabulous/formatter.rb +2 -4
- data/lib/tabulous/railtie.rb +3 -9
- data/lib/tabulous/tab.rb +4 -30
- data/lib/tabulous/tabulous.rb +58 -38
- data/lib/tabulous/version.rb +1 -1
- data/lib/tasks/tabulous.rake +2 -2
- data/test/applications/main/{config/initializers → app/tabs}/tabulous.rb +38 -39
- data/test/applications/main/test/integration/actions_test.rb +36 -32
- data/test/applications/main/test/integration/active_tab_clickable_test.rb +36 -32
- data/test/applications/main/test/integration/always_render_subtabs_test.rb +36 -32
- data/test/applications/main/test/integration/css_no_scaffolding_test.rb +36 -32
- data/test/applications/main/test/integration/css_scaffolding_test.rb +36 -32
- data/test/applications/main/test/integration/display_text_test.rb +36 -32
- data/test/applications/main/test/integration/enabled_test.rb +36 -32
- data/test/applications/main/test/integration/html5_test.rb +36 -32
- data/test/applications/main/test/integration/path_test.rb +36 -32
- data/test/applications/main/test/integration/visible_test.rb +36 -32
- data/test/applications/main/test/unit/tabs_generator_test.rb +1 -1
- data/test/applications/simple_tabs/{config/initializers → app/tabs}/tabulous.rb +31 -32
- data/test/applications/subtabs/app/tabs/tabulous.rb +166 -0
- data/test/test_application_integration_test_helper.rb +1 -1
- data/test/{test_initializers → test_tab_files}/empty +0 -0
- data/test/test_tab_files/expected +59 -0
- data/test/test_tab_files/random_horizontal_whitespace +59 -0
- data/test/test_tab_files/random_vertical_whitespace +106 -0
- data/test/{test_initializers → test_tab_files}/text +0 -0
- data/test/test_tab_files/trailing_comments +59 -0
- data/test/units/tabulous_formatter_test.rb +8 -8
- metadata +13 -13
- data/test/applications/subtabs/config/initializers/tabulous.rb +0 -167
- data/test/test_initializers/expected +0 -55
- data/test/test_initializers/random_horizontal_whitespace +0 -55
- data/test/test_initializers/random_vertical_whitespace +0 -102
- data/test/test_initializers/trailing_comments +0 -55
data/CHANGELOG.rdoc
CHANGED
data/README.rdoc
CHANGED
@@ -20,11 +20,11 @@ To get started, add the gem to your Rails application's Gemfile and install it u
|
|
20
20
|
|
21
21
|
bundle install
|
22
22
|
|
23
|
-
Then generate the tab
|
23
|
+
Then generate the tab file:
|
24
24
|
|
25
25
|
rails generate tabs
|
26
26
|
|
27
|
-
This will generate
|
27
|
+
This will generate app/tabs/tabulous.rb. Open the file and configure it to your liking.
|
28
28
|
You'll notice the code is formatted into a grid. After you edit the file, run the following rake
|
29
29
|
task to prettify the code back into a nice grid:
|
30
30
|
|
@@ -61,8 +61,10 @@ CSS.
|
|
61
61
|
|
62
62
|
== Examples
|
63
63
|
|
64
|
-
|
65
|
-
|
64
|
+
There is a tutorial at http://techiferous.com/2011/03/tutorial-for-adding-tabs-to-rails-using-tabulous/
|
65
|
+
|
66
|
+
Also, look in this gem's test/applications directory to find working example applications.
|
67
|
+
Look at their app/tabs/tabulous.rb and app/layouts/application.html.erb files.
|
66
68
|
|
67
69
|
== Contributing
|
68
70
|
|
@@ -1,12 +1,12 @@
|
|
1
1
|
require 'colored'
|
2
2
|
class TabsGenerator < Rails::Generators::Base
|
3
3
|
source_root File.expand_path("../templates", __FILE__)
|
4
|
-
def
|
5
|
-
template "tabulous.rb", "
|
4
|
+
def create_tab_file
|
5
|
+
template "tabulous.rb", "app/tabs/tabulous.rb"
|
6
6
|
puts
|
7
7
|
puts ("Tabulous made some guesses about how you want your tabs configured but " +
|
8
8
|
"probably got some things wrong. So you need to edit " +
|
9
|
-
"
|
9
|
+
"app/tabs/tabulous.rb to your liking.").magenta
|
10
10
|
puts
|
11
11
|
puts "Don't forget to put <%= tabs %> and <%= subtabs %> in your layout(s).".magenta
|
12
12
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# Tabulous gives you an easy way to set up tabs for your Rails application.
|
2
2
|
#
|
3
|
-
# 1. Configure this
|
3
|
+
# 1. Configure this file.
|
4
4
|
# 2. Add <%%= tabs %> and <%%= subtabs %> in your layout(s) wherever you want
|
5
5
|
# your tabs to appear.
|
6
6
|
# 3. Add styles for these tabs in your stylesheets.
|
@@ -37,6 +37,8 @@ Tabulous.setup do |config|
|
|
37
37
|
#
|
38
38
|
# * No comments are allowed between rows.
|
39
39
|
# * Comments are allowed to the right of rows, except for header rows.
|
40
|
+
# * The start of a table is signified by a [ all by itself on a line.
|
41
|
+
# * The end of a table is signified by a ] all by itself on a line.
|
40
42
|
# * And most importantly: commas that separate cells should be surrounded
|
41
43
|
# by spaces and commas that are within cells should not. This gives the
|
42
44
|
# formatter an easy way to distinguish between cells without having
|
@@ -70,17 +72,19 @@ Tabulous.setup do |config|
|
|
70
72
|
end
|
71
73
|
-%>
|
72
74
|
<%= s = []
|
73
|
-
s << ' config.tabs
|
74
|
-
s << '
|
75
|
-
s << '
|
76
|
-
s << '
|
75
|
+
s << ' config.tabs do'
|
76
|
+
s << ' ['
|
77
|
+
s << ' #-------------------------------------------------------------------------------------------------#'
|
78
|
+
s << ' # TAB NAME | DISPLAY TEXT | PATH | VISIBLE? | ENABLED? #'
|
79
|
+
s << ' #-------------------------------------------------------------------------------------------------#'
|
77
80
|
for tab in tab_data
|
78
|
-
s << "[ :#{tab[:name]}_tab , '#{tab[:text]}' ,
|
81
|
+
s << "[ :#{tab[:name]}_tab , '#{tab[:text]}' , #{tab[:path_helper]} , true , true ],"
|
79
82
|
end
|
80
|
-
s << '
|
81
|
-
s << '
|
82
|
-
s << '
|
83
|
-
s << '
|
83
|
+
s << ' #-------------------------------------------------------------------------------------------------#'
|
84
|
+
s << ' # TAB NAME | DISPLAY TEXT | PATH | VISIBLE? | ENABLED? #'
|
85
|
+
s << ' #-------------------------------------------------------------------------------------------------#'
|
86
|
+
s << ' ]'
|
87
|
+
s << ' end'
|
84
88
|
Tabulous::Formatter.format(s).join("\n") %>
|
85
89
|
|
86
90
|
#-------------
|
@@ -98,17 +102,19 @@ Tabulous.setup do |config|
|
|
98
102
|
# the name of the tab or subtab that is active when this action is rendered
|
99
103
|
|
100
104
|
<%= s = []
|
101
|
-
s << ' config.actions
|
102
|
-
s << '
|
103
|
-
s << '
|
104
|
-
s << '
|
105
|
+
s << ' config.actions do'
|
106
|
+
s << ' ['
|
107
|
+
s << ' #-------------------------------------------------------------#'
|
108
|
+
s << ' # CONTROLLER | ACTION | TAB #'
|
109
|
+
s << ' #-------------------------------------------------------------#'
|
105
110
|
for tab in tab_data
|
106
111
|
s << "[ :#{tab[:name]} , :all_actions , :#{tab[:name]}_tab ],"
|
107
112
|
end
|
108
|
-
s << '
|
109
|
-
s << '
|
110
|
-
s << '
|
111
|
-
s << '
|
113
|
+
s << ' #-------------------------------------------------------------#'
|
114
|
+
s << ' # CONTROLLER | ACTION | TAB #'
|
115
|
+
s << ' #-------------------------------------------------------------#'
|
116
|
+
s << ' ]'
|
117
|
+
s << ' end'
|
112
118
|
Tabulous::Formatter.format(s).join("\n") %>
|
113
119
|
|
114
120
|
#-------------
|
@@ -160,11 +166,4 @@ Tabulous.setup do |config|
|
|
160
166
|
# config.css.inactive_tab_color = '#aaa'
|
161
167
|
# config.css.inactive_text_color = '#888'
|
162
168
|
|
163
|
-
#-----------
|
164
|
-
# NOTES
|
165
|
-
#-----------
|
166
|
-
#
|
167
|
-
# In development mode this initializer is reloaded for each request so that
|
168
|
-
# you don't have to restart the server each time you edit this file.
|
169
|
-
|
170
169
|
end
|
data/lib/tabulous/formatter.rb
CHANGED
@@ -134,15 +134,13 @@ module Tabulous
|
|
134
134
|
def beginning_of_table?
|
135
135
|
line = @line.split('#').first # naively strip out comments
|
136
136
|
return false if line.nil?
|
137
|
-
line
|
138
|
-
return line == 'config.tabs=[' || line == 'config.actions=['
|
137
|
+
line.strip == '['
|
139
138
|
end
|
140
139
|
|
141
140
|
def end_of_table?
|
142
141
|
line = @line.split('#').first # naively strip out comments
|
143
142
|
return false if line.nil?
|
144
|
-
line
|
145
|
-
return line == ']'
|
143
|
+
line.strip == ']'
|
146
144
|
end
|
147
145
|
|
148
146
|
def horizontal_rule?
|
data/lib/tabulous/railtie.rb
CHANGED
@@ -9,15 +9,9 @@ module Tabulous
|
|
9
9
|
initializer 'tabulous.helper' do |app|
|
10
10
|
ActionView::Base.send :include, Tabulous::Helpers
|
11
11
|
end
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
before_filter do
|
16
|
-
# reload tabulous initializer on every request if in development mode
|
17
|
-
load File.join(Rails.root.to_s, 'config/initializers/tabulous.rb')
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
12
|
+
config.to_prepare do
|
13
|
+
filename = File.join(Rails.root.to_s, 'app/tabs/tabulous.rb')
|
14
|
+
load filename if File.exists?(filename)
|
21
15
|
end
|
22
16
|
end
|
23
17
|
end
|
data/lib/tabulous/tab.rb
CHANGED
@@ -33,45 +33,19 @@ module Tabulous
|
|
33
33
|
end
|
34
34
|
|
35
35
|
def text(view)
|
36
|
-
|
37
|
-
run_closure(view, @text)
|
38
|
-
else
|
39
|
-
@text
|
40
|
-
end
|
36
|
+
@text
|
41
37
|
end
|
42
38
|
|
43
39
|
def path(view)
|
44
|
-
|
45
|
-
run_closure(view, @path)
|
46
|
-
else
|
47
|
-
@path
|
48
|
-
end
|
40
|
+
@path
|
49
41
|
end
|
50
42
|
|
51
43
|
def visible?(view)
|
52
|
-
|
53
|
-
!!run_closure(view, @visible)
|
54
|
-
else
|
55
|
-
!!@visible
|
56
|
-
end
|
44
|
+
!!@visible
|
57
45
|
end
|
58
46
|
|
59
47
|
def enabled?(view)
|
60
|
-
|
61
|
-
!!run_closure(view, @enabled)
|
62
|
-
else
|
63
|
-
!!@enabled
|
64
|
-
end
|
65
|
-
end
|
66
|
-
|
67
|
-
private
|
68
|
-
|
69
|
-
def run_closure(view, closure)
|
70
|
-
if view.respond_to? :instance_exec
|
71
|
-
view.instance_exec(&closure) # for Ruby 1.9
|
72
|
-
else
|
73
|
-
view.instance_eval(&closure)
|
74
|
-
end
|
48
|
+
!!@enabled
|
75
49
|
end
|
76
50
|
|
77
51
|
end
|
data/lib/tabulous/tabulous.rb
CHANGED
@@ -4,45 +4,16 @@ module Tabulous
|
|
4
4
|
yield self
|
5
5
|
end
|
6
6
|
|
7
|
-
def self.tabs
|
8
|
-
@@
|
9
|
-
last_tab = nil
|
10
|
-
ary.each do |tab_args|
|
11
|
-
begin
|
12
|
-
tab = Tab.new(*tab_args)
|
13
|
-
rescue ArgumentError
|
14
|
-
raise ColumnError,
|
15
|
-
"Your config.tabs table is improperly formatted. You probably have " +
|
16
|
-
"the wrong number of columns. Or, in other words, one of the arrays " +
|
17
|
-
"in the config.tabs array has the wrong number of elements."
|
18
|
-
end
|
19
|
-
if tab.subtab?
|
20
|
-
tab.add_parent(last_tab)
|
21
|
-
else
|
22
|
-
last_tab = tab
|
23
|
-
end
|
24
|
-
@@tabs << tab
|
25
|
-
end
|
7
|
+
def self.tabs(&block)
|
8
|
+
@@tabs_block = block
|
26
9
|
end
|
27
|
-
|
28
|
-
def self.actions
|
29
|
-
@@
|
30
|
-
ary.each do |a|
|
31
|
-
if a.size != 3
|
32
|
-
raise ColumnError,
|
33
|
-
"Your config.actions table is improperly formatted. You probably have " +
|
34
|
-
"the wrong number of columns. Or, in other words, one of the arrays " +
|
35
|
-
"in the config.actions array has the wrong number of elements."
|
36
|
-
end
|
37
|
-
end
|
38
|
-
ary.each do |controller, action, tab|
|
39
|
-
@@actions[controller] ||= {}
|
40
|
-
@@actions[controller][action] ||= []
|
41
|
-
@@actions[controller][action] << tab
|
42
|
-
end
|
10
|
+
|
11
|
+
def self.actions(&block)
|
12
|
+
@@actions_block = block
|
43
13
|
end
|
44
|
-
|
14
|
+
|
45
15
|
def self.render_tabs(view)
|
16
|
+
initialize_tabs(view)
|
46
17
|
return unless tab_defined?(view)
|
47
18
|
html = ''
|
48
19
|
html << embed_styles
|
@@ -63,6 +34,7 @@ module Tabulous
|
|
63
34
|
end
|
64
35
|
|
65
36
|
def self.render_subtabs(view)
|
37
|
+
initialize_tabs(view)
|
66
38
|
return unless tab_defined?(view)
|
67
39
|
controller = view.controller_name.to_sym
|
68
40
|
action = view.action_name.to_sym
|
@@ -97,6 +69,54 @@ module Tabulous
|
|
97
69
|
html
|
98
70
|
end
|
99
71
|
|
72
|
+
def self.initialize_tabs(view)
|
73
|
+
if view.respond_to? :instance_exec # for Ruby 1.9
|
74
|
+
self.tabs = view.instance_exec(&@@tabs_block)
|
75
|
+
self.actions = view.instance_exec(&@@actions_block)
|
76
|
+
else
|
77
|
+
self.tabs = view.instance_eval(&@@tabs_block)
|
78
|
+
self.actions = view.instance_eval(&@@actions_block)
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
def self.tabs=(ary)
|
83
|
+
@@tabs = []
|
84
|
+
last_tab = nil
|
85
|
+
ary.each do |tab_args|
|
86
|
+
begin
|
87
|
+
tab = Tab.new(*tab_args)
|
88
|
+
rescue ArgumentError
|
89
|
+
raise ColumnError,
|
90
|
+
"Your config.tabs table is improperly formatted. You probably have " +
|
91
|
+
"the wrong number of columns. Or, in other words, one of the arrays " +
|
92
|
+
"in the config.tabs array has the wrong number of elements."
|
93
|
+
end
|
94
|
+
if tab.subtab?
|
95
|
+
tab.add_parent(last_tab)
|
96
|
+
else
|
97
|
+
last_tab = tab
|
98
|
+
end
|
99
|
+
@@tabs << tab
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
def self.actions=(ary)
|
104
|
+
@@actions = {}
|
105
|
+
ary.each do |a|
|
106
|
+
if a.size != 3
|
107
|
+
raise ColumnError,
|
108
|
+
"Your config.actions table is improperly formatted. You probably have " +
|
109
|
+
"the wrong number of columns. Or, in other words, one of the arrays " +
|
110
|
+
"in the config.actions array has the wrong number of elements."
|
111
|
+
end
|
112
|
+
end
|
113
|
+
ary.each do |controller, action, tab|
|
114
|
+
@@actions[controller] ||= {}
|
115
|
+
@@actions[controller][action] ||= []
|
116
|
+
@@actions[controller][action] << tab
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
100
120
|
def self.main_tabs
|
101
121
|
@@tabs.select { |t| !t.subtab? }
|
102
122
|
end
|
@@ -128,7 +148,7 @@ module Tabulous
|
|
128
148
|
if @@raise_error_if_no_tab_found
|
129
149
|
raise NoTabFoundError,
|
130
150
|
"No tabs are defined for the controller '#{controller}'. " +
|
131
|
-
"You can define a tab for this controller in
|
151
|
+
"You can define a tab for this controller in app/tabs/tabulous.rb " +
|
132
152
|
"in the 'config.actions =' section. You can also turn off NoTabFoundErrors " +
|
133
153
|
"by setting config.raise_error_if_no_tab_found to false."
|
134
154
|
else
|
@@ -139,7 +159,7 @@ module Tabulous
|
|
139
159
|
if @@raise_error_if_no_tab_found
|
140
160
|
raise NoTabFoundError,
|
141
161
|
"No tab is defined for the action '#{action}' in the controller '#{controller}'. " +
|
142
|
-
"You can define a tab for this action in
|
162
|
+
"You can define a tab for this action in app/tabs/tabulous.rb " +
|
143
163
|
"in the 'config.actions =' section. You can also turn off NoTabFoundErrors " +
|
144
164
|
"by setting config.raise_error_if_no_tab_found to false."
|
145
165
|
else
|
data/lib/tabulous/version.rb
CHANGED
data/lib/tasks/tabulous.rake
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
namespace :tabs do
|
2
|
-
desc "Prettify
|
2
|
+
desc "Prettify app/tabs/tabulous.rb"
|
3
3
|
task :format do
|
4
4
|
require File.expand_path('../tabulous/formatter', File.dirname(__FILE__))
|
5
|
-
filename = File.join(Rails.root.to_s, '
|
5
|
+
filename = File.join(Rails.root.to_s, 'app', 'tabs', 'tabulous.rb')
|
6
6
|
reformatted = Tabulous::Formatter.format(IO.readlines(filename))
|
7
7
|
File.open(filename, 'w') do |f|
|
8
8
|
f.puts reformatted
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# Tabulous gives you an easy way to set up tabs for your Rails application.
|
2
2
|
#
|
3
|
-
# 1. Configure this
|
3
|
+
# 1. Configure this file.
|
4
4
|
# 2. Add <%= tabs %> and <%= subtabs %> in your layout(s) wherever you want
|
5
5
|
# your tabs to appear.
|
6
6
|
# 3. Add styles for these tabs in your stylesheets.
|
@@ -26,6 +26,8 @@ Tabulous.setup do |config|
|
|
26
26
|
#
|
27
27
|
# * No comments are allowed between rows.
|
28
28
|
# * Comments are allowed to the right of rows, except for header rows.
|
29
|
+
# * The start of a table is signified by a [ all by itself on a line.
|
30
|
+
# * The end of a table is signified by a ] all by itself on a line.
|
29
31
|
# * And most importantly: commas that separate cells should be surrounded
|
30
32
|
# by spaces and commas that are within cells should not. This gives the
|
31
33
|
# formatter an easy way to distinguish between cells without having
|
@@ -50,22 +52,24 @@ Tabulous.setup do |config|
|
|
50
52
|
# ENABLED
|
51
53
|
# whether the tab is disabled (unclickable)
|
52
54
|
|
53
|
-
config.tabs
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
55
|
+
config.tabs do
|
56
|
+
[
|
57
|
+
#------------------------------------------------------------------------------------------------------#
|
58
|
+
# TAB NAME | DISPLAY TEXT | PATH | VISIBLE? | ENABLED? #
|
59
|
+
#------------------------------------------------------------------------------------------------------#
|
60
|
+
[ :home_tab , 'Explanation' , "/" , true , true ],
|
61
|
+
[ :galaxies_tab , 'Galaxies' , "/galaxies" , true , true ],
|
62
|
+
[ :stars_tab , 'Stars' , "/stars" , true , true ],
|
63
|
+
[ :planets_tab , 'Planets' , "/planets" , true , true ],
|
64
|
+
[ :subtabs_tab , 'Subtabs' , "/subtabs/one" , true , true ],
|
65
|
+
[ :one_subtab , 'One' , "/subtabs/one" , true , true ],
|
66
|
+
[ :two_subtab , 'Two' , "/subtabs/two" , true , true ],
|
67
|
+
[ :three_subtab , 'Three' , "/subtabs/three" , true , true ],
|
68
|
+
#------------------------------------------------------------------------------------------------------#
|
69
|
+
# TAB NAME | DISPLAY TEXT | PATH | VISIBLE? | ENABLED? #
|
70
|
+
#------------------------------------------------------------------------------------------------------#
|
71
|
+
]
|
72
|
+
end
|
69
73
|
|
70
74
|
#-------------
|
71
75
|
# ACTIONS
|
@@ -81,21 +85,23 @@ Tabulous.setup do |config|
|
|
81
85
|
# TAB
|
82
86
|
# the name of the tab or subtab that is active when this action is rendered
|
83
87
|
|
84
|
-
config.actions
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
88
|
+
config.actions do
|
89
|
+
[
|
90
|
+
#-------------------------------------------------------------#
|
91
|
+
# CONTROLLER | ACTION | TAB #
|
92
|
+
#-------------------------------------------------------------#
|
93
|
+
[ :home , :all_actions , :home_tab ],
|
94
|
+
[ :galaxies , :all_actions , :galaxies_tab ],
|
95
|
+
[ :stars , :all_actions , :stars_tab ],
|
96
|
+
[ :planets , :all_actions , :planets_tab ],
|
97
|
+
[ :subtabs , :one , :one_subtab ],
|
98
|
+
[ :subtabs , :two , :two_subtab ],
|
99
|
+
[ :subtabs , :three , :three_subtab ],
|
100
|
+
#-------------------------------------------------------------#
|
101
|
+
# CONTROLLER | ACTION | TAB #
|
102
|
+
#-------------------------------------------------------------#
|
103
|
+
]
|
104
|
+
end
|
99
105
|
|
100
106
|
#-------------
|
101
107
|
# OPTIONS
|
@@ -146,11 +152,4 @@ Tabulous.setup do |config|
|
|
146
152
|
# config.css.inactive_tab_color = '#aaa'
|
147
153
|
# config.css.inactive_text_color = '#888'
|
148
154
|
|
149
|
-
#-----------
|
150
|
-
# NOTES
|
151
|
-
#-----------
|
152
|
-
#
|
153
|
-
# In development mode this initializer is reloaded for each request so that
|
154
|
-
# you don't have to restart the server each time you edit this file.
|
155
|
-
|
156
155
|
end
|
@@ -3,41 +3,45 @@ require File.expand_path("../integration_test_helper", File.dirname(__FILE__))
|
|
3
3
|
class ActionsTest < ActionController::IntegrationTest
|
4
4
|
|
5
5
|
def setup
|
6
|
-
|
6
|
+
use_tab_file %Q{
|
7
7
|
Tabulous.setup do |config|
|
8
8
|
|
9
|
-
config.tabs
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
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
|
25
27
|
|
26
|
-
config.actions
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
28
|
+
config.actions do
|
29
|
+
[
|
30
|
+
#-------------------------------------------------------------#
|
31
|
+
# CONTROLLER | ACTION | TAB #
|
32
|
+
#-------------------------------------------------------------#
|
33
|
+
[ :home , :index , :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
|
41
45
|
|
42
46
|
config.css.scaffolding = true
|
43
47
|
|