hooch 0.15.3 → 0.15.4
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 +22 -6
- data/lib/hooch/hooch_helper.rb +12 -0
- 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: 3c8bd4c9482fc1cb446fa693462b3fe6ac7f8589
|
4
|
+
data.tar.gz: 10683b7e2341b5f54d93b77b4dcdb396b68c15eb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 186ce511926dcd7179857b5243b08b3c6f3371e589be7b071198cdca77afa3664fbcc79a9b12ad22eb7236c5a710452d4a030574f5b42b553fb46fb167ef1d59
|
7
|
+
data.tar.gz: eebf9f0eeda2aa63d894e22ba58e45b6669401573fd0f8996afbe71191a079c46bb52082573c74135f43c2c456d09a4eeda495370b831c8166890b9f26dc09e6
|
@@ -840,21 +840,28 @@ var initHooch = function(){
|
|
840
840
|
init: function($fake_checkbox){
|
841
841
|
this.$fake_checkbox = $fake_checkbox
|
842
842
|
this.$form = this.getForm()
|
843
|
+
this.prepDeselectors()
|
843
844
|
this.$field = this.getField()
|
844
845
|
var fake_checkbox = this
|
845
846
|
this.$fake_checkbox.click(function(){ fake_checkbox.change() })
|
846
847
|
},
|
847
848
|
change: function(){
|
848
849
|
if(this.$fake_checkbox.hasClass('checked')){
|
849
|
-
this
|
850
|
-
this.removeCheckedFromForm()
|
851
|
-
this.removeValue()
|
850
|
+
this.deselect()
|
852
851
|
} else {
|
853
|
-
this
|
854
|
-
this.addCheckedToForm()
|
855
|
-
this.addValue()
|
852
|
+
this.select()
|
856
853
|
}
|
857
854
|
},
|
855
|
+
deselect: function(){
|
856
|
+
this.$fake_checkbox.removeClass('checked')
|
857
|
+
this.removeCheckedFromForm()
|
858
|
+
this.removeValue()
|
859
|
+
},
|
860
|
+
select: function(){
|
861
|
+
this.$fake_checkbox.addClass('checked')
|
862
|
+
this.addCheckedToForm()
|
863
|
+
this.addValue()
|
864
|
+
},
|
858
865
|
getField: function(){
|
859
866
|
this.field_name = this.$fake_checkbox.data('field-name')
|
860
867
|
this.value = this.$fake_checkbox.data('field-value')
|
@@ -888,6 +895,15 @@ var initHooch = function(){
|
|
888
895
|
}
|
889
896
|
return $form
|
890
897
|
},
|
898
|
+
prepDeselectors: function(){
|
899
|
+
var $deselector = this.$form.find('[data-fake-deselector]')
|
900
|
+
var fake_checkbox = this
|
901
|
+
$deselector.on('click', function(){
|
902
|
+
if(fake_checkbox.$fake_checkbox.hasClass('checked')){
|
903
|
+
fake_checkbox.deselect()
|
904
|
+
}
|
905
|
+
})
|
906
|
+
},
|
891
907
|
addValue: function(){
|
892
908
|
this.$form.append(this.$field)
|
893
909
|
this.possiblyShowForm()
|
data/lib/hooch/hooch_helper.rb
CHANGED
@@ -174,6 +174,18 @@ module Hooch
|
|
174
174
|
params['data-toggle-form'] = toggle_form if toggle_form
|
175
175
|
end
|
176
176
|
end
|
177
|
+
|
178
|
+
def fake_deselect
|
179
|
+
{}.tap do |params|
|
180
|
+
params['data-fake-deselector'] = true
|
181
|
+
end
|
182
|
+
end
|
183
|
+
|
184
|
+
def fake_deselect_attrs
|
185
|
+
''.tap do |attrs|
|
186
|
+
attrs.concat 'data-fake-deselector=true'
|
187
|
+
end
|
188
|
+
end
|
177
189
|
|
178
190
|
def field_filler(target, value)
|
179
191
|
''.tap do |attrs|
|
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.15.
|
4
|
+
version: 0.15.4
|
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-
|
11
|
+
date: 2017-08-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|