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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 230ed67a149ea37899dd8a89764b3007121ca1b9
4
- data.tar.gz: 11b0cff64e48340b953966e505177e8b4b71e64c
3
+ metadata.gz: 93b96eb7f13d6aec3d79b49367a539a920dae92d
4
+ data.tar.gz: 5eb75ff7dc663d8e1009acb460e03a566779eed1
5
5
  SHA512:
6
- metadata.gz: a238a84393f6d90a38f8f4dc065102f59546ce347493d27cdd9b99a6a796b75fb1c9978cd33019a92315af088053e28bebff27810a370ec6bae0b1ce4c008dc0
7
- data.tar.gz: f3b39a65b6b428cb6a8a19a940ab9d15ec76b6be853cadb75d5d231c44301dbd815d27f298c6057e9e833f7b50bef958fee3371990dae9bd8b9d4339acfb3b2e
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
- select: function(fake_option){
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.select_display = $fake_select.find('[data-select-display]')
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.select_options, function(){
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
@@ -1,3 +1,3 @@
1
1
  module Hooch
2
- VERSION = "0.15.0"
2
+ VERSION = "0.15.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hooch
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.15.0
4
+ version: 0.15.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Draut