hooch 0.15.4 → 0.15.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3c8bd4c9482fc1cb446fa693462b3fe6ac7f8589
4
- data.tar.gz: 10683b7e2341b5f54d93b77b4dcdb396b68c15eb
3
+ metadata.gz: 9876e5f45245c44802ba0cbe47f1ca8e8e92a1b5
4
+ data.tar.gz: 2a2dd7ce0ec572babd8fc0e10399b12dcd1d8476
5
5
  SHA512:
6
- metadata.gz: 186ce511926dcd7179857b5243b08b3c6f3371e589be7b071198cdca77afa3664fbcc79a9b12ad22eb7236c5a710452d4a030574f5b42b553fb46fb167ef1d59
7
- data.tar.gz: eebf9f0eeda2aa63d894e22ba58e45b6669401573fd0f8996afbe71191a079c46bb52082573c74135f43c2c456d09a4eeda495370b831c8166890b9f26dc09e6
6
+ metadata.gz: c53a91ed15018c648bb3dadb61ce57273bc15a6f3df49041a81b2f1114372e83f27fbb171058dbe0a3ca7bdc9352e65ab96d29cef4c3a9d6018c627e59a482c1
7
+ data.tar.gz: 855c432af0be3e584b849112c0bac3fc0c25f2d4d713ec655f599348a30010620e7a402435e02598c9df964a1617543413a868c204ee659b2a2f51b85d9860a6
@@ -478,7 +478,6 @@ var initHooch = function(){
478
478
  this.$content_parent = this.tab_triggers[0].getParent();
479
479
  },
480
480
  handleDefault: function(){
481
-
482
481
  if(this.$tab_group.data('default-tab')){
483
482
  this.default_tab = this.tab_triggers_by_id[this.$tab_group.data('default-tab')];
484
483
  this.default_tab.toggleTarget(this.state_behavior);
@@ -1728,6 +1727,24 @@ var initHooch = function(){
1728
1727
  }
1729
1728
  });
1730
1729
  hooch.AjaxTabGroup = hooch.TabGroup.extend({
1730
+ init: function($tab_group){
1731
+ this._super($tab_group)
1732
+ this.handlePreloads();
1733
+ },
1734
+ handlePreloads: function(){
1735
+ var tab_group = this
1736
+ var preload_tabs = this.$tab_group.data('preload-tabs');
1737
+ if(preload_tabs){
1738
+ var list_prototype = typeof(preload_tabs)
1739
+ if(list_prototype.toLowerCase() == 'string'){
1740
+ preload_tabs = eval('(' + preload_tabs + ')');
1741
+ }
1742
+ $.each(preload_tabs, function(i,preload_tab_id){
1743
+ var preload_tab = tab_group.tab_triggers_by_id[preload_tab_id]
1744
+ preload_tab.loadTarget();
1745
+ })
1746
+ }
1747
+ },
1731
1748
  getTabTriggerClass: function(){
1732
1749
  this.tab_trigger_class = hooch.AjaxTabTrigger;
1733
1750
  }
@@ -1736,15 +1753,19 @@ var initHooch = function(){
1736
1753
  toggleTarget: function(pop){
1737
1754
  var tab_group = this.tab_group;
1738
1755
  if(!this.ajax_loaded){
1739
- this.ajax_loaded = true;
1740
- this.$tab_trigger.data('ajax-target','[data-tab-id="' + this.tab_id + '"]')
1741
- new thin_man.AjaxLinkSubmission(this.$tab_trigger,{'on_complete': function(){tab_group.resize()}});
1756
+ this.loadTarget()
1742
1757
  this._super(pop);
1743
1758
  } else {
1744
1759
  this._super(pop);
1745
1760
  tab_group.resize()
1746
1761
  }
1747
1762
  },
1763
+ loadTarget: function(){
1764
+ var tab_group = this.tab_group;
1765
+ this.ajax_loaded = true;
1766
+ this.$tab_trigger.data('ajax-target','[data-tab-id="' + this.tab_id + '"]')
1767
+ new thin_man.AjaxLinkSubmission(this.$tab_trigger,{'on_complete': function(){tab_group.resize()}});
1768
+ },
1748
1769
  resize: function(){
1749
1770
  // noop
1750
1771
  }
@@ -1,12 +1,13 @@
1
1
  module Hooch
2
2
  module HoochHelper
3
- def tab_set(name, type: nil, default_tab: nil, no_history: nil)
3
+ def tab_set(name, type: nil, default_tab: nil, no_history: nil, preload_tabs: nil)
4
4
  if :ajax == type
5
5
  type = 'AjaxTabGroup'
6
6
  end
7
7
  attrs = 'data-tab-group=' + name
8
8
  attrs += ' data-sub-type=' + type if type.present?
9
9
  attrs += ' data-default-tab=' + default_tab if default_tab.present?
10
+ attrs += ' data-preload-tabs=' + preload_tabs if preload_tabs.present?
10
11
  attrs += ' data-no-history=true' if no_history.present?
11
12
  attrs
12
13
  end
data/lib/hooch/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Hooch
2
- VERSION = "0.15.4"
2
+ VERSION = "0.15.5"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hooch
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.15.4
4
+ version: 0.15.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Draut
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-08-03 00:00:00.000000000 Z
11
+ date: 2017-08-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails