bettertabs 1.3.3 → 1.3.4

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- bettertabs (1.3.3)
4
+ bettertabs (1.3.4)
5
5
  jquery-rails
6
6
  rails (~> 3.1.0)
7
7
 
@@ -1,7 +1,7 @@
1
1
  (function() {
2
2
  /*!
3
3
  jQuery Bettertabs Plugin
4
- version: 1.3.3 (Sep-13-2011)
4
+ version: 1.3.4 (Sep-13-2011)
5
5
  @requires jQuery v1.3 or later
6
6
 
7
7
  Examples and documentation at: https://github.com/agoragames/bettertabs
@@ -34,12 +34,16 @@
34
34
  };
35
35
  $.fn.bettertabs = function() {
36
36
  this.each(function() {
37
- var mytabs, tabs, tabs_and_contents, tabs_contents, tabs_links;
38
- mytabs = $(this);
39
- tabs = mytabs.find('ul.tabs > li');
40
- tabs_links = mytabs.find('ul.tabs > li > a');
41
- tabs_contents = mytabs.children('.content');
37
+ var active_tab_link, tabs, tabs_and_contents, tabs_contents, tabs_links, wrapper;
38
+ wrapper = $(this);
39
+ tabs = wrapper.find('ul.tabs > li');
40
+ tabs_links = wrapper.find('ul.tabs > li > a');
41
+ tabs_contents = wrapper.children('.content');
42
42
  tabs_and_contents = tabs.add(tabs_contents);
43
+ active_tab_link = tabs_links.filter('.active');
44
+ if (tab_type_of(active_tab_link) === 'ajax') {
45
+ active_tab_link.data('content-loaded-already', true);
46
+ }
43
47
  return tabs_links.click(function(event) {
44
48
  var activate_tab_and_content, previous_active_tab, previous_active_tab_content, this_link, this_tab, this_tab_content;
45
49
  this_link = $(this);
@@ -1,6 +1,6 @@
1
1
  ###!
2
2
  jQuery Bettertabs Plugin
3
- version: 1.3.3 (Sep-13-2011)
3
+ version: 1.3.4 (Sep-13-2011)
4
4
  @requires jQuery v1.3 or later
5
5
 
6
6
  Examples and documentation at: https://github.com/agoragames/bettertabs
@@ -35,11 +35,15 @@ $.Bettertabs =
35
35
 
36
36
  $.fn.bettertabs = ->
37
37
  @each ->
38
- mytabs = $(this)
39
- tabs = mytabs.find 'ul.tabs > li'
40
- tabs_links = mytabs.find 'ul.tabs > li > a'
41
- tabs_contents = mytabs.children '.content'
38
+ wrapper = $(this)
39
+ tabs = wrapper.find 'ul.tabs > li'
40
+ tabs_links = wrapper.find 'ul.tabs > li > a'
41
+ tabs_contents = wrapper.children '.content'
42
42
  tabs_and_contents = tabs.add tabs_contents
43
+ active_tab_link = tabs_links.filter '.active'
44
+
45
+ # When tab-type is ajax, mark the first active link as content-loaded-already to not be loaded again when click later
46
+ active_tab_link.data('content-loaded-already', yes) if tab_type_of(active_tab_link) is 'ajax'
43
47
 
44
48
  tabs_links.click (event) ->
45
49
  this_link = $(this)
@@ -1,7 +1,7 @@
1
1
  (function(){
2
2
  /*!
3
3
  jQuery Bettertabs Plugin
4
- version: 1.3.3 (Sep-13-2011)
4
+ version: 1.3.4 (Sep-13-2011)
5
5
  @requires jQuery v1.3 or later
6
6
 
7
7
  Examples and documentation at: https://github.com/agoragames/bettertabs
@@ -11,4 +11,4 @@
11
11
  http://www.opensource.org/licenses/mit-license.php
12
12
  http://www.gnu.org/licenses/gpl.html
13
13
  */
14
- var d,f,c,b,a,e;d=jQuery;a="data-tab-type";b="data-show-content-id";f="data-ajax-url";e=function(g){return g.attr(a)};c=function(g){return g.attr(b)};d.Bettertabs={change_browser_url:function(g){if((typeof history!=="undefined"&&history!==null)&&(history.replaceState!=null)){return history.replaceState(null,document.title,g)}},select_tab:function(h,g){return d("#"+g+"_"+h+"_tab a").click()}};d.fn.bettertabs=function(){this.each(function(){var k,h,j,g,i;k=d(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=d(this);if(e(m)!=="link"){o.preventDefault();p=m.parent();if(!p.hasClass("active")&&!m.hasClass("ajax-loading")){l=g.filter("#"+(c(m)));r=h.filter(".active");n=g.filter(".active");q=function(){h.removeClass("active");i.removeClass("active");g.removeClass("active").addClass("hidden");p.addClass("active");m.addClass("active");l.removeClass("hidden").addClass("active");n.trigger("bettertabs-after-deactivate");l.trigger("bettertabs-after-activate");return d.Bettertabs.change_browser_url(m.attr("href"))};n.trigger("bettertabs-before-deactivate");l.trigger("bettertabs-before-activate");if(e(m)==="ajax"&&!(m.data("content-loaded-already")!=null)){m.addClass("ajax-loading");l.trigger("bettertabs-before-ajax-loading");return l.load(m.attr(f),function(){m.removeClass("ajax-loading");m.data("content-loaded-already",true);l.trigger("bettertabs-after-ajax-loading");return q()})}else{return q()}}}})});return this}}).call(this);
14
+ var d,f,c,b,a,e;d=jQuery;a="data-tab-type";b="data-show-content-id";f="data-ajax-url";e=function(g){return g.attr(a)};c=function(g){return g.attr(b)};d.Bettertabs={change_browser_url:function(g){if((typeof history!=="undefined"&&history!==null)&&(history.replaceState!=null)){return history.replaceState(null,document.title,g)}},select_tab:function(h,g){return d("#"+g+"_"+h+"_tab a").click()}};d.fn.bettertabs=function(){this.each(function(){var g,i,k,h,j,l;l=d(this);i=l.find("ul.tabs > li");j=l.find("ul.tabs > li > a");h=l.children(".content");k=i.add(h);g=j.filter(".active");if(e(g)==="ajax"){g.data("content-loaded-already",true)}return j.click(function(p){var r,s,o,n,q,m;n=d(this);if(e(n)!=="link"){p.preventDefault();q=n.parent();if(!q.hasClass("active")&&!n.hasClass("ajax-loading")){m=h.filter("#"+(c(n)));s=i.filter(".active");o=h.filter(".active");r=function(){i.removeClass("active");j.removeClass("active");h.removeClass("active").addClass("hidden");q.addClass("active");n.addClass("active");m.removeClass("hidden").addClass("active");o.trigger("bettertabs-after-deactivate");m.trigger("bettertabs-after-activate");return d.Bettertabs.change_browser_url(n.attr("href"))};o.trigger("bettertabs-before-deactivate");m.trigger("bettertabs-before-activate");if(e(n)==="ajax"&&!(n.data("content-loaded-already")!=null)){n.addClass("ajax-loading");m.trigger("bettertabs-before-ajax-loading");return m.load(n.attr(f),function(){n.removeClass("ajax-loading");n.data("content-loaded-already",true);m.trigger("bettertabs-after-ajax-loading");return r()})}else{return r()}}}})});return this}}).call(this);
data/doc/CHANGELOG.md CHANGED
@@ -3,13 +3,9 @@ Bettertabs Changelog
3
3
 
4
4
  2011-09-13 Mario Izquierdo Martinez <mizquierdo@majorleaguegaming.com>
5
5
 
6
- * Tag v1.3.3
7
- * Bugfix and update the jquery.bettertabs plugin to update the link .active class a well as li element
8
-
9
- 2011-09-13 Mario Izquierdo Martinez <mizquierdo@majorleaguegaming.com>
10
-
11
- * Tag v1.3.1
12
- * Add 'active' class to the link element inside the active tag as well as the li element (more easy to style)
6
+ * Tag v1.3.4
7
+ * Add 'active' class to the link element inside the active tag as well as the li element (so it is now more easy to style)
8
+ * When tab-type is ajax, mark the first active link as content-loaded-already to not be loaded again when click later
13
9
 
14
10
  2011-09-12 Mario Izquierdo Martinez <mizquierdo@majorleaguegaming.com>
15
11
 
@@ -1,3 +1,3 @@
1
1
  module Bettertabs
2
- VERSION = "1.3.3"
2
+ VERSION = "1.3.4"
3
3
  end
@@ -10,6 +10,7 @@ class BettertabsController < ApplicationController
10
10
  end
11
11
 
12
12
  def ajax
13
+ sleep 1 # to better feel the loading time
13
14
  render partial: 'ajax' and return if request.xhr?
14
15
  end
15
16
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bettertabs
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.3
4
+ version: 1.3.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -14,7 +14,7 @@ default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rails
17
- requirement: &2152821860 !ruby/object:Gem::Requirement
17
+ requirement: &2156049080 !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ~>
@@ -22,10 +22,10 @@ dependencies:
22
22
  version: 3.1.0
23
23
  type: :runtime
24
24
  prerelease: false
25
- version_requirements: *2152821860
25
+ version_requirements: *2156049080
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: jquery-rails
28
- requirement: &2152807840 !ruby/object:Gem::Requirement
28
+ requirement: &2156048500 !ruby/object:Gem::Requirement
29
29
  none: false
30
30
  requirements:
31
31
  - - ! '>='
@@ -33,10 +33,10 @@ dependencies:
33
33
  version: '0'
34
34
  type: :runtime
35
35
  prerelease: false
36
- version_requirements: *2152807840
36
+ version_requirements: *2156048500
37
37
  - !ruby/object:Gem::Dependency
38
38
  name: rspec-rails
39
- requirement: &2152807060 !ruby/object:Gem::Requirement
39
+ requirement: &2156047820 !ruby/object:Gem::Requirement
40
40
  none: false
41
41
  requirements:
42
42
  - - ! '>='
@@ -44,10 +44,10 @@ dependencies:
44
44
  version: '0'
45
45
  type: :development
46
46
  prerelease: false
47
- version_requirements: *2152807060
47
+ version_requirements: *2156047820
48
48
  - !ruby/object:Gem::Dependency
49
49
  name: haml-rails
50
- requirement: &2152805520 !ruby/object:Gem::Requirement
50
+ requirement: &2156047300 !ruby/object:Gem::Requirement
51
51
  none: false
52
52
  requirements:
53
53
  - - ! '>='
@@ -55,7 +55,7 @@ dependencies:
55
55
  version: '0'
56
56
  type: :development
57
57
  prerelease: false
58
- version_requirements: *2152805520
58
+ version_requirements: *2156047300
59
59
  description: ! 'Bettertabs is a Rails 3.1 engine that adds a helper and jQuery plugin
60
60
  to define the markup and behavior for a tabbed area in a easy and declarative way,
61
61
  using the appropiate JavaScript but ensuring accessibility and usability, no matter
@@ -145,7 +145,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
145
145
  version: '0'
146
146
  segments:
147
147
  - 0
148
- hash: 2066853603321649499
148
+ hash: -751903292244497162
149
149
  required_rubygems_version: !ruby/object:Gem::Requirement
150
150
  none: false
151
151
  requirements:
@@ -154,7 +154,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
154
154
  version: '0'
155
155
  segments:
156
156
  - 0
157
- hash: 2066853603321649499
157
+ hash: -751903292244497162
158
158
  requirements: []
159
159
  rubyforge_project:
160
160
  rubygems_version: 1.6.2