bettertabs 1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (60) hide show
  1. data/.gitignore +5 -0
  2. data/Gemfile +4 -0
  3. data/Gemfile.lock +14 -0
  4. data/README.md +288 -0
  5. data/Rakefile +2 -0
  6. data/bettertabs.gemspec +19 -0
  7. data/lib/bettertabs.rb +7 -0
  8. data/lib/bettertabs/bettertabs_builder.rb +162 -0
  9. data/lib/bettertabs/bettertabs_helper.rb +16 -0
  10. data/lib/bettertabs/javascripts/README.md +38 -0
  11. data/lib/bettertabs/javascripts/jquery.bettertabs.coffee +77 -0
  12. data/lib/bettertabs/javascripts/jquery.bettertabs.js +81 -0
  13. data/lib/bettertabs/javascripts/jquery.bettertabs.min.js +4 -0
  14. data/lib/bettertabs/version.rb +3 -0
  15. data/test/README_for_TEST.txt +5 -0
  16. data/test/ruby_1_9/rails_3_0/.rspec +1 -0
  17. data/test/ruby_1_9/rails_3_0/.rvmc +1 -0
  18. data/test/ruby_1_9/rails_3_0/Gemfile +11 -0
  19. data/test/ruby_1_9/rails_3_0/Gemfile.lock +105 -0
  20. data/test/ruby_1_9/rails_3_0/README +3 -0
  21. data/test/ruby_1_9/rails_3_0/Rakefile +7 -0
  22. data/test/ruby_1_9/rails_3_0/app/controllers/application_controller.rb +3 -0
  23. data/test/ruby_1_9/rails_3_0/app/controllers/bettertabs_controller.rb +24 -0
  24. data/test/ruby_1_9/rails_3_0/app/helpers/application_helper.rb +2 -0
  25. data/test/ruby_1_9/rails_3_0/app/views/bettertabs/_ajax.html.haml +6 -0
  26. data/test/ruby_1_9/rails_3_0/app/views/bettertabs/_link.html.haml +4 -0
  27. data/test/ruby_1_9/rails_3_0/app/views/bettertabs/_mixed.html.haml +6 -0
  28. data/test/ruby_1_9/rails_3_0/app/views/bettertabs/_tab_content.html.haml +1 -0
  29. data/test/ruby_1_9/rails_3_0/app/views/bettertabs/ajax.html.haml +2 -0
  30. data/test/ruby_1_9/rails_3_0/app/views/bettertabs/link_tab_1.html.haml +2 -0
  31. data/test/ruby_1_9/rails_3_0/app/views/bettertabs/link_tab_2.html.haml +2 -0
  32. data/test/ruby_1_9/rails_3_0/app/views/bettertabs/mixed.html.haml +2 -0
  33. data/test/ruby_1_9/rails_3_0/app/views/bettertabs/mixed_with_erb.html.erb +8 -0
  34. data/test/ruby_1_9/rails_3_0/app/views/bettertabs/static.html.haml +7 -0
  35. data/test/ruby_1_9/rails_3_0/app/views/layouts/application.html.erb +23 -0
  36. data/test/ruby_1_9/rails_3_0/config.ru +4 -0
  37. data/test/ruby_1_9/rails_3_0/config/application.rb +47 -0
  38. data/test/ruby_1_9/rails_3_0/config/boot.rb +6 -0
  39. data/test/ruby_1_9/rails_3_0/config/environment.rb +5 -0
  40. data/test/ruby_1_9/rails_3_0/config/environments/development.rb +26 -0
  41. data/test/ruby_1_9/rails_3_0/config/environments/test.rb +35 -0
  42. data/test/ruby_1_9/rails_3_0/config/initializers/mime_types.rb +5 -0
  43. data/test/ruby_1_9/rails_3_0/config/initializers/secret_token.rb +7 -0
  44. data/test/ruby_1_9/rails_3_0/config/initializers/session_store.rb +8 -0
  45. data/test/ruby_1_9/rails_3_0/config/routes.rb +6 -0
  46. data/test/ruby_1_9/rails_3_0/public/404.html +26 -0
  47. data/test/ruby_1_9/rails_3_0/public/422.html +26 -0
  48. data/test/ruby_1_9/rails_3_0/public/500.html +26 -0
  49. data/test/ruby_1_9/rails_3_0/public/favicon.ico +0 -0
  50. data/test/ruby_1_9/rails_3_0/public/images/rails.png +0 -0
  51. data/test/ruby_1_9/rails_3_0/public/javascripts/jquery-1.5.2.min.js +16 -0
  52. data/test/ruby_1_9/rails_3_0/public/javascripts/jquery.bettertabs.min.js +4 -0
  53. data/test/ruby_1_9/rails_3_0/public/javascripts/rails.js +278 -0
  54. data/test/ruby_1_9/rails_3_0/public/robots.txt +5 -0
  55. data/test/ruby_1_9/rails_3_0/public/stylesheets/bettertabs.css +23 -0
  56. data/test/ruby_1_9/rails_3_0/public/stylesheets/layout.css +8 -0
  57. data/test/ruby_1_9/rails_3_0/script/rails +6 -0
  58. data/test/ruby_1_9/rails_3_0/spec/requests/bettertabs_spec.rb +54 -0
  59. data/test/ruby_1_9/rails_3_0/spec/spec_helper.rb +19 -0
  60. metadata +122 -0
@@ -0,0 +1,16 @@
1
+ module BettertabsHelper
2
+
3
+ # Bettertabs helper
4
+ # Defines the bettertabs markup in the view.
5
+ def bettertabs(bettertabs_id, options={})
6
+ bettertabs_id = bettertabs_id.to_s
7
+ selected_tab_id = params[:"#{bettertabs_id}_selected_tab"] || options.delete(:selected_tab)
8
+ options[:class] = "bettertabs #{options[:class]}" # keep 'bettertabs' class even when the user adds more classes.
9
+ options[:id] ||= bettertabs_id
10
+ options[:render_only_active_content] = true if controller.request.xhr?
11
+ builder = BettertabsBuilder.new(bettertabs_id, self, selected_tab_id, options)
12
+ yield(builder)
13
+ builder.render
14
+ end
15
+
16
+ end
@@ -0,0 +1,38 @@
1
+ Bettertabs Javascript Development
2
+ =================================
3
+
4
+ Bettertabs rails helper depends on the jquery.bettertabs plugin to work properly with javascript.
5
+
6
+
7
+ ## CoffeeScript ##
8
+
9
+ The jquery.bettertabs plugin is written using CoffeeScript.
10
+ How to install CoffeeScript: http://jashkenas.github.com/coffee-script/#installation
11
+
12
+ To install, first make sure you have a working copy of the latest stable version of Node.js, and npm (the Node Package Manager).
13
+ You can then install CoffeeScript with npm:
14
+
15
+ npm install coffee-script
16
+
17
+
18
+ Then you will be able to compile `jquery.bettertabs.coffee` into `jquery.bettertabs.js` using the coffee command:
19
+
20
+ coffee --watch --compile jquery.bettertabs.coffee
21
+
22
+ With this, each time you save the `jquery.bettertabs.coffee` file, `jquery.bettertabs.js` will be automatically updated.
23
+
24
+
25
+ ## JavaScript Compressor ##
26
+
27
+ Before make a new release of the `jquery.bettertabs.js`, we have to be sure that an equivalent minified script is available.
28
+
29
+ You can use for example the [YUI compressor](http://developer.yahoo.com/yui/compressor/), the [Google Cosure Compiler](http://code.google.com/closure/compiler/) or [JSMin](http://crockford.com/javascript/jsmin) among others..
30
+
31
+ I used a simple solution of copy-paste the `jquery.bettertabs.js` in an online tool and then copy-paste again in the `jquery.bettertabs.min.js` file.
32
+
33
+ Online compressors:
34
+
35
+ * http://refresh-sf.com/yui/
36
+ * http://yui.2clics.net/
37
+ * http://closure-compiler.appspot.com/home
38
+ * http://compressorrater.thruhere.net/
@@ -0,0 +1,77 @@
1
+ ###
2
+ Bettertabs jQuery plugin v1.0
3
+
4
+ jQuery(selector).bettertabs(); adds javascript to change content when click on tabs.
5
+
6
+ Markup needed, the same that is generated by the rails bettertabs helper, added by the bettertabs plugin
7
+ https://github.com/agoragames/bettertabs
8
+
9
+ Events: Each time a tab is selected, some events are fired, so you can easily activate
10
+ behavior from another jquery script (using .bind); The available events are:
11
+ 'bettertabs-before-deactivate': fired on content that is active and will be deactivated
12
+ 'bettertabs-before-activate': fired on content that will be activated
13
+ 'bettertabs-before-ajax-loading': fired on content that will be activated and needs ajax loading
14
+ 'bettertabs-after-deactivate': fired on content that was deactivated
15
+ 'bettertabs-after-activate': fired on content that was activated
16
+ 'bettertabs-after-ajax-loading': fired on content after it was loaded via ajax
17
+
18
+ ###
19
+
20
+ $ = jQuery
21
+
22
+ tab_type_attr = 'data-tab-type' # attribute on tab links that indicate the tab type
23
+ show_content_id_attr = 'data-show-content-id' # attribute on tab links that indicate the related content id
24
+ tab_type_of = ($tab_link) -> $tab_link.attr(tab_type_attr)
25
+ content_id_from = ($tab_link) -> $tab_link.attr(show_content_id_attr)
26
+
27
+ change_url = ($link) ->
28
+ # Use replaceState for HTML5 browsers, and just ignore for old browsers (no change url support).
29
+ # This will work on last modern browsers, but I could not find a neasy way to listen the popstate event,
30
+ # so better not to use pushState (because we can't safely revert to previous state), replaceState just works fine.
31
+ if history? and history.replaceState?
32
+ url = $link.attr 'href'
33
+ history.replaceState null, document.title, url
34
+
35
+ $.fn.bettertabs = ->
36
+ @each ->
37
+ mytabs = $(this)
38
+ tabs = mytabs.find 'ul.tabs > li'
39
+ tabs_links = mytabs.find 'ul.tabs > li > a'
40
+ tabs_contents = mytabs.children '.content'
41
+ tabs_and_contents = tabs.add tabs_contents
42
+
43
+ tabs_links.click (event) ->
44
+ this_link = $(this)
45
+ if tab_type_of(this_link) isnt 'link'
46
+ event.preventDefault()
47
+ this_tab = this_link.parent()
48
+ if not this_tab.is('.active') and not this_link.is('.ajax-loading')
49
+ this_tab_content = tabs_contents.filter "##{content_id_from this_link}"
50
+ previous_active_tab = tabs.filter '.active'
51
+ previous_active_tab_content = tabs_contents.filter '.active'
52
+ activate_tab_and_content = ->
53
+ tabs_and_contents.removeClass('active').addClass('hidden')
54
+ this_tab.removeClass('hidden').addClass('active')
55
+ this_tab_content.removeClass('hidden').addClass('active')
56
+ previous_active_tab_content.trigger 'bettertabs-after-deactivate'
57
+ this_tab_content.trigger 'bettertabs-after-activate'
58
+ change_url this_link
59
+
60
+ previous_active_tab_content.trigger 'bettertabs-before-deactivate'
61
+ this_tab_content.trigger 'bettertabs-before-activate'
62
+
63
+ if tab_type_of(this_link) is 'ajax' and not this_link.data('content-loaded-already')?
64
+ this_link.addClass('ajax-loading')
65
+ this_tab_content.trigger 'bettertabs-before-ajax-loading'
66
+ this_tab_content.load this_link.attr('href'), ->
67
+ this_link.removeClass('ajax-loading')
68
+ this_link.data('content-loaded-already', yes)
69
+ this_tab_content.trigger 'bettertabs-after-ajax-loading'
70
+ activate_tab_and_content()
71
+ else
72
+ activate_tab_and_content()
73
+
74
+
75
+
76
+
77
+
@@ -0,0 +1,81 @@
1
+ (function() {
2
+ /*
3
+ Bettertabs jQuery plugin v1.0
4
+
5
+ jQuery(selector).bettertabs(); adds javascript to change content when click on tabs.
6
+
7
+ Markup needed, the same that is generated by the rails bettertabs helper, added by the bettertabs plugin
8
+ https://github.com/agoragames/bettertabs
9
+
10
+ Events: Each time a tab is selected, some events are fired, so you can easily activate
11
+ behavior from another jquery script (using .bind); The available events are:
12
+ 'bettertabs-before-deactivate': fired on content that is active and will be deactivated
13
+ 'bettertabs-before-activate': fired on content that will be activated
14
+ 'bettertabs-before-ajax-loading': fired on content that will be activated and needs ajax loading
15
+ 'bettertabs-after-deactivate': fired on content that was deactivated
16
+ 'bettertabs-after-activate': fired on content that was activated
17
+ 'bettertabs-after-ajax-loading': fired on content after it was loaded via ajax
18
+
19
+ */ var $, change_url, content_id_from, show_content_id_attr, tab_type_attr, tab_type_of;
20
+ $ = jQuery;
21
+ tab_type_attr = 'data-tab-type';
22
+ show_content_id_attr = 'data-show-content-id';
23
+ tab_type_of = function($tab_link) {
24
+ return $tab_link.attr(tab_type_attr);
25
+ };
26
+ content_id_from = function($tab_link) {
27
+ return $tab_link.attr(show_content_id_attr);
28
+ };
29
+ change_url = function($link) {
30
+ var url;
31
+ if ((typeof history != "undefined" && history !== null) && (history.replaceState != null)) {
32
+ url = $link.attr('href');
33
+ return history.replaceState(null, document.title, url);
34
+ }
35
+ };
36
+ $.fn.bettertabs = function() {
37
+ return this.each(function() {
38
+ var mytabs, tabs, tabs_and_contents, tabs_contents, tabs_links;
39
+ mytabs = $(this);
40
+ tabs = mytabs.find('ul.tabs > li');
41
+ tabs_links = mytabs.find('ul.tabs > li > a');
42
+ tabs_contents = mytabs.children('.content');
43
+ tabs_and_contents = tabs.add(tabs_contents);
44
+ return tabs_links.click(function(event) {
45
+ var activate_tab_and_content, previous_active_tab, previous_active_tab_content, this_link, this_tab, this_tab_content;
46
+ this_link = $(this);
47
+ if (tab_type_of(this_link) !== 'link') {
48
+ event.preventDefault();
49
+ this_tab = this_link.parent();
50
+ if (!this_tab.is('.active') && !this_link.is('.ajax-loading')) {
51
+ this_tab_content = tabs_contents.filter("#" + (content_id_from(this_link)));
52
+ previous_active_tab = tabs.filter('.active');
53
+ previous_active_tab_content = tabs_contents.filter('.active');
54
+ activate_tab_and_content = function() {
55
+ tabs_and_contents.removeClass('active').addClass('hidden');
56
+ this_tab.removeClass('hidden').addClass('active');
57
+ this_tab_content.removeClass('hidden').addClass('active');
58
+ previous_active_tab_content.trigger('bettertabs-after-deactivate');
59
+ this_tab_content.trigger('bettertabs-after-activate');
60
+ return change_url(this_link);
61
+ };
62
+ previous_active_tab_content.trigger('bettertabs-before-deactivate');
63
+ this_tab_content.trigger('bettertabs-before-activate');
64
+ if (tab_type_of(this_link) === 'ajax' && !(this_link.data('content-loaded-already') != null)) {
65
+ this_link.addClass('ajax-loading');
66
+ this_tab_content.trigger('bettertabs-before-ajax-loading');
67
+ return this_tab_content.load(this_link.attr('href'), function() {
68
+ this_link.removeClass('ajax-loading');
69
+ this_link.data('content-loaded-already', true);
70
+ this_tab_content.trigger('bettertabs-after-ajax-loading');
71
+ return activate_tab_and_content();
72
+ });
73
+ } else {
74
+ return activate_tab_and_content();
75
+ }
76
+ }
77
+ }
78
+ });
79
+ });
80
+ };
81
+ }).call(this);
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Bettertabs jQuery plugin v1.0
3
+ */
4
+ (function(){var e,b,d,c,a,f;e=jQuery;a="data-tab-type";c="data-show-content-id";f=function(g){return g.attr(a)};d=function(g){return g.attr(c)};b=function(g){var h;if((typeof history!="undefined"&&history!==null)&&(history.replaceState!=null)){h=g.attr("href");return history.replaceState(null,document.title,h)}};e.fn.bettertabs=function(){return this.each(function(){var k,h,j,g,i;k=e(this);h=k.find("ul.tabs > li");i=k.find("ul.tabs > li > a");g=k.children(".content");j=h.add(g);return i.click(function(o){var q,r,n,m,p,l;m=e(this);if(f(m)!=="link"){o.preventDefault();p=m.parent();if(!p.is(".active")&&!m.is(".ajax-loading")){l=g.filter("#"+(d(m)));r=h.filter(".active");n=g.filter(".active");q=function(){j.removeClass("active").addClass("hidden");p.removeClass("hidden").addClass("active");l.removeClass("hidden").addClass("active");n.trigger("bettertabs-after-deactivate");l.trigger("bettertabs-after-activate");return b(m)};n.trigger("bettertabs-before-deactivate");l.trigger("bettertabs-before-activate");if(f(m)==="ajax"&&!(m.data("content-loaded-already")!=null)){m.addClass("ajax-loading");l.trigger("bettertabs-before-ajax-loading");return l.load(m.attr("href"),function(){m.removeClass("ajax-loading");m.data("content-loaded-already",true);l.trigger("bettertabs-after-ajax-loading");return q()})}else{return q()}}}})})}}).call(this);
@@ -0,0 +1,3 @@
1
+ module Bettertabs
2
+ VERSION = "1.0"
3
+ end
@@ -0,0 +1,5 @@
1
+ For test bettertabs in a full stack mode, we will have one simple rails app for each environment.
2
+ Inside the Rails app, we will be able to test a request (including javascript behavior) thanks to Capybara and Rspec.
3
+
4
+ Check this RailsCast to better understand how to test with Rspec and Capybara:
5
+ http://asciicasts.com/episodes/257-request-specs-and-capybara
@@ -0,0 +1 @@
1
+ --colour
@@ -0,0 +1 @@
1
+ rvm 1.9.2
@@ -0,0 +1,11 @@
1
+ source 'http://rubygems.org'
2
+
3
+ gem 'rails', '3.0.6'
4
+ gem 'haml', '>=3.0.18'
5
+ gem 'rspec-rails'
6
+
7
+ gem 'bettertabs'
8
+
9
+ # To use debugger (ruby-debug for Ruby 1.8.7+, ruby-debug19 for Ruby 1.9.2+)
10
+ # gem 'ruby-debug'
11
+ gem 'ruby-debug19', :require => 'ruby-debug'
@@ -0,0 +1,105 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ abstract (1.0.0)
5
+ actionmailer (3.0.6)
6
+ actionpack (= 3.0.6)
7
+ mail (~> 2.2.15)
8
+ actionpack (3.0.6)
9
+ activemodel (= 3.0.6)
10
+ activesupport (= 3.0.6)
11
+ builder (~> 2.1.2)
12
+ erubis (~> 2.6.6)
13
+ i18n (~> 0.5.0)
14
+ rack (~> 1.2.1)
15
+ rack-mount (~> 0.6.14)
16
+ rack-test (~> 0.5.7)
17
+ tzinfo (~> 0.3.23)
18
+ activemodel (3.0.6)
19
+ activesupport (= 3.0.6)
20
+ builder (~> 2.1.2)
21
+ i18n (~> 0.5.0)
22
+ activerecord (3.0.6)
23
+ activemodel (= 3.0.6)
24
+ activesupport (= 3.0.6)
25
+ arel (~> 2.0.2)
26
+ tzinfo (~> 0.3.23)
27
+ activeresource (3.0.6)
28
+ activemodel (= 3.0.6)
29
+ activesupport (= 3.0.6)
30
+ activesupport (3.0.6)
31
+ archive-tar-minitar (0.5.2)
32
+ arel (2.0.9)
33
+ bettertabs (0.0.1)
34
+ builder (2.1.2)
35
+ columnize (0.3.2)
36
+ diff-lcs (1.1.2)
37
+ erubis (2.6.6)
38
+ abstract (>= 1.0.0)
39
+ haml (3.0.25)
40
+ i18n (0.5.0)
41
+ linecache19 (0.5.12)
42
+ ruby_core_source (>= 0.1.4)
43
+ mail (2.2.15)
44
+ activesupport (>= 2.3.6)
45
+ i18n (>= 0.4.0)
46
+ mime-types (~> 1.16)
47
+ treetop (~> 1.4.8)
48
+ mime-types (1.16)
49
+ polyglot (0.3.1)
50
+ rack (1.2.2)
51
+ rack-mount (0.6.14)
52
+ rack (>= 1.0.0)
53
+ rack-test (0.5.7)
54
+ rack (>= 1.0)
55
+ rails (3.0.6)
56
+ actionmailer (= 3.0.6)
57
+ actionpack (= 3.0.6)
58
+ activerecord (= 3.0.6)
59
+ activeresource (= 3.0.6)
60
+ activesupport (= 3.0.6)
61
+ bundler (~> 1.0)
62
+ railties (= 3.0.6)
63
+ railties (3.0.6)
64
+ actionpack (= 3.0.6)
65
+ activesupport (= 3.0.6)
66
+ rake (>= 0.8.7)
67
+ thor (~> 0.14.4)
68
+ rake (0.8.7)
69
+ rspec (2.5.0)
70
+ rspec-core (~> 2.5.0)
71
+ rspec-expectations (~> 2.5.0)
72
+ rspec-mocks (~> 2.5.0)
73
+ rspec-core (2.5.1)
74
+ rspec-expectations (2.5.0)
75
+ diff-lcs (~> 1.1.2)
76
+ rspec-mocks (2.5.0)
77
+ rspec-rails (2.5.0)
78
+ actionpack (~> 3.0)
79
+ activesupport (~> 3.0)
80
+ railties (~> 3.0)
81
+ rspec (~> 2.5.0)
82
+ ruby-debug-base19 (0.11.25)
83
+ columnize (>= 0.3.1)
84
+ linecache19 (>= 0.5.11)
85
+ ruby_core_source (>= 0.1.4)
86
+ ruby-debug19 (0.11.6)
87
+ columnize (>= 0.3.1)
88
+ linecache19 (>= 0.5.11)
89
+ ruby-debug-base19 (>= 0.11.19)
90
+ ruby_core_source (0.1.5)
91
+ archive-tar-minitar (>= 0.5.2)
92
+ thor (0.14.6)
93
+ treetop (1.4.9)
94
+ polyglot (>= 0.3.1)
95
+ tzinfo (0.3.26)
96
+
97
+ PLATFORMS
98
+ ruby
99
+
100
+ DEPENDENCIES
101
+ bettertabs
102
+ haml (>= 3.0.18)
103
+ rails (= 3.0.6)
104
+ rspec-rails
105
+ ruby-debug19
@@ -0,0 +1,3 @@
1
+ This Rails APP will serve as scenario to test the bettertabs gem in a ruby1.9/Rails3.0.X environment.
2
+ Go to the rails app root path (bettertabs/test/ruby_1_9/rails_3_0) and run:
3
+ $ rake spec:requests
@@ -0,0 +1,7 @@
1
+ # Add your own tasks in files placed in lib/tasks ending in .rake,
2
+ # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3
+
4
+ require File.expand_path('../config/application', __FILE__)
5
+ require 'rake'
6
+
7
+ Rails30::Application.load_tasks
@@ -0,0 +1,3 @@
1
+ class ApplicationController < ActionController::Base
2
+ protect_from_forgery
3
+ end
@@ -0,0 +1,24 @@
1
+ class BettertabsController < ApplicationController
2
+
3
+ def static
4
+ end
5
+
6
+ def link_tab_1
7
+ end
8
+
9
+ def link_tab_2
10
+ end
11
+
12
+ def ajax
13
+ render partial: 'ajax' and return if request.xhr?
14
+ end
15
+
16
+ def mixed
17
+ render partial: 'mixed' and return if request.xhr?
18
+ end
19
+
20
+ def mixed_with_erb
21
+ render partial: 'tab_content' and return if request.xhr? and params[:erb_test_selected_tab] == 'ajax_tab'
22
+ end
23
+
24
+ end
@@ -0,0 +1,2 @@
1
+ module ApplicationHelper
2
+ end
@@ -0,0 +1,6 @@
1
+ = bettertabs :ajax do |tab|
2
+ = tab.ajax :ajax_tab_1 do
3
+ Content for the link tab
4
+ = tab.ajax :ajax_tab_2 do
5
+ Content for the static tab
6
+ = tab.ajax :ajax_tab_3, partial: 'tab_content'
@@ -0,0 +1,4 @@
1
+ = bettertabs :link, class: 'link_class', selected_tab: selected_tab do |tab|
2
+ = tab.link :tab1, 'Tab One', url: { action: 'link_tab_1' } do
3
+ Hello World!
4
+ = tab.link :tab2, 'Tab Two', partial: 'tab_content', url: { action: 'link_tab_2' }
@@ -0,0 +1,6 @@
1
+ = bettertabs :mixed do |tab|
2
+ = tab.link :link_tab do
3
+ Content for the link tab
4
+ = tab.static :static_tab do
5
+ Content for the static tab
6
+ = tab.ajax :ajax_tab, partial: 'tab_content'
@@ -0,0 +1 @@
1
+ tab_content partial content.
@@ -0,0 +1,2 @@
1
+ %h2 Testing ajax tabs
2
+ = render 'ajax'
@@ -0,0 +1,2 @@
1
+ %h2 Test with linked tabs, for tab1
2
+ = render 'link', selected_tab: 'tab1'
@@ -0,0 +1,2 @@
1
+ %h2 Test with linked tabs, for tab2
2
+ = render 'link', selected_tab: 'tab2'
@@ -0,0 +1,2 @@
1
+ %h2 This is 4x4 bettertabs
2
+ = render 'mixed'