bettertabs 1.2.3 → 1.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (78) hide show
  1. data/.gitignore +1 -0
  2. data/.rspec +1 -0
  3. data/Gemfile +11 -1
  4. data/Gemfile.lock +106 -1
  5. data/MIT-LICENSE +20 -0
  6. data/README.md +35 -30
  7. data/Rakefile +16 -2
  8. data/{lib/bettertabs → app/assets}/javascripts/jquery.bettertabs.js +0 -0
  9. data/{lib/bettertabs/javascripts/jquery.bettertabs.coffee → app/assets/javascripts/jquery.bettertabs.js.coffee} +0 -0
  10. data/{lib/bettertabs → app/assets}/javascripts/jquery.bettertabs.min.js +0 -0
  11. data/{lib/bettertabs → app/helpers}/bettertabs_helper.rb +0 -0
  12. data/bettertabs.gemspec +12 -5
  13. data/{CHANGELOG → doc/CHANGELOG.md} +0 -0
  14. data/{EXAMPLES.md → doc/EXAMPLES.md} +0 -0
  15. data/{lib/bettertabs/javascripts/README.md → doc/JAVASCRIPTS-DEV-GUIDE.md} +0 -0
  16. data/{lib/bettertabs/stylesheets/README.md → doc/STYLESHEETS-GUIDE.md} +0 -0
  17. data/lib/bettertabs/engine.rb +6 -0
  18. data/lib/bettertabs/version.rb +2 -2
  19. data/lib/bettertabs.rb +2 -7
  20. data/script/rails +6 -0
  21. data/{test/ruby_1_9/rails_3_0 → spec/dummy}/Rakefile +2 -2
  22. data/spec/dummy/app/assets/javascripts/application.js +10 -0
  23. data/spec/dummy/app/assets/stylesheets/application.css +15 -0
  24. data/{test/ruby_1_9/rails_3_0/public → spec/dummy/app/assets}/stylesheets/bettertabs.css +0 -0
  25. data/{test/ruby_1_9/rails_3_0 → spec/dummy}/app/controllers/application_controller.rb +0 -0
  26. data/{test/ruby_1_9/rails_3_0 → spec/dummy}/app/controllers/bettertabs_controller.rb +0 -0
  27. data/{test/ruby_1_9/rails_3_0/public/favicon.ico → spec/dummy/app/mailers/.gitkeep} +0 -0
  28. data/spec/dummy/app/models/.gitkeep +0 -0
  29. data/{test/ruby_1_9/rails_3_0 → spec/dummy}/app/views/bettertabs/_ajax.html.haml +0 -0
  30. data/{test/ruby_1_9/rails_3_0 → spec/dummy}/app/views/bettertabs/_link.html.haml +0 -0
  31. data/{test/ruby_1_9/rails_3_0 → spec/dummy}/app/views/bettertabs/_mixed.html.haml +0 -0
  32. data/{test/ruby_1_9/rails_3_0 → spec/dummy}/app/views/bettertabs/_tab_content.html.haml +0 -0
  33. data/{test/ruby_1_9/rails_3_0 → spec/dummy}/app/views/bettertabs/ajax.html.haml +0 -0
  34. data/{test/ruby_1_9/rails_3_0 → spec/dummy}/app/views/bettertabs/link_tab_1.html.haml +0 -0
  35. data/{test/ruby_1_9/rails_3_0 → spec/dummy}/app/views/bettertabs/link_tab_2.html.haml +0 -0
  36. data/{test/ruby_1_9/rails_3_0 → spec/dummy}/app/views/bettertabs/mixed.html.haml +0 -0
  37. data/{test/ruby_1_9/rails_3_0 → spec/dummy}/app/views/bettertabs/mixed_with_erb.html.erb +0 -0
  38. data/{test/ruby_1_9/rails_3_0 → spec/dummy}/app/views/bettertabs/static.html.haml +0 -0
  39. data/{test/ruby_1_9/rails_3_0 → spec/dummy}/app/views/layouts/application.html.erb +4 -4
  40. data/{test/ruby_1_9/rails_3_0 → spec/dummy}/config/application.rb +14 -7
  41. data/spec/dummy/config/boot.rb +10 -0
  42. data/{test/ruby_1_9/rails_3_0 → spec/dummy}/config/environment.rb +1 -1
  43. data/{test/ruby_1_9/rails_3_0 → spec/dummy}/config/environments/development.rb +8 -4
  44. data/spec/dummy/config/environments/production.rb +60 -0
  45. data/{test/ruby_1_9/rails_3_0 → spec/dummy}/config/environments/test.rb +9 -2
  46. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  47. data/spec/dummy/config/initializers/inflections.rb +10 -0
  48. data/{test/ruby_1_9/rails_3_0 → spec/dummy}/config/initializers/mime_types.rb +0 -0
  49. data/{test/ruby_1_9/rails_3_0 → spec/dummy}/config/initializers/secret_token.rb +1 -1
  50. data/{test/ruby_1_9/rails_3_0 → spec/dummy}/config/initializers/session_store.rb +2 -2
  51. data/spec/dummy/config/initializers/wrap_parameters.rb +9 -0
  52. data/spec/dummy/config/locales/en.yml +5 -0
  53. data/{test/ruby_1_9/rails_3_0 → spec/dummy}/config/routes.rb +1 -2
  54. data/{test/ruby_1_9/rails_3_0 → spec/dummy}/config.ru +1 -1
  55. data/spec/dummy/lib/assets/.gitkeep +0 -0
  56. data/{test/ruby_1_9/rails_3_0 → spec/dummy}/public/404.html +0 -0
  57. data/{test/ruby_1_9/rails_3_0 → spec/dummy}/public/422.html +0 -0
  58. data/{test/ruby_1_9/rails_3_0 → spec/dummy}/public/500.html +0 -0
  59. data/spec/dummy/public/favicon.ico +0 -0
  60. data/{test/ruby_1_9/rails_3_0 → spec/dummy}/script/rails +0 -0
  61. data/{test/ruby_1_9/rails_3_0/spec → spec}/requests/bettertabs_spec.rb +0 -0
  62. data/spec/spec_helper.rb +16 -0
  63. metadata +132 -84
  64. data/test/README_for_TEST.txt +0 -5
  65. data/test/ruby_1_9/rails_3_0/.rspec +0 -1
  66. data/test/ruby_1_9/rails_3_0/.rvmc +0 -1
  67. data/test/ruby_1_9/rails_3_0/Gemfile +0 -13
  68. data/test/ruby_1_9/rails_3_0/Gemfile.lock +0 -108
  69. data/test/ruby_1_9/rails_3_0/README +0 -3
  70. data/test/ruby_1_9/rails_3_0/app/helpers/application_helper.rb +0 -2
  71. data/test/ruby_1_9/rails_3_0/config/boot.rb +0 -6
  72. data/test/ruby_1_9/rails_3_0/public/images/rails.png +0 -0
  73. data/test/ruby_1_9/rails_3_0/public/javascripts/jquery-1.3.min.js +0 -19
  74. data/test/ruby_1_9/rails_3_0/public/javascripts/jquery.bettertabs.js +0 -81
  75. data/test/ruby_1_9/rails_3_0/public/javascripts/rails.js +0 -278
  76. data/test/ruby_1_9/rails_3_0/public/robots.txt +0 -5
  77. data/test/ruby_1_9/rails_3_0/public/stylesheets/layout.css +0 -8
  78. data/test/ruby_1_9/rails_3_0/spec/spec_helper.rb +0 -19
data/.gitignore CHANGED
@@ -3,3 +3,4 @@ pkg/*
3
3
  .bundle
4
4
  log
5
5
  tmp
6
+ spec/dummy/public/assets/*
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --color
data/Gemfile CHANGED
@@ -1,4 +1,14 @@
1
1
  source "http://rubygems.org"
2
2
 
3
- # Specify your gem's dependencies in bettertabs.gemspec
3
+ # Declare your gem's dependencies in engine-test.gemspec.
4
+ # Bundler will treat runtime dependencies like base dependencies, and
5
+ # development dependencies will be added by default to the :development group.
4
6
  gemspec
7
+
8
+ # Declare any dependencies that are still in development here instead of in
9
+ # your gemspec. These might include edge Rails or gems from your path or
10
+ # Git. Remember to move these dependencies to your gemspec before releasing
11
+ # your gem to rubygems.org.
12
+
13
+ # To use debugger
14
+ # gem 'ruby-debug19', :require => 'ruby-debug'
data/Gemfile.lock CHANGED
@@ -1,14 +1,119 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- bettertabs (1.2.1)
4
+ bettertabs (1.3)
5
+ jquery-rails
6
+ rails (~> 3.1.0)
5
7
 
6
8
  GEM
7
9
  remote: http://rubygems.org/
8
10
  specs:
11
+ actionmailer (3.1.0)
12
+ actionpack (= 3.1.0)
13
+ mail (~> 2.3.0)
14
+ actionpack (3.1.0)
15
+ activemodel (= 3.1.0)
16
+ activesupport (= 3.1.0)
17
+ builder (~> 3.0.0)
18
+ erubis (~> 2.7.0)
19
+ i18n (~> 0.6)
20
+ rack (~> 1.3.2)
21
+ rack-cache (~> 1.0.3)
22
+ rack-mount (~> 0.8.2)
23
+ rack-test (~> 0.6.1)
24
+ sprockets (~> 2.0.0)
25
+ activemodel (3.1.0)
26
+ activesupport (= 3.1.0)
27
+ bcrypt-ruby (~> 3.0.0)
28
+ builder (~> 3.0.0)
29
+ i18n (~> 0.6)
30
+ activerecord (3.1.0)
31
+ activemodel (= 3.1.0)
32
+ activesupport (= 3.1.0)
33
+ arel (~> 2.2.1)
34
+ tzinfo (~> 0.3.29)
35
+ activeresource (3.1.0)
36
+ activemodel (= 3.1.0)
37
+ activesupport (= 3.1.0)
38
+ activesupport (3.1.0)
39
+ multi_json (~> 1.0)
40
+ arel (2.2.1)
41
+ bcrypt-ruby (3.0.0)
42
+ builder (3.0.0)
43
+ diff-lcs (1.1.3)
44
+ erubis (2.7.0)
45
+ haml (3.1.3)
46
+ haml-rails (0.3.4)
47
+ actionpack (~> 3.0)
48
+ activesupport (~> 3.0)
49
+ haml (~> 3.0)
50
+ railties (~> 3.0)
51
+ hike (1.2.1)
52
+ i18n (0.6.0)
53
+ jquery-rails (1.0.14)
54
+ railties (~> 3.0)
55
+ thor (~> 0.14)
56
+ mail (2.3.0)
57
+ i18n (>= 0.4.0)
58
+ mime-types (~> 1.16)
59
+ treetop (~> 1.4.8)
60
+ mime-types (1.16)
61
+ multi_json (1.0.3)
62
+ polyglot (0.3.2)
63
+ rack (1.3.2)
64
+ rack-cache (1.0.3)
65
+ rack (>= 0.4)
66
+ rack-mount (0.8.3)
67
+ rack (>= 1.0.0)
68
+ rack-ssl (1.3.2)
69
+ rack
70
+ rack-test (0.6.1)
71
+ rack (>= 1.0)
72
+ rails (3.1.0)
73
+ actionmailer (= 3.1.0)
74
+ actionpack (= 3.1.0)
75
+ activerecord (= 3.1.0)
76
+ activeresource (= 3.1.0)
77
+ activesupport (= 3.1.0)
78
+ bundler (~> 1.0)
79
+ railties (= 3.1.0)
80
+ railties (3.1.0)
81
+ actionpack (= 3.1.0)
82
+ activesupport (= 3.1.0)
83
+ rack-ssl (~> 1.3.2)
84
+ rake (>= 0.8.7)
85
+ rdoc (~> 3.4)
86
+ thor (~> 0.14.6)
87
+ rake (0.9.2)
88
+ rdoc (3.9.4)
89
+ rspec (2.6.0)
90
+ rspec-core (~> 2.6.0)
91
+ rspec-expectations (~> 2.6.0)
92
+ rspec-mocks (~> 2.6.0)
93
+ rspec-core (2.6.4)
94
+ rspec-expectations (2.6.0)
95
+ diff-lcs (~> 1.1.2)
96
+ rspec-mocks (2.6.0)
97
+ rspec-rails (2.6.1)
98
+ actionpack (~> 3.0)
99
+ activesupport (~> 3.0)
100
+ railties (~> 3.0)
101
+ rspec (~> 2.6.0)
102
+ sprockets (2.0.0)
103
+ hike (~> 1.2)
104
+ rack (~> 1.0)
105
+ tilt (~> 1.1, != 1.3.0)
106
+ thor (0.14.6)
107
+ tilt (1.3.3)
108
+ treetop (1.4.10)
109
+ polyglot
110
+ polyglot (>= 0.3.1)
111
+ tzinfo (0.3.29)
9
112
 
10
113
  PLATFORMS
11
114
  ruby
12
115
 
13
116
  DEPENDENCIES
14
117
  bettertabs!
118
+ haml-rails
119
+ rspec-rails
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright 2011 Mario Izquierdo
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md CHANGED
@@ -3,31 +3,32 @@ Bettertabs for Rails
3
3
 
4
4
  We know that splitting content into several tabs is easy, but doing well, clean, DRY, accessible, usable, fast and testable is not so simple after all.
5
5
 
6
- Bettertabs is a helper for Rails that renders the markup for a tabbed area in a easy and declarative way, forcing you to keep things simple and ensuring accessibility and usability, no matter if the content is loaded statically or via ajax.
6
+ Bettertabs is a simple engine for Rails that includes a helper and a jquery plugin to render the needed markup and javascript for a section with tabs in a easy and declarative way, forcing you to keep things simple and ensuring accessibility and usability, no matter if the content is loaded statically or via ajax.
7
7
 
8
8
  Easy for beginners, complete for experts.
9
9
 
10
10
 
11
11
  ## Features ##
12
12
 
13
- * Rails helper to easily generate tabs and content markup
14
- * Provides a jQuery plugin to handle the JavaScript behavior
15
- * Simplicity: Easy to install and easy to use
13
+ * Rails 3.1 Engine that includes:
14
+ * helper to easily generate tabs and content markup
15
+ * jQuery plugin to handle the JavaScript behavior
16
+ * Simplicity: Easy to install, easy to use, easy to update
16
17
  * Flexible and customizable
17
18
  * Forces you to DRY-up your views for your tabbed content
18
- * Forces you to make it awesome accessible and usable:
19
+ * Forces you to make it very accessible and usable:
19
20
  * Designed to work with and without JavaScript
20
21
  * When click on a tab, the address bar url is changed (only in HTML5 browsers), so:
21
22
  * The browser's back and reload buttons will still work as expected
22
23
  * All tabbed sections can be permalinked, keeping the selected tab
23
- * Makes testing views simple. Because its easy to make it works without javascript, you can assert view components with the rails built-in functional and integration tests
24
- * The CSS styles are up to you
24
+ * Makes testing views simple. Because its easy to make it working without javascript, you can test view components with the rails built-in functional and integration tests
25
+ * The CSS styles are up to you, although we include some [reference CSS](https://github.com/agoragames/bettertabs/blob/master/doc/STYLESHEETS-GUIDE.md) to start with
25
26
 
26
27
 
27
28
  ## Requirements: ##
28
29
  * Ruby 1.9.2
29
- * Rails 3
30
- * [jQuery](http://jquery.com/) 1.3 or higher, in order to use the [Bettertabs jQuery plugin](https://github.com/agoragames/bettertabs/raw/master/lib/bettertabs/javascripts/jquery.bettertabs.min.js)
30
+ * Rails 3.1
31
+ * [jquery-ujs](https://github.com/rails/jquery-ujs) with jQuery 1.3 or higher
31
32
 
32
33
  Anyway you can use bettertabs without javascript (or use your own javascript handler) since the bettertabs helper only generates the appropriate markup.
33
34
 
@@ -37,14 +38,18 @@ Anyway you can use bettertabs without javascript (or use your own javascript han
37
38
  Gem dependency. Add bettertabs to your gem file and run `bundle install`.
38
39
 
39
40
  gem 'bettertabs'
40
-
41
41
 
42
- Download the [bettertabs.jquery.min plugin](https://github.com/agoragames/bettertabs/raw/master/lib/bettertabs/javascripts/jquery.bettertabs.min.js) (or the [uncompressed version](https://github.com/agoragames/bettertabs/raw/master/lib/bettertabs/javascripts/jquery.bettertabs.js)), put it in your `public/javascripts` folder and include it in your layout after the jQuery library, for example:
42
+ To include the [jquery.bettertabs plugin](https://github.com/agoragames/bettertabs/raw/master/app/assets/javascripts/jquery.bettertabs.js.coffee)
43
+ add these line to the top of your `app/assets/javascripts/application.js` file:
43
44
 
44
- <%= javascript_include_tag 'jquery', 'rails', 'jquery.bettertabs.min' %>
45
+ //= require jquery.bettertabs
46
+
47
+ Or if you prefer the compressed version:
48
+
49
+ //= require jquery.bettertabs.min
50
+
51
+ This works the same way as [jquery-ujs](https://github.com/rails/jquery-ujs); you don't need to copy-paste the javascript code in your app because it will be served using the Asset Pipeline.
45
52
 
46
- Now you can use the `bettertabs` helper as in the examples below.
47
-
48
53
 
49
54
  ## Usage and examples ##
50
55
 
@@ -64,15 +69,15 @@ An usage example should be self explanatory (using HAML, but it also works with
64
69
  = tab.ajax :friends, :partial => 'shared/friends'
65
70
 
66
71
  = tab.link :groups do
67
- = render :partial => 'groups/user_groups', :locals => {user => @user}
72
+ = render :partial => 'groups/user_groups', :locals => { :user => @user }
68
73
 
69
74
  ### More examples and documentation: ###
70
75
 
71
- * [EXAMPLES document](https://github.com/agoragames/bettertabs/blob/master/EXAMPLES.md)
72
- * [Bettertabs Styles reference guide](https://github.com/agoragames/bettertabs/blob/master/lib/bettertabs/stylesheets/README.md)
73
- * [Bettertabs helper](https://github.com/agoragames/bettertabs/blob/master/lib/bettertabs/bettertabs_helper.rb) (params and options)
74
- * [Rails3 test demo application](https://github.com/agoragames/bettertabs/tree/master/test/ruby_1_9/rails_3_0)
75
- * Anyway, don't be afraid of digging into the code, it's very straightforward.
76
+ * [EXAMPLES document](https://github.com/agoragames/bettertabs/blob/master/doc/EXAMPLES.md)
77
+ * [Bettertabs Styles reference guide](https://github.com/agoragames/bettertabs/blob/master/doc/STYLESHEETS-GUIDE.md)
78
+ * [Bettertabs helper](https://github.com/agoragames/bettertabs/blob/master/app/helpers/bettertabs_helper.rb) (params and options)
79
+ * [Rails3 test demo application](https://github.com/agoragames/bettertabs/tree/master/spec/dummy)
80
+ * Anyway, don't be afraid and dig into the code!
76
81
 
77
82
 
78
83
  ## Tabs Routes ##
@@ -106,19 +111,19 @@ So now the tabs links will point to the following URLs:
106
111
  * :friends tab href: `/profile/dude/friends`
107
112
 
108
113
 
109
- ## JavaScript with the jquery.bettertabs plugin ##
114
+ ## JavaScript with the jquery.bettertabs plugin #
110
115
 
111
- Installing the `bettertabs` gem in a rails project makes the bettertabs helper instantly available. This helper will generate markup that is prepared to be modified by JavaScript, and also includes an inline script at the bottom:
116
+ The bettertabs helper will generate the needed markup that has an inline script at the bottom:
112
117
 
113
118
  jQuery(function($){ $('#bettertabs_id').bettertabs(); });
114
119
 
115
- Which expects jQuery and jquery.bettertabs plugin to be loaded.
120
+ Which expects jQuery and jquery.bettertabs plugin to be present.
116
121
 
117
- The jquery.bettertabs plugin can be downloaded directly from the github repo:
122
+ You can see the jquery.bettertabs source code in the github repo:
118
123
 
119
- * [CoffeeScript version](https://github.com/agoragames/bettertabs/raw/master/lib/bettertabs/javascripts/jquery.bettertabs.coffee)
120
- * [JavaScript (generated by coffee) version](https://github.com/agoragames/bettertabs/raw/master/lib/bettertabs/javascripts/jquery.bettertabs.js)
121
- * [Compressed JavaScript](https://github.com/agoragames/bettertabs/raw/master/lib/bettertabs/javascripts/jquery.bettertabs.min.js)
124
+ * [CoffeeScript version](https://github.com/agoragames/bettertabs/raw/master/app/assets/javascripts/jquery.bettertabs.js.coffee)
125
+ * [JavaScript (generated by coffee) version](https://github.com/agoragames/bettertabs/raw/master/app/assets/javascripts/jquery.bettertabs.js)
126
+ * [Compressed JavaScript](https://github.com/agoragames/bettertabs/raw/master/app/assets/javascripts/jquery.bettertabs.min.js)
122
127
 
123
128
  The plugin defines one single jQuery method `jQuery(selector).bettertabs();` that is applied to the generated markup.
124
129
 
@@ -144,7 +149,7 @@ You can interact with the bettertabs widget in the following ways:
144
149
 
145
150
  * **Activate a tab**: use the function `jQuery.Bettertabs.select_tab(bettertabsid, tabid);`, for the previous example could be *jQuery.Bettertabs.select_tab('profile_tabs', 'friends');*. You can also just simulate a click on the tab link with `jQuery('#tabid_bettertabsid_tab a').click();`
146
151
  * **Hook some behavior when a tab is clicked**: attach a 'click' handler to the tab link or use any of the provided custom events.
147
- * **Show a loading clock while ajax is loading**: or any other kind of feedback to the user, use any of the provided custom events. You can also handle it styling the CSS class `.ajax-loading` that is added to the ajax tab link while ajax content is loading (see the [Styles Reference Guide](https://github.com/agoragames/bettertabs/blob/master/lib/bettertabs/stylesheets/README.md))
152
+ * **Show a loading clock while ajax is loading**: or any other kind of feedback to the user, use any of the provided custom events. You can also handle it styling the CSS class `.ajax-loading` that is added to the ajax tab link while ajax content is loading (see the [Styles Reference Guide](https://github.com/agoragames/bettertabs/blob/master/doc/STYLESHEETS-GUIDE.md))
148
153
  * **Change the browser URL**: in the same way the plugin does when a tab is clicked, use `jQuery.Bettertabs.change_browser_url(new_url);`
149
154
 
150
155
  Custom events that are attached to each tab content:
@@ -179,7 +184,7 @@ Perhaps the most important CSS rule here is to define `display: none;` for `div.
179
184
 
180
185
  div.bettertabs div.content.hidden { display: none; }
181
186
 
182
- Use the [Bettertabs Styles Reference Guide](https://github.com/agoragames/bettertabs/blob/master/lib/bettertabs/stylesheets/README.md) to get a stylesheet that you can use as a starting point.
187
+ Use the [Bettertabs Styles Reference Guide](https://github.com/agoragames/bettertabs/blob/master/doc/STYLESHEETS-GUIDE.md) to get a stylesheet that you can use as a starting point.
183
188
 
184
189
 
185
190
  ## How to help make Bettertabs even Better ##
@@ -194,6 +199,6 @@ Use the [Bettertabs Styles Reference Guide](https://github.com/agoragames/better
194
199
 
195
200
  ## Future work ##
196
201
 
197
- * Improve the Rails testing application: it should use rspec and capybabra to test even the javascript (http://media.railscasts.com/videos/257_request_specs_and_capybara.mov)
198
202
  * Try to make it compatible with ruby 1.8.x
203
+ * Improve tests to check the JavaScript code (Jasmine, Evergreen, Capybara, whatever)
199
204
 
data/Rakefile CHANGED
@@ -1,2 +1,16 @@
1
- require 'bundler'
2
- Bundler::GemHelper.install_tasks
1
+ #!/usr/bin/env rake
2
+ begin
3
+ require 'bundler/setup'
4
+ rescue LoadError
5
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
6
+ end
7
+
8
+ APP_RAKEFILE = File.expand_path("../spec/dummy/Rakefile", __FILE__)
9
+
10
+ load 'rails/tasks/engine.rake'
11
+
12
+ require 'rspec/core/rake_task'
13
+ RSpec::Core::RakeTask.new(:spec)
14
+ task :default => :spec
15
+
16
+ Bundler::GemHelper.install_tasks
data/bettertabs.gemspec CHANGED
@@ -1,17 +1,24 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
  $:.push File.expand_path("../lib", __FILE__)
3
+
4
+ # Maintain your gem's version:
3
5
  require "bettertabs/version"
4
6
 
7
+ # Describe your gem and declare its dependencies:
5
8
  Gem::Specification.new do |s|
6
9
  s.name = "bettertabs"
7
10
  s.version = Bettertabs::VERSION
8
- s.platform = Gem::Platform::RUBY
9
11
  s.authors = ["Mario Izquierdo"]
10
12
  s.email = ["tothemario@gmail.com"]
11
13
  s.homepage = "https://github.com/agoragames/bettertabs"
12
- s.summary = %q{The better (simple, accessible, usable, flexible and fast) way to split content in tabs for Rails.}
13
- s.description = %q{Bettertabs Rails helper (and jQuery plugin) defines the markup for a tabbed area in a easy and declarative way, using the appropiate JavaScript but ensuring accessibility and usability, no matter if the content is loaded statically, via ajax or the tabs are links. In the other hand, the CSS styles are up to you. }
14
+ s.summary = %q{Just a simple, accessible, usable, flexible and fast way to split view content in tabs in a rails application.}
15
+ s.description = %q{Bettertabs is a Rails 3.1 engine that adds a helper and jQuery plugin to define the markup and behavior for a tabbed area in a easy and declarative way, using the appropiate JavaScript but ensuring accessibility and usability, no matter if the content is loaded statically, via ajax or just with links. }
14
16
 
15
- s.files = `git ls-files`.split("\n")
16
- s.require_paths = ["lib"]
17
+ s.files = `git ls-files`.split("\n")
18
+
19
+ s.add_dependency "rails", "~> 3.1.0"
20
+ s.add_dependency "jquery-rails"
21
+
22
+ s.add_development_dependency 'rspec-rails'
23
+ s.add_development_dependency 'haml-rails'
17
24
  end
File without changes
File without changes
@@ -0,0 +1,6 @@
1
+ require 'rails'
2
+
3
+ module Bettertabs
4
+ class Engine < Rails::Engine
5
+ end
6
+ end
@@ -1,3 +1,3 @@
1
1
  module Bettertabs
2
- VERSION = "1.2.3"
3
- end
2
+ VERSION = "1.3"
3
+ end
data/lib/bettertabs.rb CHANGED
@@ -1,7 +1,2 @@
1
- require 'bettertabs/bettertabs_builder'
2
- require 'bettertabs/bettertabs_helper'
3
-
4
- # Include bettertabs in the Application
5
- module ApplicationHelper
6
- include BettertabsHelper
7
- end
1
+ require 'bettertabs/engine'
2
+ require 'bettertabs/bettertabs_builder'
data/script/rails ADDED
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+ #!/usr/bin/env ruby
3
+ # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
4
+
5
+ ENGINE_PATH = File.expand_path('../..', __FILE__)
6
+ load File.expand_path('../../spec/dummy/script/rails', __FILE__)
@@ -1,7 +1,7 @@
1
+ #!/usr/bin/env rake
1
2
  # Add your own tasks in files placed in lib/tasks ending in .rake,
2
3
  # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3
4
 
4
5
  require File.expand_path('../config/application', __FILE__)
5
- require 'rake'
6
6
 
7
- Rails30::Application.load_tasks
7
+ Dummy::Application.load_tasks
@@ -0,0 +1,10 @@
1
+ // This is a manifest file that'll be compiled into including all the files listed below.
2
+ // Add new JavaScript/Coffee code in separate files in this directory and they'll automatically
3
+ // be included in the compiled file accessible from http://example.com/assets/application.js
4
+ // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
5
+ // the compiled file.
6
+ //
7
+ //= require jquery
8
+ //= require jquery_ujs
9
+ //= require jquery.bettertabs
10
+ //= require_tree .
@@ -0,0 +1,15 @@
1
+ /*
2
+ * This is a manifest file that'll automatically include all the stylesheets available in this directory
3
+ * and any sub-directories. You're free to add application-wide styles to this file and they'll appear at
4
+ * the top of the compiled file, but it's generally better to create a new file per style scope.
5
+ *= require_self
6
+ *= require bettertabs
7
+ */
8
+ body {
9
+ background-color: white;
10
+ margin: 10px;
11
+ font-size: 12px;
12
+ font-family: Arial, Helvetica Neue, Helvetica, sans-serif;
13
+ }
14
+ div.nav { margin: 10px 0 20px 24px; padding: 0; }
15
+ div.nav a { padding: 0 5px 0 6px; }
File without changes
@@ -1,14 +1,14 @@
1
1
  <!DOCTYPE html>
2
2
  <html>
3
3
  <head>
4
- <title>Rails30</title>
5
- <%= stylesheet_link_tag 'layout', 'bettertabs' %>
6
- <%= javascript_include_tag 'jquery-1.3.min', 'rails', 'jquery.bettertabs' %>
4
+ <title>Dummy</title>
5
+ <%= stylesheet_link_tag "application" %>
6
+ <%= javascript_include_tag "application" %>
7
7
  <%= csrf_meta_tag %>
8
8
  </head>
9
9
  <body>
10
10
 
11
- <h1>Bettertabs Demo</h1>
11
+ <h1>Bettertabs Dummy App</h1>
12
12
  <div class="nav">
13
13
  <%= link_to 'static', { action: 'static'}, title: 'Using only static tabs' %> |
14
14
  <%= link_to 'link', { action: 'link_tab_1'}, title: 'Using only link tabs' %> |
@@ -6,12 +6,15 @@ require "action_controller/railtie"
6
6
  require "action_mailer/railtie"
7
7
  require "active_resource/railtie"
8
8
  require "rails/test_unit/railtie"
9
+ require "sprockets/railtie"
9
10
 
10
- # If you have a Gemfile, require the gems listed there, including any gems
11
- # you've limited to :test, :development, or :production.
12
- Bundler.require(:default, Rails.env) if defined?(Bundler)
11
+ # Auto-require default libraries and those for the current Rails environment.
12
+ Bundler.require :default, Rails.env
13
13
 
14
- module Rails30
14
+ require "bettertabs"
15
+ require "jquery-rails"
16
+
17
+ module Dummy
15
18
  class Application < Rails::Application
16
19
  # Settings in config/environments/* take precedence over those specified here.
17
20
  # Application configuration should go into files in config/initializers
@@ -35,13 +38,17 @@ module Rails30
35
38
  # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
36
39
  # config.i18n.default_locale = :de
37
40
 
38
- # JavaScript files you want as :defaults (application.js is always included).
39
- config.action_view.javascript_expansions[:defaults] = %w()
40
-
41
41
  # Configure the default encoding used in templates for Ruby 1.9.
42
42
  config.encoding = "utf-8"
43
43
 
44
44
  # Configure sensitive parameters which will be filtered from the log file.
45
45
  config.filter_parameters += [:password]
46
+
47
+ # Enable the asset pipeline
48
+ config.assets.enabled = true
49
+
50
+ # Version of your assets, change this if you want to expire all your assets
51
+ config.assets.version = '1.0'
46
52
  end
47
53
  end
54
+
@@ -0,0 +1,10 @@
1
+ require 'rubygems'
2
+ gemfile = File.expand_path('../../../../Gemfile', __FILE__)
3
+
4
+ if File.exist?(gemfile)
5
+ ENV['BUNDLE_GEMFILE'] = gemfile
6
+ require 'bundler'
7
+ Bundler.setup
8
+ end
9
+
10
+ $:.unshift File.expand_path('../../../../lib', __FILE__)
@@ -2,4 +2,4 @@
2
2
  require File.expand_path('../application', __FILE__)
3
3
 
4
4
  # Initialize the rails application
5
- Rails30::Application.initialize!
5
+ Dummy::Application.initialize!
@@ -1,9 +1,9 @@
1
- Rails30::Application.configure do
1
+ Dummy::Application.configure do
2
2
  # Settings specified here will take precedence over those in config/application.rb
3
3
 
4
4
  # In the development environment your application's code is reloaded on
5
5
  # every request. This slows down response time but is perfect for development
6
- # since you don't have to restart the webserver when you make code changes.
6
+ # since you don't have to restart the web server when you make code changes.
7
7
  config.cache_classes = false
8
8
 
9
9
  # Log error messages when you accidentally call methods on nil.
@@ -11,7 +11,6 @@ Rails30::Application.configure do
11
11
 
12
12
  # Show full error reports and disable caching
13
13
  config.consider_all_requests_local = true
14
- config.action_view.debug_rjs = true
15
14
  config.action_controller.perform_caching = false
16
15
 
17
16
  # Don't care if the mailer can't send
@@ -22,5 +21,10 @@ Rails30::Application.configure do
22
21
 
23
22
  # Only use best-standards-support built into browsers
24
23
  config.action_dispatch.best_standards_support = :builtin
25
- end
26
24
 
25
+ # Do not compress assets
26
+ config.assets.compress = false
27
+
28
+ # Expands the lines which load the assets
29
+ config.assets.debug = true
30
+ end