hooch 0.14.6 → 0.14.7
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 +25 -17
- 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: e796b59257a37fb263c448e9ee2ad8727f0a2876
|
4
|
+
data.tar.gz: 54caf3505ce63a22068c91a960d743a46a922715
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c0c55ada1df470d60fe21b45d4be586f8c45ccc69850bb2bb954e7fdaa57097581340a6e6a8812d706e605044bc386000b7cf2f5064360c95880d58acf633677
|
7
|
+
data.tar.gz: 339dee853aedd515838d1421cecc933ca223512077d533d7f9aacf233a078e13ff7c0f2893a51fae8b4e2493324d87a10fe4ffa213b33abc4d41050d99599b6c
|
@@ -921,17 +921,33 @@ var initHooch = function(){
|
|
921
921
|
}),
|
922
922
|
FakeSelect: Class.extend({
|
923
923
|
init: function($fake_select){
|
924
|
+
this.all_options = []
|
924
925
|
this.select_display = $fake_select.find('[data-select-display]')
|
925
926
|
this.real_select = $fake_select.find('input')
|
926
927
|
var fake_select = this
|
927
928
|
$fake_select.find('[data-select-value][data-select-name]').each(function(){
|
928
|
-
new hooch.FakeOption($(this),fake_select)
|
929
|
+
fake_select.all_options.push(new hooch.FakeOption($(this), fake_select));
|
929
930
|
})
|
931
|
+
if(this.real_select.val() != "" && typeof(this.real_select.val()) != "undefined"){
|
932
|
+
this.initial_select(this.findOptionForValue(this.real_select.val()));
|
933
|
+
}
|
930
934
|
},
|
931
|
-
|
935
|
+
initial_select: function(fake_option){
|
932
936
|
this.select_display.html(fake_option.select_name);
|
933
937
|
this.real_select.val(fake_option.select_value);
|
938
|
+
},
|
939
|
+
select: function(fake_option){
|
940
|
+
this.initial_select(fake_option);
|
934
941
|
this.select_display.trigger('click');
|
942
|
+
},
|
943
|
+
findOptionForValue: function(value){
|
944
|
+
var selected_option
|
945
|
+
$.each(this.all_options, function(i, option){
|
946
|
+
if(option.select_value == value){
|
947
|
+
selected_option = option
|
948
|
+
}
|
949
|
+
});
|
950
|
+
return selected_option;
|
935
951
|
}
|
936
952
|
}),
|
937
953
|
FakeOption: Class.extend({
|
@@ -940,7 +956,7 @@ var initHooch = function(){
|
|
940
956
|
this.select_name = $fake_option.data('select-name')
|
941
957
|
this.$fake_option = $fake_option
|
942
958
|
var fake_option = this
|
943
|
-
$fake_option.on('click',function(){
|
959
|
+
$fake_option.on('click', function(){
|
944
960
|
$fake_select.select(fake_option)
|
945
961
|
})
|
946
962
|
}
|
@@ -1607,33 +1623,22 @@ var initHooch = function(){
|
|
1607
1623
|
});
|
1608
1624
|
hooch.FakeSelectRevealer = hooch.Revealer.extend({
|
1609
1625
|
init: function($fake_select){
|
1610
|
-
this.
|
1611
|
-
this.real_select = $fake_select.find('input')
|
1612
|
-
var fake_select = this
|
1613
|
-
this.select_options = []
|
1614
|
-
$fake_select.find('[data-select-value][data-select-name]').each(function(){
|
1615
|
-
fake_select.select_options.push(new hooch.FakeOption($(this), fake_select));
|
1616
|
-
})
|
1626
|
+
this.fake_select = new hooch.FakeSelect($fake_select)
|
1617
1627
|
this.children_id = $fake_select.data('revealer-children-id');
|
1618
1628
|
this.highlander = $fake_select.data('revealer-highlander');
|
1619
1629
|
this.$revelation_target = $('[data-revealer-target="' + this.children_id + '"]');
|
1620
1630
|
this._super($fake_select);
|
1621
1631
|
},
|
1622
|
-
select: function(fake_option){
|
1623
|
-
this.select_display.html(fake_option.select_name);
|
1624
|
-
this.real_select.val(fake_option.select_value);
|
1625
|
-
this.select_display.trigger('click');
|
1626
|
-
},
|
1627
1632
|
bindEvent: function(){
|
1628
1633
|
var revealer = this;
|
1629
|
-
$.each(this.
|
1634
|
+
$.each(this.fake_select.all_options, function(){
|
1630
1635
|
this.$fake_option.bind('click', function(){
|
1631
1636
|
revealer.reveal();
|
1632
1637
|
})
|
1633
1638
|
})
|
1634
1639
|
},
|
1635
1640
|
reveal: function(){
|
1636
|
-
var sanitized_value = this.real_select.val()
|
1641
|
+
var sanitized_value = this.fake_select.real_select.val()
|
1637
1642
|
if('true' == sanitized_value){ sanitized_value = true }
|
1638
1643
|
if('false' == sanitized_value){ sanitized_value = false }
|
1639
1644
|
this.$children = [];
|
@@ -1659,6 +1664,9 @@ var initHooch = function(){
|
|
1659
1664
|
this.hideChildren();
|
1660
1665
|
this.revealChosenOnes();
|
1661
1666
|
},
|
1667
|
+
getSanitizedValue: function(){
|
1668
|
+
return this.real_select.val();
|
1669
|
+
},
|
1662
1670
|
hideChildren: function(){
|
1663
1671
|
this._super();
|
1664
1672
|
if (this.highlander){
|
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.14.
|
4
|
+
version: 0.14.7
|
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-03-
|
11
|
+
date: 2017-03-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|