hooch 0.15.0 → 0.15.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/hooch.js +25 -17
- data/lib/hooch/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 93b96eb7f13d6aec3d79b49367a539a920dae92d
|
4
|
+
data.tar.gz: 5eb75ff7dc663d8e1009acb460e03a566779eed1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ecb856aae0725b6eb84a159c2969069f18abb90830a06545a00c7a706e266a2ae2a9e8de7617ccdea248ea4b81546b4ed50df02e93a589d9722b46129eeab5e8
|
7
|
+
data.tar.gz: ff8fde9f1adf1356ce6d235f07709e3c31ec2eb76fdc7c5acac3e203dc6982946074037ab779b5fa2c63688d8b8f2c8856a066d5c83a6f582066b2c681efc12f
|
@@ -903,17 +903,33 @@ var initHooch = function(){
|
|
903
903
|
}),
|
904
904
|
FakeSelect: Class.extend({
|
905
905
|
init: function($fake_select){
|
906
|
+
this.all_options = []
|
906
907
|
this.select_display = $fake_select.find('[data-select-display]')
|
907
908
|
this.real_select = $fake_select.find('input')
|
908
909
|
var fake_select = this
|
909
910
|
$fake_select.find('[data-select-value][data-select-name]').each(function(){
|
910
|
-
new hooch.FakeOption($(this),fake_select)
|
911
|
+
fake_select.all_options.push(new hooch.FakeOption($(this), fake_select));
|
911
912
|
})
|
913
|
+
if(this.real_select.val() != "" && typeof(this.real_select.val()) != "undefined"){
|
914
|
+
this.initial_select(this.findOptionForValue(this.real_select.val()));
|
915
|
+
}
|
912
916
|
},
|
913
|
-
|
917
|
+
initial_select: function(fake_option){
|
914
918
|
this.select_display.html(fake_option.select_name);
|
915
919
|
this.real_select.val(fake_option.select_value);
|
920
|
+
},
|
921
|
+
select: function(fake_option){
|
922
|
+
this.initial_select(fake_option);
|
916
923
|
this.select_display.trigger('click');
|
924
|
+
},
|
925
|
+
findOptionForValue: function(value){
|
926
|
+
var selected_option
|
927
|
+
$.each(this.all_options, function(i, option){
|
928
|
+
if(option.select_value == value){
|
929
|
+
selected_option = option
|
930
|
+
}
|
931
|
+
});
|
932
|
+
return selected_option;
|
917
933
|
}
|
918
934
|
}),
|
919
935
|
FakeOption: Class.extend({
|
@@ -922,7 +938,7 @@ var initHooch = function(){
|
|
922
938
|
this.select_name = $fake_option.data('select-name')
|
923
939
|
this.$fake_option = $fake_option
|
924
940
|
var fake_option = this
|
925
|
-
$fake_option.on('click',function(){
|
941
|
+
$fake_option.on('click', function(){
|
926
942
|
$fake_select.select(fake_option)
|
927
943
|
})
|
928
944
|
}
|
@@ -1589,33 +1605,22 @@ var initHooch = function(){
|
|
1589
1605
|
});
|
1590
1606
|
hooch.FakeSelectRevealer = hooch.Revealer.extend({
|
1591
1607
|
init: function($fake_select){
|
1592
|
-
this.
|
1593
|
-
this.real_select = $fake_select.find('input')
|
1594
|
-
var fake_select = this
|
1595
|
-
this.select_options = []
|
1596
|
-
$fake_select.find('[data-select-value][data-select-name]').each(function(){
|
1597
|
-
fake_select.select_options.push(new hooch.FakeOption($(this), fake_select));
|
1598
|
-
})
|
1608
|
+
this.fake_select = new hooch.FakeSelect($fake_select)
|
1599
1609
|
this.children_id = $fake_select.data('revealer-children-id');
|
1600
1610
|
this.highlander = $fake_select.data('revealer-highlander');
|
1601
1611
|
this.$revelation_target = $('[data-revealer-target="' + this.children_id + '"]');
|
1602
1612
|
this._super($fake_select);
|
1603
1613
|
},
|
1604
|
-
select: function(fake_option){
|
1605
|
-
this.select_display.html(fake_option.select_name);
|
1606
|
-
this.real_select.val(fake_option.select_value);
|
1607
|
-
this.select_display.trigger('click');
|
1608
|
-
},
|
1609
1614
|
bindEvent: function(){
|
1610
1615
|
var revealer = this;
|
1611
|
-
$.each(this.
|
1616
|
+
$.each(this.fake_select.all_options, function(){
|
1612
1617
|
this.$fake_option.bind('click', function(){
|
1613
1618
|
revealer.reveal();
|
1614
1619
|
})
|
1615
1620
|
})
|
1616
1621
|
},
|
1617
1622
|
reveal: function(){
|
1618
|
-
var sanitized_value = this.real_select.val()
|
1623
|
+
var sanitized_value = this.fake_select.real_select.val()
|
1619
1624
|
if('true' == sanitized_value){ sanitized_value = true }
|
1620
1625
|
if('false' == sanitized_value){ sanitized_value = false }
|
1621
1626
|
this.$children = [];
|
@@ -1641,6 +1646,9 @@ var initHooch = function(){
|
|
1641
1646
|
this.hideChildren();
|
1642
1647
|
this.revealChosenOnes();
|
1643
1648
|
},
|
1649
|
+
getSanitizedValue: function(){
|
1650
|
+
return this.real_select.val();
|
1651
|
+
},
|
1644
1652
|
hideChildren: function(){
|
1645
1653
|
this._super();
|
1646
1654
|
if (this.highlander){
|
data/lib/hooch/version.rb
CHANGED