hooch 0.10.3 → 0.11.0
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 +82 -7
- data/lib/hooch/hooch_helper.rb +4 -1
- data/lib/hooch/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 54f4e899ce069ebb6f60defca61434660d7afe73
|
|
4
|
+
data.tar.gz: 7e44a2f22f8325dc1135ad9523ef4e142fb1c5d6
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 0d7ff3f114fb4fa0143fce2a2d1c9d51866c2d089b5b8b5f9d91e0b03b0c82c7a8a72d9cac5aa063b03be36dc1ea62e2cf4e95d183390bdc8de55b40ea7bd0a0
|
|
7
|
+
data.tar.gz: 2ac05e37ff14c01f3f62b16fca3408f0f38d7b8a066637d37b372e85ed27ea5ff835dd768b1e35d50cb466d596bcc5de7e3aed83bc553bf9d2341e59aedc8df3
|
|
@@ -373,12 +373,10 @@ var initHooch = function(){
|
|
|
373
373
|
Revealer: Class.extend({
|
|
374
374
|
init: function($revealer){
|
|
375
375
|
var revealer = this;
|
|
376
|
-
this.$revealer
|
|
377
|
-
this.children_id
|
|
378
|
-
this.$all_children
|
|
379
|
-
|
|
380
|
-
revealer.reveal();
|
|
381
|
-
});
|
|
376
|
+
this.$revealer = $revealer;
|
|
377
|
+
this.children_id = this.$revealer.data('revealer-children-id');
|
|
378
|
+
this.$all_children = $('[data-revealer-id="' + this.children_id + '"]');
|
|
379
|
+
this.bindEvent();
|
|
382
380
|
revealer.reveal();
|
|
383
381
|
},
|
|
384
382
|
reveal: function(){
|
|
@@ -413,6 +411,12 @@ var initHooch = function(){
|
|
|
413
411
|
},
|
|
414
412
|
revealChosenOnes: function(){
|
|
415
413
|
$.each(this.$children,function(){ $(this).show(); });
|
|
414
|
+
},
|
|
415
|
+
bindEvent: function(){
|
|
416
|
+
var revealer = this;
|
|
417
|
+
this.$revealer.bind('change',function(){
|
|
418
|
+
revealer.reveal();
|
|
419
|
+
});
|
|
416
420
|
}
|
|
417
421
|
}),
|
|
418
422
|
TabGroup: Class.extend({
|
|
@@ -723,7 +727,8 @@ var initHooch = function(){
|
|
|
723
727
|
FakeOption: Class.extend({
|
|
724
728
|
init: function($fake_option,$fake_select){
|
|
725
729
|
this.select_value = $fake_option.data('select-value')
|
|
726
|
-
this.select_name
|
|
730
|
+
this.select_name = $fake_option.data('select-name')
|
|
731
|
+
this.$fake_option = $fake_option
|
|
727
732
|
var fake_option = this
|
|
728
733
|
$fake_option.on('click',function(){
|
|
729
734
|
$fake_select.select(fake_option)
|
|
@@ -1377,6 +1382,76 @@ var initHooch = function(){
|
|
|
1377
1382
|
form.submit();
|
|
1378
1383
|
}
|
|
1379
1384
|
});
|
|
1385
|
+
hooch.FakeSelectRevealer = hooch.Revealer.extend({
|
|
1386
|
+
init: function($fake_select){
|
|
1387
|
+
this.select_display = $fake_select.find('[data-select-display]')
|
|
1388
|
+
this.real_select = $fake_select.find('input')
|
|
1389
|
+
var fake_select = this
|
|
1390
|
+
this.select_options = []
|
|
1391
|
+
$fake_select.find('[data-select-value][data-select-name]').each(function(){
|
|
1392
|
+
fake_select.select_options.push(new hooch.FakeOption($(this), fake_select));
|
|
1393
|
+
})
|
|
1394
|
+
this.children_id = $fake_select.data('revealer-children-id');
|
|
1395
|
+
this.highlander = $fake_select.data('revealer-highlander');
|
|
1396
|
+
this.$revelation_target = $('[data-revealer-target="' + this.children_id + '"]');
|
|
1397
|
+
this._super($fake_select);
|
|
1398
|
+
},
|
|
1399
|
+
select: function(fake_option){
|
|
1400
|
+
this.select_display.html(fake_option.select_name);
|
|
1401
|
+
this.real_select.val(fake_option.select_value);
|
|
1402
|
+
this.select_display.trigger('click');
|
|
1403
|
+
},
|
|
1404
|
+
bindEvent: function(){
|
|
1405
|
+
var revealer = this;
|
|
1406
|
+
$.each(this.select_options, function(){
|
|
1407
|
+
this.$fake_option.bind('click', function(){
|
|
1408
|
+
revealer.reveal();
|
|
1409
|
+
})
|
|
1410
|
+
})
|
|
1411
|
+
},
|
|
1412
|
+
reveal: function(){
|
|
1413
|
+
var sanitized_value = this.real_select.val()
|
|
1414
|
+
if('true' == sanitized_value){ sanitized_value = true }
|
|
1415
|
+
if('false' == sanitized_value){ sanitized_value = false }
|
|
1416
|
+
this.$children = [];
|
|
1417
|
+
var revealer = this;
|
|
1418
|
+
this.$all_children.each(function(){
|
|
1419
|
+
var triggers = $(this).data('revealer-triggers');
|
|
1420
|
+
if(triggers){
|
|
1421
|
+
trigger_prototype = typeof(triggers)
|
|
1422
|
+
if(trigger_prototype.toLowerCase() == 'string'){
|
|
1423
|
+
var revelation_triggers = eval('(' + triggers + ')');
|
|
1424
|
+
} else {
|
|
1425
|
+
revelation_triggers = triggers
|
|
1426
|
+
}
|
|
1427
|
+
if($.inArray(sanitized_value,revelation_triggers) > -1){
|
|
1428
|
+
revealer.$children.push($(this));
|
|
1429
|
+
}
|
|
1430
|
+
} else {
|
|
1431
|
+
if(sanitized_value == $(this).data('revealer-trigger')){
|
|
1432
|
+
revealer.$children.push($(this));
|
|
1433
|
+
}
|
|
1434
|
+
}
|
|
1435
|
+
})
|
|
1436
|
+
this.hideChildren();
|
|
1437
|
+
this.revealChosenOnes();
|
|
1438
|
+
},
|
|
1439
|
+
hideChildren: function(){
|
|
1440
|
+
this._super();
|
|
1441
|
+
if (this.highlander){
|
|
1442
|
+
this.$form = this.$revealer.parents('form:first')
|
|
1443
|
+
if(this.$form.length > 0){
|
|
1444
|
+
this.$form.after(this.$all_children)
|
|
1445
|
+
}
|
|
1446
|
+
}
|
|
1447
|
+
},
|
|
1448
|
+
revealChosenOnes: function(){
|
|
1449
|
+
if (this.highlander){
|
|
1450
|
+
this.$revelation_target.html(this.$children);
|
|
1451
|
+
}
|
|
1452
|
+
this._super();
|
|
1453
|
+
}
|
|
1454
|
+
});
|
|
1380
1455
|
hooch.FormFieldRevealer = hooch.Revealer.extend({
|
|
1381
1456
|
init: function($revealer){
|
|
1382
1457
|
this.children_id = $revealer.data('revealer-children-id');
|
data/lib/hooch/hooch_helper.rb
CHANGED
|
@@ -74,7 +74,10 @@ module Hooch
|
|
|
74
74
|
''.tap do |attrs|
|
|
75
75
|
attrs.concat "data-revealer=true data-revealer-children-id=\"#{id}\""
|
|
76
76
|
attrs.concat " data-sub-type=\"#{type}\"" if type.present?
|
|
77
|
-
|
|
77
|
+
if highlander
|
|
78
|
+
attrs.concat " data-sub-type=FormFieldRevealer"
|
|
79
|
+
attrs.concat " data-revealer-highlander=\"true\""
|
|
80
|
+
end
|
|
78
81
|
end.html_safe
|
|
79
82
|
end
|
|
80
83
|
|
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.
|
|
4
|
+
version: 0.11.0
|
|
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-08-
|
|
11
|
+
date: 2016-08-10 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rails
|