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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9736ab492a88b15f47a3289383515d6089eb72d2
4
- data.tar.gz: 06737c9cf83160f3cea669c2f16dc55f7dede0f8
3
+ metadata.gz: e796b59257a37fb263c448e9ee2ad8727f0a2876
4
+ data.tar.gz: 54caf3505ce63a22068c91a960d743a46a922715
5
5
  SHA512:
6
- metadata.gz: 57b2018f2882fa6c57ad56ecb7d3cd44dc01fc306581fd0a65019f670385349924d07d80c585f22bc941cbc465f4bef70b26154f5edcb92db93cb43c9ad31d63
7
- data.tar.gz: 491402c667f5c85f0fdca3de4800972545991cdcba62b52667633a2815be15aa08815820d7e738fd960a4e99d5b5b1a80b07e19c026ac8b235097b4d17a7be13
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
- select: function(fake_option){
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.select_display = $fake_select.find('[data-select-display]')
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.select_options, function(){
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
@@ -1,3 +1,3 @@
1
1
  module Hooch
2
- VERSION = "0.14.6"
2
+ VERSION = "0.14.7"
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.14.6
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-13 00:00:00.000000000 Z
11
+ date: 2017-03-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails