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.
Files changed (38) hide show
  1. data/CHANGELOG.rdoc +4 -0
  2. data/README.rdoc +6 -4
  3. data/lib/generators/tabs/tabs_generator.rb +3 -3
  4. data/lib/generators/tabs/templates/tabulous.rb +24 -25
  5. data/lib/tabulous/formatter.rb +2 -4
  6. data/lib/tabulous/railtie.rb +3 -9
  7. data/lib/tabulous/tab.rb +4 -30
  8. data/lib/tabulous/tabulous.rb +58 -38
  9. data/lib/tabulous/version.rb +1 -1
  10. data/lib/tasks/tabulous.rake +2 -2
  11. data/test/applications/main/{config/initializers → app/tabs}/tabulous.rb +38 -39
  12. data/test/applications/main/test/integration/actions_test.rb +36 -32
  13. data/test/applications/main/test/integration/active_tab_clickable_test.rb +36 -32
  14. data/test/applications/main/test/integration/always_render_subtabs_test.rb +36 -32
  15. data/test/applications/main/test/integration/css_no_scaffolding_test.rb +36 -32
  16. data/test/applications/main/test/integration/css_scaffolding_test.rb +36 -32
  17. data/test/applications/main/test/integration/display_text_test.rb +36 -32
  18. data/test/applications/main/test/integration/enabled_test.rb +36 -32
  19. data/test/applications/main/test/integration/html5_test.rb +36 -32
  20. data/test/applications/main/test/integration/path_test.rb +36 -32
  21. data/test/applications/main/test/integration/visible_test.rb +36 -32
  22. data/test/applications/main/test/unit/tabs_generator_test.rb +1 -1
  23. data/test/applications/simple_tabs/{config/initializers → app/tabs}/tabulous.rb +31 -32
  24. data/test/applications/subtabs/app/tabs/tabulous.rb +166 -0
  25. data/test/test_application_integration_test_helper.rb +1 -1
  26. data/test/{test_initializers → test_tab_files}/empty +0 -0
  27. data/test/test_tab_files/expected +59 -0
  28. data/test/test_tab_files/random_horizontal_whitespace +59 -0
  29. data/test/test_tab_files/random_vertical_whitespace +106 -0
  30. data/test/{test_initializers → test_tab_files}/text +0 -0
  31. data/test/test_tab_files/trailing_comments +59 -0
  32. data/test/units/tabulous_formatter_test.rb +8 -8
  33. metadata +13 -13
  34. data/test/applications/subtabs/config/initializers/tabulous.rb +0 -167
  35. data/test/test_initializers/expected +0 -55
  36. data/test/test_initializers/random_horizontal_whitespace +0 -55
  37. data/test/test_initializers/random_vertical_whitespace +0 -102
  38. data/test/test_initializers/trailing_comments +0 -55
@@ -3,41 +3,45 @@ require File.expand_path("../integration_test_helper", File.dirname(__FILE__))
3
3
  class PathTest < ActionController::IntegrationTest
4
4
 
5
5
  def setup
6
- use_initializer %Q{
6
+ use_tab_file %Q{
7
7
  Tabulous.setup do |config|
8
8
 
9
- config.tabs = [
10
- #------------------------------------------------------------------------------------------------------------------------------------------------------#
11
- # TAB NAME | DISPLAY TEXT | PATH | VISIBLE? | ENABLED? #
12
- #------------------------------------------------------------------------------------------------------------------------------------------------------#
13
- [ :home_tab , 'Explanation' , "/" , true , true ],
14
- [ :galaxies_tab , 'Galaxies' , "/galaxies" , true , true ],
15
- [ :stars_tab , 'Stars' , lambda { controller_name == 'galaxies' ? "/stars" : "/planets" } , true , true ],
16
- [ :planets_tab , 'Planets' , "/planets" , true , true ],
17
- [ :subtabs_tab , 'Subtabs' , "/subtabs/one" , true , true ],
18
- [ :one_subtab , 'One' , "/subtabs/one" , true , true ],
19
- [ :two_subtab , 'Two' , "/subtabs/two" , true , true ],
20
- [ :three_subtab , 'Three' , lambda { "/subtabs/three" } , true , true ],
21
- #------------------------------------------------------------------------------------------------------------------------------------------------------#
22
- # TAB NAME | DISPLAY TEXT | PATH | VISIBLE? | ENABLED? #
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' , controller_name == 'galaxies' ? "/stars" : "/planets" , 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
- # CONTROLLER | ACTION | TAB #
29
- #-------------------------------------------------------------#
30
- [ :home , :all_actions , :home_tab ],
31
- [ :galaxies , :all_actions , :galaxies_tab ],
32
- [ :stars , :all_actions , :stars_tab ],
33
- [ :planets , :all_actions , :planets_tab ],
34
- [ :subtabs , :one , :one_subtab ],
35
- [ :subtabs , :two , :two_subtab ],
36
- [ :subtabs , :three , :three_subtab ],
37
- #-------------------------------------------------------------#
38
- # CONTROLLER | ACTION | TAB #
39
- #-------------------------------------------------------------#
40
- ]
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
41
45
 
42
46
  config.css.scaffolding = true
43
47
 
@@ -3,41 +3,45 @@ require File.expand_path("../integration_test_helper", File.dirname(__FILE__))
3
3
  class VisibleTest < ActionController::IntegrationTest
4
4
 
5
5
  def setup
6
- use_initializer %Q{
6
+ use_tab_file %Q{
7
7
  Tabulous.setup do |config|
8
8
 
9
- config.tabs = [
10
- #-------------------------------------------------------------------------------------------------------------------------------#
11
- # TAB NAME | DISPLAY TEXT | PATH | VISIBLE? | ENABLED? #
12
- #-------------------------------------------------------------------------------------------------------------------------------#
13
- [ :home_tab , 'Explanation' , "/" , true , true ],
14
- [ :galaxies_tab , 'Galaxies' , "/galaxies" , true , true ],
15
- [ :stars_tab , 'Stars' , "/stars" , lambda { controller_name =~ /s/ } , true ],
16
- [ :planets_tab , 'Planets' , "/planets" , false , true ],
17
- [ :subtabs_tab , 'Subtabs' , "/subtabs/one" , true , true ],
18
- [ :one_subtab , 'One' , "/subtabs/one" , true , true ],
19
- [ :two_subtab , 'Two' , "/subtabs/two" , false , true ],
20
- [ :three_subtab , 'Three' , "/subtabs/three" , lambda { false } , true ],
21
- #-------------------------------------------------------------------------------------------------------------------------------#
22
- # TAB NAME | DISPLAY TEXT | PATH | VISIBLE? | ENABLED? #
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" , controller_name =~ /s/ , true ],
17
+ [ :planets_tab , 'Planets' , "/planets" , false , true ],
18
+ [ :subtabs_tab , 'Subtabs' , "/subtabs/one" , true , true ],
19
+ [ :one_subtab , 'One' , "/subtabs/one" , true , true ],
20
+ [ :two_subtab , 'Two' , "/subtabs/two" , false , 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
- # CONTROLLER | ACTION | TAB #
29
- #-------------------------------------------------------------#
30
- [ :home , :all_actions , :home_tab ],
31
- [ :galaxies , :all_actions , :galaxies_tab ],
32
- [ :stars , :all_actions , :stars_tab ],
33
- [ :planets , :all_actions , :planets_tab ],
34
- [ :subtabs , :one , :one_subtab ],
35
- [ :subtabs , :two , :two_subtab ],
36
- [ :subtabs , :three , :three_subtab ],
37
- #-------------------------------------------------------------#
38
- # CONTROLLER | ACTION | TAB #
39
- #-------------------------------------------------------------#
40
- ]
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
41
45
 
42
46
  config.css.scaffolding = true
43
47
 
@@ -9,6 +9,6 @@ class TabsGeneratorTest < Rails::Generators::TestCase
9
9
 
10
10
  test "all files are properly created" do
11
11
  run_generator
12
- assert_file "config/initializers/tabulous.rb"
12
+ assert_file "app/tabs/tabulous.rb"
13
13
  end
14
14
  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 initializer.
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,18 +52,20 @@ Tabulous.setup do |config|
50
52
  # ENABLED
51
53
  # whether the tab is disabled (unclickable)
52
54
 
53
- config.tabs = [
54
- #-------------------------------------------------------------------------------------------------#
55
- # TAB NAME | DISPLAY TEXT | PATH | VISIBLE? | ENABLED? #
56
- #-------------------------------------------------------------------------------------------------#
57
- [ :home_tab , 'Explanation' , "/" , true , true ],
58
- [ :galaxies_tab , 'Galaxies' , "/galaxies" , true , true ],
59
- [ :stars_tab , 'Stars' , "/stars" , true , true ],
60
- [ :planets_tab , 'Planets' , "/planets" , true , true ],
61
- #-------------------------------------------------------------------------------------------------#
62
- # TAB NAME | DISPLAY TEXT | PATH | VISIBLE? | ENABLED? #
63
- #-------------------------------------------------------------------------------------------------#
64
- ]
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
+ #-------------------------------------------------------------------------------------------------#
65
+ # TAB NAME | DISPLAY TEXT | PATH | VISIBLE? | ENABLED? #
66
+ #-------------------------------------------------------------------------------------------------#
67
+ ]
68
+ end
65
69
 
66
70
  #-------------
67
71
  # ACTIONS
@@ -77,18 +81,20 @@ Tabulous.setup do |config|
77
81
  # TAB
78
82
  # the name of the tab or subtab that is active when this action is rendered
79
83
 
80
- config.actions = [
81
- #-------------------------------------------------------------#
82
- # CONTROLLER | ACTION | TAB #
83
- #-------------------------------------------------------------#
84
- [ :home , :all_actions , :home_tab ],
85
- [ :galaxies , :all_actions , :galaxies_tab ],
86
- [ :stars , :all_actions , :stars_tab ],
87
- [ :planets , :all_actions , :planets_tab ],
88
- #-------------------------------------------------------------#
89
- # CONTROLLER | ACTION | TAB #
90
- #-------------------------------------------------------------#
91
- ]
84
+ config.actions do
85
+ [
86
+ #-------------------------------------------------------------#
87
+ # CONTROLLER | ACTION | TAB #
88
+ #-------------------------------------------------------------#
89
+ [ :home , :all_actions , :home_tab ],
90
+ [ :galaxies , :all_actions , :galaxies_tab ],
91
+ [ :stars , :all_actions , :stars_tab ],
92
+ [ :planets , :all_actions , :planets_tab ],
93
+ #-------------------------------------------------------------#
94
+ # CONTROLLER | ACTION | TAB #
95
+ #-------------------------------------------------------------#
96
+ ]
97
+ end
92
98
 
93
99
  #-------------
94
100
  # OPTIONS
@@ -139,11 +145,4 @@ Tabulous.setup do |config|
139
145
  # config.css.inactive_tab_color = '#aaa'
140
146
  # config.css.inactive_text_color = '#888'
141
147
 
142
- #-----------
143
- # NOTES
144
- #-----------
145
- #
146
- # In development mode this initializer is reloaded for each request so that
147
- # you don't have to restart the server each time you edit this file.
148
-
149
148
  end
@@ -0,0 +1,166 @@
1
+ # Tabulous gives you an easy way to set up tabs for your Rails application.
2
+ #
3
+ # 1. Configure this file.
4
+ # 2. Add <%= tabs %> and <%= subtabs %> in your layout(s) wherever you want
5
+ # your tabs to appear.
6
+ # 3. Add styles for these tabs in your stylesheets.
7
+ # 4. Profit!
8
+
9
+ Tabulous.setup do |config|
10
+
11
+ #---------------------------
12
+ # HOW TO USE THE TABLES
13
+ #---------------------------
14
+ #
15
+ # The following tables are just an array of arrays. As such, you can put
16
+ # any Ruby code into a cell. For example, you could put "/foo/bar" in
17
+ # a path cell or you could put "/foo" + "/bar". You can even wrap up code
18
+ # in a lambda to be executed later. These will be executed in the context
19
+ # of a Rails view meaning they will have access to view helpers.
20
+ #
21
+ # However, there is something special about the format of these tables.
22
+ # Because it would be a pain for you to manually prettify the tables each
23
+ # time you edit them, there is a special rake task that does this for
24
+ # you: rake tabs:format. However, for this prettifier to work properly
25
+ # you have to follow some special rules:
26
+ #
27
+ # * No comments are allowed between rows.
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.
31
+ # * And most importantly: commas that separate cells should be surrounded
32
+ # by spaces and commas that are within cells should not. This gives the
33
+ # formatter an easy way to distinguish between cells without having
34
+ # to actually parse the Ruby.
35
+
36
+ #----------
37
+ # TABS
38
+ #----------
39
+ #
40
+ # This is where you define your tabs and subtabs. The order that the tabs
41
+ # appear in this list is the order they will appear in your views. Any
42
+ # subtabs defined will have the previous tab as their parent.
43
+ #
44
+ # TAB NAME
45
+ # must end in _tab or _subtab
46
+ # DISPLAY TEXT
47
+ # the text the user sees on the tab
48
+ # PATH
49
+ # the URL that gets sent to the server when the tab is clicked
50
+ # VISIBLE
51
+ # whether to display the tab
52
+ # ENABLED
53
+ # whether the tab is disabled (unclickable)
54
+
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/elliptical_galaxies' , true , true ],
62
+ [ :elliptical_galaxies_subtab , 'Elliptical Galaxies' , '/galaxies/elliptical_galaxies' , true , true ],
63
+ [ :spiral_galaxies_subtab , 'Spiral Galaxies' , '/galaxies/spiral_galaxies' , true , true ],
64
+ [ :lenticular_galaxies_subtab , 'Lenticular Galaxies' , '/galaxies/lenticular_galaxies' , true , true ],
65
+ [ :planets_tab , 'Planets' , '/exoplanets' , true , true ],
66
+ [ :exoplanets_subtab , 'Exoplanets' , '/exoplanets' , true , true ],
67
+ [ :rogue_planets_subtab , 'Rogue Planets' , '/rogue_planets' , true , true ],
68
+ [ :stars_tab , request.path =~ /stars/ ? 'Stars!' : 'Stars' , stars_path , true , true ],
69
+ [ :hidden_tab , 'Hidden' , '/hidden/always_visible' , request.path =~ /(hidden|galaxies)/ , true ],
70
+ [ :always_visible_subtab , 'Always Visible' , '/hidden/always_visible' , true , true ],
71
+ [ :always_hidden_subtab , 'Always Hidden' , '/hidden/always_hidden' , false , true ],
72
+ [ :disabled_tab , 'Disabled' , '/disabled/always_enabled' , true , request.path =~ /(disabled|stars)/ ],
73
+ [ :always_enabled_subtab , 'Always Enabled' , '/disabled/always_enabled' , true , true ],
74
+ [ :always_disabled_subtab , 'Always Disabled' , '/disabled/always_disabled' , true , false ],
75
+ #--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------#
76
+ # TAB NAME | DISPLAY TEXT | PATH | VISIBLE? | ENABLED? #
77
+ #--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------#
78
+ ]
79
+ end
80
+
81
+ #-------------
82
+ # ACTIONS
83
+ #-------------
84
+ #
85
+ # This is where you hook up actions with tabs. That way tabulous knows
86
+ # which tab and subtab to mark active when an action is rendered.
87
+ #
88
+ # CONTROLLER
89
+ # the name of the controller
90
+ # ACTION
91
+ # the name of the action, or :all_actions
92
+ # TAB
93
+ # the name of the tab or subtab that is active when this action is rendered
94
+
95
+ config.actions do
96
+ [
97
+ #-----------------------------------------------------------------------------------------#
98
+ # CONTROLLER | ACTION | TAB #
99
+ #-----------------------------------------------------------------------------------------#
100
+ [ :home , :all_actions , :home_tab ],
101
+ [ :elliptical_galaxies , :all_actions , :elliptical_galaxies_subtab ],
102
+ [ :spiral_galaxies , :all_actions , :spiral_galaxies_subtab ],
103
+ [ :lenticular_galaxies , :all_actions , :lenticular_galaxies_subtab ],
104
+ [ :exoplanets , :all_actions , :exoplanets_subtab ],
105
+ [ :rogue_planets , :all_actions , :rogue_planets_subtab ],
106
+ [ :stars , :all_actions , :stars_tab ],
107
+ [ :misc , :always_visible , :always_visible_subtab ],
108
+ [ :misc , :always_hidden , :always_hidden_subtab ],
109
+ [ :misc , :always_enabled , :always_enabled_subtab ],
110
+ [ :misc , :always_disabled , :always_disabled_subtab ],
111
+ #-----------------------------------------------------------------------------------------#
112
+ # CONTROLLER | ACTION | TAB #
113
+ #-----------------------------------------------------------------------------------------#
114
+ ]
115
+ end
116
+
117
+ #-------------
118
+ # OPTIONS
119
+ #-------------
120
+
121
+ # By default, you cannot click on the active tab.
122
+ config.active_tab_clickable = false
123
+
124
+ # By default, the subtabs HTML element is not rendered if it is empty.
125
+ config.always_render_subtabs = false
126
+
127
+ # By default, when an action renders and no tab is defined for that action,
128
+ # an error is thrown. If you turn this off, no error is thrown and the
129
+ # tabs are simply not rendered.
130
+ config.raise_error_if_no_tab_found = true
131
+
132
+ # By default, div elements are used in the tab markup. When html5 is
133
+ # true, nav elements are used instead.
134
+ config.html5 = false
135
+
136
+ #------------
137
+ # STYLES
138
+ #------------
139
+ #
140
+ # The markup that is generated has the following properties:
141
+ #
142
+ # Tabs and subtabs that are selected have the class "active".
143
+ # Tabs and subtabs that are not selected have the class "inactive".
144
+ # Tabs that are disabled have the class "disabled"; otherwise, "enabled".
145
+ # Tabs that are not visible do not appear in the markup at all.
146
+ #
147
+ # These classes are provided to make it easier for you to create your
148
+ # own CSS (and JavaScript) for the tabs.
149
+
150
+ # Some styles will be generated for you to get you off to a good start.
151
+ # Scaffolded styles are not meant to be used in production as they
152
+ # generate invalid HTML markup. They are merely meant to give you a
153
+ # head start or an easy way to prototype quickly.
154
+ #
155
+ config.css.scaffolding = true
156
+
157
+ # You can tweak the colors of the generated CSS.
158
+ #
159
+ config.css.background_color = '#cec'
160
+ config.css.text_color = '#464'
161
+ config.css.active_tab_color = '#fff'
162
+ config.css.hover_tab_color = '#dfd'
163
+ config.css.inactive_tab_color = '#aca'
164
+ config.css.inactive_text_color = '#8a8'
165
+
166
+ end
@@ -81,7 +81,7 @@ module ActionController
81
81
  assert_block(message) { !result.empty? }
82
82
  end
83
83
 
84
- def use_initializer(i)
84
+ def use_tab_file(i)
85
85
  eval i
86
86
  end
87
87
 
File without changes
@@ -0,0 +1,59 @@
1
+ Tabulous.setup do |config|
2
+
3
+ config.tabs do
4
+ [
5
+ #----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------#
6
+ # TAB NAME | DISPLAY TEXT | PATH | VISIBLE? | ENABLED? #
7
+ #----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------#
8
+ [ :home_tab , 'Explanation' , '/' , true , true ],
9
+ [ :galaxies_tab , 'Galaxies' , '/galaxies/elliptical_galaxies' , true , true ],
10
+ [ :elliptical_galaxies_subtab , 'Elliptical Galaxies' , '/galaxies/elliptical_galaxies' , true , true ],
11
+ [ :spiral_galaxies_subtab , 'Spiral Galaxies' , '/galaxies/spiral_galaxies' , true , true ],
12
+ [ :lenticular_galaxies_subtab , 'Lenticular Galaxies' , '/galaxies/lenticular_galaxies' , true , true ],
13
+ [ :planets_tab , 'Planets' , '/exoplanets' , true , true ],
14
+ [ :exoplanets_subtab , 'Exoplanets' , '/exoplanets' , true , true ],
15
+ [ :rogue_planets_subtab , 'Rogue Planets' , '/rogue_planets' , true , true ],
16
+ [ :stars_tab , 'Stars' , '/stars' , true , true ],
17
+ [ :hidden_tab , 'Hidden' , '/hidden/always_visible' , lambda { request.path =~ /(hidden|galaxies)/ } , true ],
18
+ [ :always_visible_subtab , 'Always Visible' , '/hidden/always_visible' , true , true ],
19
+ [ :always_hidden_subtab , 'Always Hidden' , '/hidden/always_hidden' , false , true ],
20
+ [ :disabled_tab , 'Disabled' , '/disabled/always_enabled' , true , lambda { request.path =~ /(disabled|stars)/ } ],
21
+ [ :always_enabled_subtab , 'Always Enabled' , '/disabled/always_enabled' , true , true ],
22
+ [ :always_disabled_subtab , 'Always Disabled' , '/disabled/always_disabled' , true , false ],
23
+ #----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------#
24
+ # TAB NAME | DISPLAY TEXT | PATH | VISIBLE? | ENABLED? #
25
+ #----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------#
26
+ ]
27
+ end
28
+
29
+ config.actions do
30
+ [
31
+ #-----------------------------------------------------------------------------------------#
32
+ # CONTROLLER | ACTION | TAB #
33
+ #-----------------------------------------------------------------------------------------#
34
+ [ :home , :all_actions , :home_tab ],
35
+ [ :elliptical_galaxies , :all_actions , :elliptical_galaxies_subtab ],
36
+ [ :spiral_galaxies , :all_actions , :spiral_galaxies_subtab ],
37
+ [ :lenticular_galaxies , :all_actions , :lenticular_galaxies_subtab ],
38
+ [ :exoplanets , :all_actions , :exoplanets_subtab ],
39
+ [ :rogue_planets , :all_actions , :rogue_planets_subtab ],
40
+ [ :stars , :all_actions , :stars_tab ],
41
+ [ :misc , :always_visible , :always_visible_subtab ],
42
+ [ :misc , :always_hidden , :always_hidden_subtab ],
43
+ [ :misc , :always_enabled , :always_enabled_subtab ],
44
+ [ :misc , :always_disabled , :always_disabled_subtab ],
45
+ #-----------------------------------------------------------------------------------------#
46
+ # CONTROLLER | ACTION | TAB #
47
+ #-----------------------------------------------------------------------------------------#
48
+ ]
49
+ end
50
+
51
+ config.css.scaffolding = true
52
+ config.css.background_color = '#cec'
53
+ config.css.text_color = '#464'
54
+ config.css.active_tab_color = '#fff'
55
+ config.css.hover_tab_color = '#dfd'
56
+ config.css.inactive_tab_color = '#aca'
57
+ config.css.inactive_text_color = '#8a8'
58
+
59
+ end
@@ -0,0 +1,59 @@
1
+ Tabulous.setup do |config|
2
+
3
+ config.tabs do
4
+ [
5
+ #----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------#
6
+ # TAB NAME | DISPLAY TEXT | PATH | VISIBLE? | ENABLED? #
7
+ #----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------#
8
+ [ :home_tab , 'Explanation' , '/' , true , true ],
9
+ [ :galaxies_tab , 'Galaxies' , '/galaxies/elliptical_galaxies' , true , true ],
10
+ [ :elliptical_galaxies_subtab , 'Elliptical Galaxies' , '/galaxies/elliptical_galaxies' , true , true ],
11
+ [ :spiral_galaxies_subtab , 'Spiral Galaxies' , '/galaxies/spiral_galaxies' , true , true ],
12
+ [ :lenticular_galaxies_subtab , 'Lenticular Galaxies' , '/galaxies/lenticular_galaxies' , true , true ],
13
+ [ :planets_tab , 'Planets' , '/exoplanets' , true , true ],
14
+ [ :exoplanets_subtab , 'Exoplanets' , '/exoplanets' , true , true ],
15
+ [ :rogue_planets_subtab , 'Rogue Planets' , '/rogue_planets' , true , true ],
16
+ [ :stars_tab , 'Stars' , '/stars' , true , true ],
17
+ [ :hidden_tab , 'Hidden' , '/hidden/always_visible' , lambda { request.path =~ /(hidden|galaxies)/ } , true ],
18
+ [ :always_visible_subtab , 'Always Visible' , '/hidden/always_visible' , true , true ],
19
+ [ :always_hidden_subtab , 'Always Hidden' , '/hidden/always_hidden' , false , true ],
20
+ [ :disabled_tab , 'Disabled' , '/disabled/always_enabled' , true , lambda { request.path =~ /(disabled|stars)/ } ],
21
+ [ :always_enabled_subtab , 'Always Enabled' , '/disabled/always_enabled' , true , true ],
22
+ [ :always_disabled_subtab , 'Always Disabled' , '/disabled/always_disabled' , true , false ],
23
+ #----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------#
24
+ # TAB NAME | DISPLAY TEXT | PATH | VISIBLE? | ENABLED? #
25
+ #----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------#
26
+ ]
27
+ end
28
+
29
+ config.actions do
30
+ [
31
+ #-----------------------------------------------------------------------------------------#
32
+ # CONTROLLER | ACTION | TAB #
33
+ #-----------------------------------------------------------------------------------------#
34
+ [ :home , :all_actions , :home_tab ],
35
+ [ :elliptical_galaxies , :all_actions , :elliptical_galaxies_subtab ],
36
+ [ :spiral_galaxies , :all_actions , :spiral_galaxies_subtab ],
37
+ [ :lenticular_galaxies , :all_actions , :lenticular_galaxies_subtab ],
38
+ [ :exoplanets , :all_actions , :exoplanets_subtab ],
39
+ [ :rogue_planets , :all_actions , :rogue_planets_subtab ],
40
+ [ :stars , :all_actions , :stars_tab ],
41
+ [ :misc , :always_visible , :always_visible_subtab ],
42
+ [ :misc , :always_hidden , :always_hidden_subtab ],
43
+ [ :misc , :always_enabled , :always_enabled_subtab ],
44
+ [ :misc , :always_disabled , :always_disabled_subtab ],
45
+ #-----------------------------------------------------------------------------------------#
46
+ # CONTROLLER | ACTION | TAB #
47
+ #-----------------------------------------------------------------------------------------#
48
+ ]
49
+ end
50
+
51
+ config.css.scaffolding = true
52
+ config.css.background_color = '#cec'
53
+ config.css.text_color = '#464'
54
+ config.css.active_tab_color = '#fff'
55
+ config.css.hover_tab_color = '#dfd'
56
+ config.css.inactive_tab_color = '#aca'
57
+ config.css.inactive_text_color = '#8a8'
58
+
59
+ end