bettertabs 1.3.4 → 1.3.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- bettertabs (1.3.4)
4
+ bettertabs (1.3.5)
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.4 (Sep-13-2011)
4
+ version: 1.3.5 (Sep-13-2011)
5
5
  @requires jQuery v1.3 or later
6
6
 
7
7
  Examples and documentation at: https://github.com/agoragames/bettertabs
@@ -70,11 +70,15 @@
70
70
  if (tab_type_of(this_link) === 'ajax' && !(this_link.data('content-loaded-already') != null)) {
71
71
  this_link.addClass('ajax-loading');
72
72
  this_tab_content.trigger('bettertabs-before-ajax-loading');
73
- return this_tab_content.load(this_link.attr(ajax_url_attr), function() {
74
- this_link.removeClass('ajax-loading');
75
- this_link.data('content-loaded-already', true);
76
- this_tab_content.trigger('bettertabs-after-ajax-loading');
77
- return activate_tab_and_content();
73
+ return this_tab_content.load(this_link.attr(ajax_url_attr), function(responseText, textStatus, XMLHttpRequest) {
74
+ if (textStatus === 'error') {
75
+ return window.location = this_link.attr('href');
76
+ } else {
77
+ this_link.removeClass('ajax-loading');
78
+ this_link.data('content-loaded-already', true);
79
+ this_tab_content.trigger('bettertabs-after-ajax-loading');
80
+ return activate_tab_and_content();
81
+ }
78
82
  });
79
83
  } else {
80
84
  return activate_tab_and_content();
@@ -1,6 +1,6 @@
1
1
  ###!
2
2
  jQuery Bettertabs Plugin
3
- version: 1.3.4 (Sep-13-2011)
3
+ version: 1.3.5 (Sep-13-2011)
4
4
  @requires jQuery v1.3 or later
5
5
 
6
6
  Examples and documentation at: https://github.com/agoragames/bettertabs
@@ -71,11 +71,14 @@ $.fn.bettertabs = ->
71
71
  if tab_type_of(this_link) is 'ajax' and not this_link.data('content-loaded-already')?
72
72
  this_link.addClass('ajax-loading')
73
73
  this_tab_content.trigger 'bettertabs-before-ajax-loading'
74
- this_tab_content.load this_link.attr(ajax_url_attr), ->
75
- this_link.removeClass('ajax-loading')
76
- this_link.data('content-loaded-already', yes)
77
- this_tab_content.trigger 'bettertabs-after-ajax-loading'
78
- activate_tab_and_content()
74
+ this_tab_content.load this_link.attr(ajax_url_attr), (responseText, textStatus, XMLHttpRequest) ->
75
+ if textStatus is 'error'
76
+ window.location = this_link.attr('href')
77
+ else
78
+ this_link.removeClass('ajax-loading')
79
+ this_link.data('content-loaded-already', yes)
80
+ this_tab_content.trigger 'bettertabs-after-ajax-loading'
81
+ activate_tab_and_content()
79
82
  else
80
83
  activate_tab_and_content()
81
84
  return this
@@ -1,7 +1,7 @@
1
1
  (function(){
2
2
  /*!
3
3
  jQuery Bettertabs Plugin
4
- version: 1.3.4 (Sep-13-2011)
4
+ version: 1.3.5 (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 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);
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(u,v,t){if(v==="error"){return window.location=n.attr("href")}else{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);
@@ -3,9 +3,11 @@ Bettertabs Changelog
3
3
 
4
4
  2011-09-13 Mario Izquierdo Martinez <mizquierdo@majorleaguegaming.com>
5
5
 
6
- * Tag v1.3.4
6
+ * Tag v1.3.5
7
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
8
  * When tab-type is ajax, mark the first active link as content-loaded-already to not be loaded again when click later
9
+ * Ajax error handling: when .load() callback returns a textStatus 'error', the browser is reloaded to better show the error
10
+ * Bugfix: include other params if present in the default tab link url
9
11
 
10
12
  2011-09-12 Mario Izquierdo Martinez <mizquierdo@majorleaguegaming.com>
11
13
 
@@ -40,7 +40,7 @@ class BettertabsBuilder
40
40
  tab_text = get_tab_text(tab_id, args)
41
41
  raise "Bettertabs: #{tab_html_id_for(tab_id)} error. Used :partial option and a block of content at the same time." if block_given? and options[:partial]
42
42
  partial = options.delete(:partial) || tab_id.to_s unless block_given?
43
- url = options.delete(:url) || { :"#{@bettertabs_id}_selected_tab" => tab_id }
43
+ url = options.delete(:url) || @template.params.merge(:"#{@bettertabs_id}_selected_tab" => tab_id)
44
44
  tab_type = (options.delete(:tab_type) || :static).to_sym
45
45
  raise "Bettertabs: #{tab_type.inspect} tab type not supported. Use one of #{TAB_TYPES.inspect} instead." unless TAB_TYPES.include?(tab_type)
46
46
  ajax_url = options.delete(:ajax_url) || url_for_ajax(url) if tab_type == :ajax
@@ -1,3 +1,3 @@
1
1
  module Bettertabs
2
- VERSION = "1.3.4"
2
+ VERSION = "1.3.5"
3
3
  end
@@ -3,4 +3,6 @@
3
3
  Content for the ajax_tab_1
4
4
  = tab.ajax :ajax_tab_2 do
5
5
  Content for the ajax_tab_2
6
- = tab.ajax :ajax_tab_3, partial: 'tab_content'
6
+ = tab.ajax :ajax_tab_3, partial: 'tab_content'
7
+ = tab.ajax :ajax_tab_with_error, 'raise a 500 error' do
8
+ = raise 'This tab should raise an error, how well was it handled?'
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.4
4
+ version: 1.3.5
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: &2156049080 !ruby/object:Gem::Requirement
17
+ requirement: &2156435120 !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: *2156049080
25
+ version_requirements: *2156435120
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: jquery-rails
28
- requirement: &2156048500 !ruby/object:Gem::Requirement
28
+ requirement: &2156434520 !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: *2156048500
36
+ version_requirements: *2156434520
37
37
  - !ruby/object:Gem::Dependency
38
38
  name: rspec-rails
39
- requirement: &2156047820 !ruby/object:Gem::Requirement
39
+ requirement: &2156433360 !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: *2156047820
47
+ version_requirements: *2156433360
48
48
  - !ruby/object:Gem::Dependency
49
49
  name: haml-rails
50
- requirement: &2156047300 !ruby/object:Gem::Requirement
50
+ requirement: &2156432760 !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: *2156047300
58
+ version_requirements: *2156432760
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: -751903292244497162
148
+ hash: -1078283048097430699
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: -751903292244497162
157
+ hash: -1078283048097430699
158
158
  requirements: []
159
159
  rubyforge_project:
160
160
  rubygems_version: 1.6.2