app/assets/javascripts/hooch.js in hooch-0.0.6 vs app/assets/javascripts/hooch.js in hooch-0.0.7
- old
+ new
@@ -441,10 +441,36 @@
e.preventDefault();
this.target.val(this.value);
return false;
}
}),
+ CheckboxProxy: Class.extend({
+ init: function($proxy){
+ this.$proxy = $proxy;
+ this.target = $($proxy.data('target'));
+ var checkbox_proxy = this;
+ if(checkbox_proxy.target.prop('checked')){
+ this.$proxy.html("✓");
+ }
+ $proxy.on('click',function(){
+ debugger
+ if(checkbox_proxy.target.prop('checked')){
+ checkbox_proxy.uncheck();
+ }else{
+ checkbox_proxy.check();
+ }
+ })
+ },
+ uncheck: function(){
+ this.target.prop('checked', false);
+ this.$proxy.html("");
+ },
+ check: function(){
+ this.target.prop('checked', true);
+ this.$proxy.html("✓");
+ }
+ }),
Remover: Class.extend({
init: function($remover){
$target = $($remover.data('target'));
$remover.click(function(e){
$target.remove();
@@ -618,10 +644,10 @@
'expand-state' : 'Expandable', 'prevent-double-click' : 'PreventDoubleLinkClick'
},'hooch');
window.any_time_manager.registerList(
['hover_overflow','hidey_button','submit-proxy','click-proxy','field-filler','revealer',
'checkbox-hidden-proxy','prevent-double-submit','prevent-double-link-click', 'tab-group',
- 'hover-reveal', 'emptier', 'remover'],'hooch');
+ 'hover-reveal', 'emptier', 'remover', 'checkbox-proxy'],'hooch');
window.any_time_manager.load();
};
$(document).ready(function(){
if(typeof window.any_time_manager === "undefined" && typeof window.loading_any_time_manager === "undefined"){
window.loading_any_time_manager = true;