app/assets/javascripts/hooch.js in hooch-0.14.0 vs app/assets/javascripts/hooch.js in hooch-0.14.1

- old
+ new

@@ -395,11 +395,11 @@ this.$all_children = $('[data-revealer-id="' + this.children_id + '"]'); this.bindEvent(); revealer.reveal(); }, reveal: function(){ - var sanitized_value = this.$revealer.val(); + var sanitized_value = this.getSanitizedValue(); if('true' == sanitized_value){ sanitized_value = true } if('false' == sanitized_value){ sanitized_value = false } this.$children = []; var revealer = this; this.$all_children.each(function(){ @@ -417,14 +417,22 @@ } else { if(sanitized_value == $(this).data('revealer-trigger')){ revealer.$children.push($(this)); } } - }) + }); this.hideChildren(); this.revealChosenOnes(); }, + getSanitizedValue: function(){ + if(this.$revealer[0].nodeName.toLowerCase() == "select"){ + var sanitized_value = this.$revealer.val(); + } else if(this.$revealer[0].nodeName.toLowerCase() == "input" && this.$revealer.attr('type') == "checkbox"){ + var sanitized_value = this.$revealer.is(':checked'); + } + return sanitized_value; + }, hideChildren: function(){ this.$all_children.hide(); }, revealChosenOnes: function(){ $.each(this.$children,function(){ $(this).show(); }); @@ -587,15 +595,15 @@ addKeyValue: function(key,value){ this.addState(key,value) this.setNewParams() }, setNewParams: function(){ - history['replaceState'](this.state, null, this.toUrl()); + history['replaceState'](this.state, null, this.toUrl()); }, replacePath: function(new_path){ this.addPath(new_path) - history['replaceState']({}, null, this.newPath()); + history['replaceState']({}, null, this.newPath()); } }), HistoryPusher: Class.extend({ init: function($history_pusher){ this.$history_pusher = $history_pusher @@ -651,10 +659,10 @@ pushIt: function(){ this.getNewParams() var history_pusher = this history_pusher.current_state = new hooch.IhHistoryState(history.state) $.each(this.new_params,function(new_key,new_value){ - history_pusher.current_state.addState(new_key,new_value) + history_pusher.current_state.addState(new_key,new_value) }) history_pusher.current_state.setNewParams() } }), HistoryReplacer: Class.extend({