hooch 0.14.7 → 0.15.0
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 +28 -54
- data/lib/hooch/hooch_helper.rb +2 -2
- data/lib/hooch/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 230ed67a149ea37899dd8a89764b3007121ca1b9
|
4
|
+
data.tar.gz: 11b0cff64e48340b953966e505177e8b4b71e64c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a238a84393f6d90a38f8f4dc065102f59546ce347493d27cdd9b99a6a796b75fb1c9978cd33019a92315af088053e28bebff27810a370ec6bae0b1ce4c008dc0
|
7
|
+
data.tar.gz: f3b39a65b6b428cb6a8a19a940ab9d15ec76b6be853cadb75d5d231c44301dbd815d27f298c6057e9e833f7b50bef958fee3371990dae9bd8b9d4339acfb3b2e
|
@@ -113,7 +113,7 @@ var initHooch = function(){
|
|
113
113
|
this.$modal_content = $($modal_trigger.data('content-target'))
|
114
114
|
var modal_trigger = this
|
115
115
|
$modal_trigger.on('click', function(){
|
116
|
-
new hooch.Modal(modal_trigger.$modal_content
|
116
|
+
new hooch.Modal(modal_trigger.$modal_content)
|
117
117
|
})
|
118
118
|
}
|
119
119
|
}),
|
@@ -130,56 +130,38 @@ var initHooch = function(){
|
|
130
130
|
Modal: Class.extend({
|
131
131
|
init: function($modal_content){
|
132
132
|
this.$modal_content = $modal_content
|
133
|
-
this.setGeometry()
|
134
133
|
this.getMask()
|
135
|
-
this.getModal()
|
136
134
|
this.getDismisser()
|
137
135
|
this.getContentWrapper()
|
138
136
|
this.disableScroll()
|
137
|
+
this.$modal_content.trigger('modalInitialized')
|
139
138
|
this.$modal_mask.show()
|
139
|
+
this.$modal_content.trigger('modalVisible')
|
140
140
|
},
|
141
|
-
|
142
|
-
this.margin = 30;
|
143
|
-
this.padding = 30;
|
141
|
+
getMask: function(){
|
144
142
|
this.mask_top = $(window).scrollTop()
|
145
143
|
this.mask_height = $(window).height()
|
146
|
-
this.modal_height = this.mask_height - (this.margin*2)
|
147
|
-
},
|
148
|
-
getMask: function(){
|
149
144
|
this.$modal_mask = $('#hooch-mask')
|
150
145
|
this.$modal_mask.css({height: this.mask_height + 'px', top: this.mask_top + 'px',
|
151
146
|
position: 'absolute', 'z-index': 100000,
|
152
|
-
left: 0, right: 0, bottom: 0
|
153
|
-
'background-color': 'rgba(0,0,0,0.5)'
|
147
|
+
left: 0, right: 0, bottom: 0
|
154
148
|
})
|
155
149
|
},
|
156
|
-
getModal: function(){
|
157
|
-
this.$modal_element = this.$modal_mask.find('#hooch-modal')
|
158
|
-
this.$modal_element.css({'max-height': this.modal_height,
|
159
|
-
'margin-top': this.margin, 'margin-bottom': this.margin,
|
160
|
-
'padding-bottom': this.padding, 'padding-left': this.padding, 'padding-right': this.padding,
|
161
|
-
position: 'relative', float: 'left', 'margin-left': '50%',
|
162
|
-
'-webkit-transform': 'translateX(-50%)',
|
163
|
-
'-moz-transform': 'translateX(-50%)',
|
164
|
-
'-ms-transform': 'translateX(-50%)',
|
165
|
-
'-o-transform': 'translateX(-50%)',
|
166
|
-
transform: 'translateX(-50%)'})
|
167
|
-
},
|
168
150
|
getContentWrapper: function(){
|
169
|
-
this.$
|
170
|
-
|
171
|
-
this.$
|
172
|
-
this.$modal_content_wrapper.html(this.$modal_content)
|
151
|
+
this.$modal_element = this.$modal_mask.find('#hooch-modal')
|
152
|
+
this.$modal_element.append(this.$modal_content)
|
153
|
+
this.$modal_content.show()
|
173
154
|
},
|
174
155
|
getDismisser: function(){
|
175
156
|
this.$dismisser = this.$modal_mask.find('#hooch-dismiss')
|
176
|
-
this.$dismisser.css({position: 'relative', float: 'right', 'font-size': '22px', 'line-height': '30px'})
|
177
157
|
this.dismisser = new hooch.ModalDismisser(this.$dismisser,this)
|
158
|
+
this.$modal_content.append(this.$dismisser)
|
178
159
|
},
|
179
160
|
close: function(){
|
180
161
|
this.$modal_mask.hide()
|
181
|
-
this.$
|
162
|
+
this.$modal_content.hide()
|
182
163
|
this.enableScroll()
|
164
|
+
this.$modal_content.trigger('modalClosed')
|
183
165
|
},
|
184
166
|
disableScroll: function(){
|
185
167
|
var modal = this
|
@@ -921,33 +903,17 @@ var initHooch = function(){
|
|
921
903
|
}),
|
922
904
|
FakeSelect: Class.extend({
|
923
905
|
init: function($fake_select){
|
924
|
-
this.all_options = []
|
925
906
|
this.select_display = $fake_select.find('[data-select-display]')
|
926
907
|
this.real_select = $fake_select.find('input')
|
927
908
|
var fake_select = this
|
928
909
|
$fake_select.find('[data-select-value][data-select-name]').each(function(){
|
929
|
-
|
910
|
+
new hooch.FakeOption($(this),fake_select)
|
930
911
|
})
|
931
|
-
if(this.real_select.val() != "" && typeof(this.real_select.val()) != "undefined"){
|
932
|
-
this.initial_select(this.findOptionForValue(this.real_select.val()));
|
933
|
-
}
|
934
912
|
},
|
935
|
-
|
913
|
+
select: function(fake_option){
|
936
914
|
this.select_display.html(fake_option.select_name);
|
937
915
|
this.real_select.val(fake_option.select_value);
|
938
|
-
},
|
939
|
-
select: function(fake_option){
|
940
|
-
this.initial_select(fake_option);
|
941
916
|
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;
|
951
917
|
}
|
952
918
|
}),
|
953
919
|
FakeOption: Class.extend({
|
@@ -956,7 +922,7 @@ var initHooch = function(){
|
|
956
922
|
this.select_name = $fake_option.data('select-name')
|
957
923
|
this.$fake_option = $fake_option
|
958
924
|
var fake_option = this
|
959
|
-
$fake_option.on('click',
|
925
|
+
$fake_option.on('click',function(){
|
960
926
|
$fake_select.select(fake_option)
|
961
927
|
})
|
962
928
|
}
|
@@ -1623,22 +1589,33 @@ var initHooch = function(){
|
|
1623
1589
|
});
|
1624
1590
|
hooch.FakeSelectRevealer = hooch.Revealer.extend({
|
1625
1591
|
init: function($fake_select){
|
1626
|
-
this.
|
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
|
+
})
|
1627
1599
|
this.children_id = $fake_select.data('revealer-children-id');
|
1628
1600
|
this.highlander = $fake_select.data('revealer-highlander');
|
1629
1601
|
this.$revelation_target = $('[data-revealer-target="' + this.children_id + '"]');
|
1630
1602
|
this._super($fake_select);
|
1631
1603
|
},
|
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
|
+
},
|
1632
1609
|
bindEvent: function(){
|
1633
1610
|
var revealer = this;
|
1634
|
-
$.each(this.
|
1611
|
+
$.each(this.select_options, function(){
|
1635
1612
|
this.$fake_option.bind('click', function(){
|
1636
1613
|
revealer.reveal();
|
1637
1614
|
})
|
1638
1615
|
})
|
1639
1616
|
},
|
1640
1617
|
reveal: function(){
|
1641
|
-
var sanitized_value = this.
|
1618
|
+
var sanitized_value = this.real_select.val()
|
1642
1619
|
if('true' == sanitized_value){ sanitized_value = true }
|
1643
1620
|
if('false' == sanitized_value){ sanitized_value = false }
|
1644
1621
|
this.$children = [];
|
@@ -1664,9 +1641,6 @@ var initHooch = function(){
|
|
1664
1641
|
this.hideChildren();
|
1665
1642
|
this.revealChosenOnes();
|
1666
1643
|
},
|
1667
|
-
getSanitizedValue: function(){
|
1668
|
-
return this.real_select.val();
|
1669
|
-
},
|
1670
1644
|
hideChildren: function(){
|
1671
1645
|
this._super();
|
1672
1646
|
if (this.highlander){
|
data/lib/hooch/hooch_helper.rb
CHANGED
@@ -25,8 +25,8 @@ module Hooch
|
|
25
25
|
end
|
26
26
|
|
27
27
|
def modal_trigger(target)
|
28
|
-
attrs = 'data-modal-trigger=
|
29
|
-
attrs += " data-content-target
|
28
|
+
attrs = 'data-modal-trigger=true'
|
29
|
+
attrs += " data-content-target=#{target}"
|
30
30
|
end
|
31
31
|
|
32
32
|
def hide_show(target, any_click_closes: false)
|
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.
|
4
|
+
version: 0.15.0
|
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-05-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -168,7 +168,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
168
168
|
version: '0'
|
169
169
|
requirements: []
|
170
170
|
rubyforge_project:
|
171
|
-
rubygems_version: 2.
|
171
|
+
rubygems_version: 2.6.11
|
172
172
|
signing_key:
|
173
173
|
specification_version: 4
|
174
174
|
summary: Tools for building a browser UI. Get the good stuff.
|