hooch 0.7.1 → 0.7.2

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: 06d1c2b61f016a4b16a3056e23c36116785c8d5e
4
- data.tar.gz: 967068b905f27d7274a14d73aa5ac7e4330138f6
3
+ metadata.gz: 5461b89c043f14cd4d087320e0591a565ab53ffa
4
+ data.tar.gz: 0cfe8a173eec53e574078854574a763a18a878a3
5
5
  SHA512:
6
- metadata.gz: 4a3314281fb1857268a0474595451b586545c601035c6bd7abcbf9060527a84f9bbe09d28b55f2771e8df21285d5017950edae1c37f373f6dc11637797c26dd6
7
- data.tar.gz: 9d6725301d52b13036db437208e30a76bde5f8d63173d6231497c2bb522fe9e0e2e22c51d81a217d0713cc8745fc7876e17d877b7c5bc02ec9542d8963ed1a2f
6
+ metadata.gz: 111548b3eac2609c26e29d6d989a488d9aef85611aa13c5733af49440e8ba2b21c782958a9edd49aa3bb0b1cf30a88501b22a79fd89944a18084ff29dec7ad6c
7
+ data.tar.gz: 30015846fa8cb5d19036f97cb789aea9da3cbcab4024ad605e524399e4d40b8f80ffad3e234c31fe1a16e1a4043ca7440be4f1077c80c6bc60da1952db2c65a8
@@ -102,13 +102,25 @@ var initHooch = function(){
102
102
  this.$collapser = $('[data-expand-id="' + $expandable.data('expand-id') + '"][data-collapser]');
103
103
  if(this.$collapser.length > 0){
104
104
  this.$collapser.each(function(){
105
- expandable.collapsers.push(new hooch.Collapser($(this),expandable))
105
+ if($(this).data('hooch_collapser')){
106
+ var hooch_collapser = $(this).data('hooch_collapser')
107
+ expandable.collapsers.push(hooch_collapser)
108
+ hooch_collapser.addExpandable(expandable)
109
+ } else{
110
+ expandable.collapsers.push(new hooch.Collapser($(this),expandable))
111
+ }
106
112
  })
107
113
  }
108
114
  this.$expander = $('[data-expand-id="' + $expandable.data('expand-id') + '"][data-expander]');
109
115
  this.expanders = []
110
116
  this.$expander.each(function(){
111
- expandable.expanders.push(new hooch.Expander($(this),expandable))
117
+ if($(this).data('hooch_expander')){
118
+ var hooch_expander = $(this).data('hooch_expander')
119
+ expandable.expanders.push(hooch_expander)
120
+ hooch_expander.addExpandable(expandable)
121
+ } else{
122
+ expandable.expanders.push(new hooch.Expander($(this),expandable))
123
+ }
112
124
  })
113
125
  this.initial_state = $expandable.data('expand-state');
114
126
  if(this.initial_state == 'expanded'){
@@ -175,10 +187,18 @@ var initHooch = function(){
175
187
  Expander: Class.extend({
176
188
  init: function($expander,target){
177
189
  this.$expander = $expander;
178
- this.target = target;
190
+ this.$expander.data('hooch_expander', this);
191
+ this.targets = [target];
179
192
  this.expand_class = $expander.data('expand-class')
180
193
  this.collapse_class = $expander.data('collapse-class')
181
- if($expander.data('fake-dropdown')){
194
+ this.bindTarget(target);
195
+ },
196
+ addExpandable: function(target){
197
+ this.targets.push(target)
198
+ this.bindTarget(target)
199
+ },
200
+ bindTarget: function(target){
201
+ if(this.$expander.data('fake-dropdown')){
182
202
  target.$expandable.on('click',function(){
183
203
  target.toggle();
184
204
  })
@@ -186,7 +206,7 @@ var initHooch = function(){
186
206
  target.collapse();
187
207
  })
188
208
  }
189
- $expander.bind('click',function(){
209
+ this.$expander.bind('click',function(){
190
210
  target.toggle();
191
211
  })
192
212
  },
@@ -198,7 +218,7 @@ var initHooch = function(){
198
218
  if(this.collapse_class){
199
219
  this.$expander.removeClass(this.collapse_class)
200
220
  }
201
- } else if(this.target.collapsers.length > 0) {
221
+ } else if(this.targets[0].collapsers.length > 0) {
202
222
  this.$expander.hide();
203
223
  }
204
224
  },
@@ -210,7 +230,7 @@ var initHooch = function(){
210
230
  if(this.collapse_class){
211
231
  this.$expander.addClass(this.collapse_class)
212
232
  }
213
- } else if(this.target.collapsers.length > 0) {
233
+ } else if(this.targets[0].collapsers.length > 0) {
214
234
  this.$expander.show();
215
235
  }
216
236
  }
@@ -218,10 +238,16 @@ var initHooch = function(){
218
238
  Collapser: Class.extend({
219
239
  init: function($collapser,target){
220
240
  this.$collapser = $collapser;
241
+ this.$collapser.data('hooch_collapser', this);
221
242
  $collapser.bind('click',function(){
222
243
  target.collapse();
223
244
  })
224
245
  },
246
+ addExpandable: function(target){
247
+ this.$collapser.bind('click',function(){
248
+ target.collapse();
249
+ })
250
+ },
225
251
  hide: function(){
226
252
  this.$collapser.hide();
227
253
  },
data/lib/hooch/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Hooch
2
- VERSION = "0.7.1"
2
+ VERSION = "0.7.2"
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.7.1
4
+ version: 0.7.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Draut
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-02-02 00:00:00.000000000 Z
11
+ date: 2016-03-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -148,7 +148,7 @@ files:
148
148
  - lib/hooch/hooch_helper.rb
149
149
  - lib/hooch/railtie.rb
150
150
  - lib/hooch/version.rb
151
- homepage: ''
151
+ homepage: https://github.com/edraut/hooch/wiki
152
152
  licenses:
153
153
  - MIT
154
154
  metadata: {}