hooch 0.7.1 → 0.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/assets/javascripts/hooch.js +33 -7
- data/lib/hooch/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5461b89c043f14cd4d087320e0591a565ab53ffa
|
4
|
+
data.tar.gz: 0cfe8a173eec53e574078854574a763a18a878a3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
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
|
-
|
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.
|
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
|
-
|
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
|
-
|
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.
|
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.
|
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
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.
|
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-
|
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: {}
|