hooch 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/hooch.js +608 -654
- data/lib/hooch/hooch_helper.rb +2 -2
- 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: 9f5d340b61453c7779d4c652427d934d97b7eb35
|
4
|
+
data.tar.gz: 7436f2734625d6d03764cfb97057d9e42ffca258
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ff1892a00559ecb9436cf8f49ac0f761dde648a8e680b8968876f05a3c6c3c843265f2328638c1cdee11ef04ff6341ab0008a1044d26aed1ee431d6a1be15a2e
|
7
|
+
data.tar.gz: 863e5332edfb2077382d8312f2411f0d63932380fc9cfb79bf065d0e4be363d5604bed1d8ddfa82ce0e4a065b616ba7da41bed46cbf6c9ddbb988e4bec4d6b72
|
@@ -1,686 +1,640 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
(function(){
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
(function(
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
}
|
44
|
-
|
45
|
-
// The dummy class constructor
|
46
|
-
function Class() {
|
47
|
-
// All construction is actually done in the init method
|
48
|
-
if ( !initializing && this.init )
|
49
|
-
this.init.apply(this, arguments);
|
50
|
-
}
|
51
|
-
|
52
|
-
// Populate our constructed prototype object
|
53
|
-
Class.prototype = prototype;
|
54
|
-
|
55
|
-
// Enforce the constructor to be what we expect
|
56
|
-
Class.prototype.constructor = Class;
|
57
|
-
|
58
|
-
// And make this class extendable
|
59
|
-
Class.extend = arguments.callee;
|
60
|
-
|
61
|
-
return Class;
|
62
|
-
};
|
63
|
-
})();
|
64
|
-
/*End Simple Inheritance*/
|
65
|
-
|
66
|
-
/*Begin Hooch.js*/
|
67
|
-
var Toggler = Class.extend({
|
68
|
-
init: function(jq_obj){
|
69
|
-
this.jq_obj = jq_obj;
|
70
|
-
this.label = jq_obj.data('toggler');
|
71
|
-
this.value = jq_obj.val();
|
72
|
-
this.targets = $('[data-toggle_trigger="' + this.label + '"]');
|
73
|
-
this.targets.hide();
|
74
|
-
this.targets.filter('[data-toggle_value="' + this.value + '"]').show();
|
75
|
-
}
|
76
|
-
});
|
77
|
-
|
78
|
-
var HoverOverflow = Class.extend({
|
79
|
-
init: function(jq_obj){
|
80
|
-
this.old_border = jq_obj.css('border-right');
|
81
|
-
this.old_z_index = jq_obj.css('z-index');
|
82
|
-
var hoverable = this;
|
83
|
-
jq_obj.bind('mouseover',function(){
|
84
|
-
hoverable.jq_obj.css({'overflow':'visible','z-index':'10000','border-right':'1px solid white'});
|
85
|
-
});
|
86
|
-
jq_obj.bind('mouseout',function(){
|
87
|
-
hoverable.jq_obj.css({'overflow':'hidden','z-index':hoverable.old_z_index,'border-right':hoverable.old_border});
|
88
|
-
});
|
89
|
-
}
|
90
|
-
})
|
91
|
-
|
92
|
-
var HoverReveal = Class.extend({
|
93
|
-
init: function($hover_revealer){
|
94
|
-
$revealable = $hover_revealer.data('revealable')
|
95
|
-
jq_obj.bind('mouseover',function(){
|
96
|
-
$revealable.show();
|
97
|
-
});
|
98
|
-
jq_obj.bind('mouseout',function(){
|
99
|
-
$revealable.hide();
|
100
|
-
});
|
101
|
-
|
102
|
-
}
|
103
|
-
})
|
1
|
+
var initHooch = function(){
|
2
|
+
hooch = {
|
3
|
+
Emptier: Class.extend({
|
4
|
+
init: function($emptier){
|
5
|
+
$target = $($emptier.data('target'));
|
6
|
+
$emptier.click(function(e){
|
7
|
+
$target.empty();
|
8
|
+
})
|
9
|
+
}
|
10
|
+
}),
|
11
|
+
Toggler: Class.extend({
|
12
|
+
init: function(jq_obj){
|
13
|
+
this.jq_obj = jq_obj;
|
14
|
+
this.label = jq_obj.data('toggler');
|
15
|
+
this.value = jq_obj.val();
|
16
|
+
this.targets = $('[data-toggle_trigger="' + this.label + '"]');
|
17
|
+
this.targets.hide();
|
18
|
+
this.targets.filter('[data-toggle_value="' + this.value + '"]').show();
|
19
|
+
}
|
20
|
+
}),
|
21
|
+
HoverOverflow: Class.extend({
|
22
|
+
init: function(jq_obj){
|
23
|
+
this.old_border = jq_obj.css('border-right');
|
24
|
+
this.old_z_index = jq_obj.css('z-index');
|
25
|
+
var hoverable = this;
|
26
|
+
jq_obj.bind('mouseover',function(){
|
27
|
+
hoverable.jq_obj.css({'overflow':'visible','z-index':'10000','border-right':'1px solid white'});
|
28
|
+
});
|
29
|
+
jq_obj.bind('mouseout',function(){
|
30
|
+
hoverable.jq_obj.css({'overflow':'hidden','z-index':hoverable.old_z_index,'border-right':hoverable.old_border});
|
31
|
+
});
|
32
|
+
}
|
33
|
+
}),
|
34
|
+
HoverReveal: Class.extend({
|
35
|
+
init: function($hover_revealer){
|
36
|
+
$revealable = $hover_revealer.data('revealable')
|
37
|
+
jq_obj.bind('mouseover',function(){
|
38
|
+
$revealable.show();
|
39
|
+
});
|
40
|
+
jq_obj.bind('mouseout',function(){
|
41
|
+
$revealable.hide();
|
42
|
+
});
|
104
43
|
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
44
|
+
}
|
45
|
+
}),
|
46
|
+
HideyButton: Class.extend({
|
47
|
+
init: function($hidey_button){
|
48
|
+
$hidey_button.hide();
|
49
|
+
this.form = $hidey_button.parents('form');
|
50
|
+
this.$hidey_button = $hidey_button;
|
51
|
+
this.bindInputs();
|
52
|
+
},
|
53
|
+
bindInputs: function(){
|
54
|
+
this.inputs = this.form.find('input,select,textarea');
|
55
|
+
var hidey_button = this;
|
56
|
+
this.cache_input_values();
|
57
|
+
this.inputs.each(function(){
|
58
|
+
$(this).bind("propertychange keyup input paste datechange change",function(){
|
59
|
+
if(hidey_button.form_changed()){
|
60
|
+
hidey_button.$hidey_button.show();
|
61
|
+
} else {
|
62
|
+
hidey_button.$hidey_button.hide();
|
63
|
+
}
|
64
|
+
})
|
65
|
+
});
|
66
|
+
},
|
67
|
+
cache_input_values: function(){
|
68
|
+
this.inputs.each(function(){
|
69
|
+
if($(this).is(":checkbox")){
|
70
|
+
$(this).data('oldstate',$(this).is(':checked'));
|
71
|
+
} else {
|
72
|
+
$(this).data('oldval',$(this).val());
|
73
|
+
}
|
74
|
+
})
|
75
|
+
},
|
76
|
+
form_changed: function(){
|
77
|
+
var changed = false;
|
78
|
+
this.inputs.each(function(){
|
79
|
+
if($(this).is(":checkbox")){
|
80
|
+
if($(this).data('oldstate') != $(this).is(':checked')){
|
81
|
+
changed = true;
|
82
|
+
return false;
|
83
|
+
}
|
84
|
+
}else{
|
85
|
+
if($(this).data('oldval') != $(this).val()){
|
86
|
+
changed = true;
|
87
|
+
return false;
|
88
|
+
}
|
89
|
+
}
|
90
|
+
})
|
91
|
+
return changed;
|
92
|
+
}
|
93
|
+
}),
|
94
|
+
Expandable: Class.extend({
|
95
|
+
init: function($expandable){
|
96
|
+
this.$expandable = $expandable;
|
97
|
+
$expandable.data('expandable',this);
|
98
|
+
$collapser = $('[data-expand-id="' + $expandable.data('expand-id') + '"][data-collapser]');
|
99
|
+
if($collapser.length > 0){
|
100
|
+
this.collapser = new hooch.Collapser($collapser,this);
|
101
|
+
}
|
102
|
+
this.$expander = $('[data-expand-id="' + $expandable.data('expand-id') + '"][data-expander]');
|
103
|
+
this.expander = new hooch.Expander(this.$expander,this);
|
104
|
+
this.initial_state = $expandable.data('expand-state');
|
105
|
+
if(this.initial_state == 'expanded'){
|
106
|
+
this.expand();
|
120
107
|
} else {
|
121
|
-
|
108
|
+
this.collapse();
|
122
109
|
}
|
123
|
-
}
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
if($(this).is(":checkbox")){
|
129
|
-
$(this).data('oldstate',$(this).is(':checked'));
|
130
|
-
} else {
|
131
|
-
$(this).data('oldval',$(this).val());
|
132
|
-
}
|
133
|
-
})
|
134
|
-
},
|
135
|
-
form_changed: function(){
|
136
|
-
var changed = false;
|
137
|
-
this.inputs.each(function(){
|
138
|
-
if($(this).is(":checkbox")){
|
139
|
-
if($(this).data('oldstate') != $(this).is(':checked')){
|
140
|
-
changed = true;
|
141
|
-
return false;
|
110
|
+
},
|
111
|
+
expand: function(){
|
112
|
+
if(this.collapser){
|
113
|
+
this.expander.hide();
|
114
|
+
this.collapser.show();
|
142
115
|
}
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
116
|
+
this.$expandable.show(10);
|
117
|
+
},
|
118
|
+
collapse: function(){
|
119
|
+
if(this.collapser){
|
120
|
+
this.collapser.hide();
|
121
|
+
this.expander.show();
|
147
122
|
}
|
123
|
+
this.$expandable.hide(10);
|
124
|
+
},
|
125
|
+
toggle: function(){
|
126
|
+
this.$expandable.toggle(10);
|
148
127
|
}
|
149
|
-
})
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
}
|
175
|
-
this.$expandable.show(10);
|
176
|
-
},
|
177
|
-
collapse: function(){
|
178
|
-
if(this.collapser){
|
179
|
-
this.collapser.hide();
|
180
|
-
this.expander.show();
|
181
|
-
}
|
182
|
-
this.$expandable.hide(10);
|
183
|
-
},
|
184
|
-
toggle: function(){
|
185
|
-
this.$expandable.toggle(10);
|
186
|
-
}
|
187
|
-
});
|
188
|
-
var AjaxExpandable = Expandable.extend({
|
189
|
-
expand: function(){
|
190
|
-
if(!this.ajax_loaded){
|
191
|
-
this.ajax_loaded = true;
|
192
|
-
new AjaxLinkSubmission(this.$expander);
|
193
|
-
}
|
194
|
-
this._super();
|
195
|
-
}
|
196
|
-
});
|
197
|
-
var Expander = Class.extend({
|
198
|
-
init: function($expander,target){
|
199
|
-
this.$expander = $expander;
|
200
|
-
if($expander.data('fake-dropdown')){
|
201
|
-
target.$expandable.on('click',function(){
|
202
|
-
target.toggle();
|
203
|
-
})
|
204
|
-
target.$expandable.on('mouseleave',function(){
|
205
|
-
target.collapse();
|
206
|
-
})
|
207
|
-
}
|
208
|
-
$expander.bind('click',function(){
|
209
|
-
if(target.collapser){
|
210
|
-
target.expand();
|
211
|
-
} else {
|
212
|
-
target.toggle();
|
128
|
+
}),
|
129
|
+
Expander: Class.extend({
|
130
|
+
init: function($expander,target){
|
131
|
+
this.$expander = $expander;
|
132
|
+
if($expander.data('fake-dropdown')){
|
133
|
+
target.$expandable.on('click',function(){
|
134
|
+
target.toggle();
|
135
|
+
})
|
136
|
+
target.$expandable.on('mouseleave',function(){
|
137
|
+
target.collapse();
|
138
|
+
})
|
139
|
+
}
|
140
|
+
$expander.bind('click',function(){
|
141
|
+
if(target.collapser){
|
142
|
+
target.expand();
|
143
|
+
} else {
|
144
|
+
target.toggle();
|
145
|
+
}
|
146
|
+
})
|
147
|
+
},
|
148
|
+
hide: function(){
|
149
|
+
this.$expander.hide();
|
150
|
+
},
|
151
|
+
show: function(){
|
152
|
+
this.$expander.show();
|
213
153
|
}
|
214
|
-
})
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
})
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
154
|
+
}),
|
155
|
+
Collapser: Class.extend({
|
156
|
+
init: function($collapser,target){
|
157
|
+
this.$collapser = $collapser;
|
158
|
+
$collapser.bind('click',function(){
|
159
|
+
target.collapse();
|
160
|
+
})
|
161
|
+
},
|
162
|
+
hide: function(){
|
163
|
+
this.$collapser.hide();
|
164
|
+
},
|
165
|
+
show: function(){
|
166
|
+
this.$collapser.show();
|
167
|
+
}
|
168
|
+
}),
|
169
|
+
DisableForms: Class.extend({
|
170
|
+
init: function($disable_container){
|
171
|
+
$disable_container.find('input, select').each(function(){
|
172
|
+
$(this).prop('disabled',true);
|
173
|
+
});
|
174
|
+
}
|
175
|
+
}),
|
176
|
+
Revealer: Class.extend({
|
177
|
+
init: function($revealer){
|
178
|
+
var revealer = this;
|
179
|
+
this.$revealer = $revealer;
|
180
|
+
this.children_id = this.$revealer.data('revealer-children-id');
|
181
|
+
this.$all_children = $('[data-revealer_id="' + this.children_id + '"]');
|
182
|
+
$revealer.bind('change',function(){
|
183
|
+
revealer.reveal();
|
184
|
+
});
|
185
|
+
revealer.reveal();
|
186
|
+
},
|
187
|
+
reveal: function(){
|
188
|
+
var sanitized_value = this.$revealer.val();
|
189
|
+
this.$children = [];
|
190
|
+
var revealer = this;
|
191
|
+
this.$all_children.each(function(){
|
192
|
+
var triggers = $(this).data('revealer-triggers');
|
193
|
+
if(triggers){
|
194
|
+
var revelation_triggers = eval('(' + triggers + ')');
|
195
|
+
if($.inArray(sanitized_value,revelation_triggers) > -1){
|
196
|
+
revealer.$children.push($(this));
|
197
|
+
}
|
198
|
+
} else {
|
199
|
+
if(sanitized_value == $(this).data('revealer-trigger')){
|
200
|
+
revealer.$children.push($(this));
|
201
|
+
}
|
202
|
+
}
|
203
|
+
})
|
204
|
+
this.hideChildren();
|
205
|
+
this.revealChosenOnes();
|
206
|
+
},
|
207
|
+
hideChildren: function(){
|
208
|
+
this.$all_children.hide();
|
209
|
+
},
|
210
|
+
revealChosenOnes: function(){
|
211
|
+
$.each(this.$children,function(){ $(this).show(); });
|
212
|
+
}
|
213
|
+
}),
|
214
|
+
TabGroup: Class.extend({
|
215
|
+
init: function($tab_group){
|
216
|
+
this.$tab_group = $tab_group;
|
217
|
+
this.getName();
|
218
|
+
this.tab_triggers = [];
|
219
|
+
this.tab_triggers_by_id = {};
|
220
|
+
this.getTabTriggerClass();
|
221
|
+
this.createTabs();
|
222
|
+
this.getConentParent();
|
223
|
+
this.hideAll();
|
224
|
+
this.handleDefault();
|
225
|
+
hooch.TabGroup.addGroup(this);
|
226
|
+
},
|
227
|
+
createTabs: function(){
|
228
|
+
var tab_group = this;
|
229
|
+
this.$tab_group.find("[data-tab-trigger]").each(function(){
|
230
|
+
var new_tab = new tab_group.tab_trigger_class($(this),tab_group);
|
231
|
+
tab_group.tab_triggers.push(new_tab);
|
232
|
+
tab_group.tab_triggers_by_id[new_tab.tab_id] = new_tab;
|
233
|
+
})
|
234
|
+
},
|
235
|
+
getTabByPushState: function(state_value){
|
236
|
+
var selected_tab = null;
|
237
|
+
$.each(this.tab_triggers,function(index,trigger){
|
238
|
+
if(trigger.push_state == state_value){
|
239
|
+
selected_tab = trigger;
|
240
|
+
}
|
241
|
+
})
|
242
|
+
return selected_tab;
|
243
|
+
},
|
244
|
+
getName: function(){
|
245
|
+
this.name = this.$tab_group.data('tab-group');
|
246
|
+
},
|
247
|
+
getConentParent: function(){
|
248
|
+
this.$content_parent = this.tab_triggers[0].getParent();
|
249
|
+
},
|
250
|
+
handleDefault: function(){
|
251
|
+
if(this.$tab_group.data('default-tab')){
|
252
|
+
this.default_tab = this.tab_triggers_by_id[this.$tab_group.data('default-tab')];
|
253
|
+
this.default_tab.toggleTarget('replace');
|
268
254
|
}
|
269
|
-
}
|
270
|
-
|
271
|
-
|
255
|
+
},
|
256
|
+
hideAll: function(trigger){
|
257
|
+
$.each(this.tab_triggers,function(){
|
258
|
+
this.hideTarget();
|
259
|
+
})
|
260
|
+
},
|
261
|
+
getTabTriggerClass: function(){
|
262
|
+
this.tab_trigger_class = hooch.TabTrigger;
|
263
|
+
},
|
264
|
+
deactivateTabTriggers: function(){
|
265
|
+
$.each(this.tab_triggers,function(){
|
266
|
+
this.$tab_trigger.removeClass('active');
|
267
|
+
})
|
268
|
+
},
|
269
|
+
setActiveTab: function(tab_trigger){
|
270
|
+
if(this.active_tab){
|
271
|
+
var parent_height = this.$content_parent.height();
|
272
|
+
this.$content_parent.css({'height': parent_height, 'overflow': 'hidden'});
|
272
273
|
}
|
274
|
+
this.hideAll();
|
275
|
+
this.deactivateTabTriggers();
|
276
|
+
this.active_tab = tab_trigger;
|
277
|
+
tab_trigger.revealTarget();
|
278
|
+
},
|
279
|
+
resize: function(){
|
280
|
+
this.$content_parent.css({'height': 'auto', 'overflow': 'visible'});
|
281
|
+
},
|
282
|
+
getActiveTab: function(){
|
283
|
+
return this.active_tab;
|
273
284
|
}
|
274
|
-
})
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
$.each(this.tab_triggers,function(index,trigger){
|
329
|
-
if(trigger.push_state == state_value){
|
330
|
-
selected_tab = trigger;
|
285
|
+
}),
|
286
|
+
TabTrigger: Class.extend({
|
287
|
+
init: function($tab_trigger,tab_group){
|
288
|
+
this.$tab_trigger = $tab_trigger;
|
289
|
+
this.tab_group = tab_group;
|
290
|
+
this.tab_group_name = tab_group.name;
|
291
|
+
this.tab_id = $tab_trigger.data('tab-target-id');
|
292
|
+
this.getPushState();
|
293
|
+
this.getTarget();
|
294
|
+
var tab_trigger = this;
|
295
|
+
$tab_trigger.on('click', function(e){
|
296
|
+
e.preventDefault();
|
297
|
+
tab_trigger.toggleTarget()
|
298
|
+
})
|
299
|
+
},
|
300
|
+
getTarget: function(){
|
301
|
+
this.$target = $('[data-tab-id="' + this.tab_id + '"]');
|
302
|
+
},
|
303
|
+
getPushState: function(){
|
304
|
+
if(this.$tab_trigger.data('push-state') != null && this.$tab_trigger.data('push-state') != ""){
|
305
|
+
this.push_state = this.$tab_trigger.data('push-state')
|
306
|
+
}
|
307
|
+
},
|
308
|
+
toggleTarget: function(state_behavior){
|
309
|
+
var was_visible = this.$target.is(':visible');
|
310
|
+
if(!was_visible){
|
311
|
+
this.tab_group.setActiveTab(this);
|
312
|
+
this.resize();
|
313
|
+
var change_history = true;
|
314
|
+
var history_method = 'pushState'
|
315
|
+
if('no history' == state_behavior){
|
316
|
+
change_history = false
|
317
|
+
} else if('replace' == state_behavior){
|
318
|
+
history_method = 'replaceState'
|
319
|
+
}
|
320
|
+
if (this.push_state && change_history) {
|
321
|
+
var current_state = new hooch.IhHistoryState(history.state)
|
322
|
+
current_state.addState(this.tab_group_name, this.push_state);
|
323
|
+
history[history_method](current_state.state, null, current_state.toUrl());
|
324
|
+
}
|
325
|
+
}
|
326
|
+
},
|
327
|
+
hideTarget: function(){
|
328
|
+
this.$target.hide();
|
329
|
+
},
|
330
|
+
revealTarget: function(){
|
331
|
+
this.$target.show();
|
332
|
+
this.$tab_trigger.addClass('active');
|
333
|
+
},
|
334
|
+
getParent: function(){
|
335
|
+
return this.$target.parent();
|
336
|
+
},
|
337
|
+
resize: function(){
|
338
|
+
this.tab_group.resize();
|
331
339
|
}
|
332
|
-
})
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
hideAll: function(trigger){
|
348
|
-
$.each(this.tab_triggers,function(){
|
349
|
-
this.hideTarget();
|
350
|
-
})
|
351
|
-
},
|
352
|
-
getTabTriggerClass: function(){
|
353
|
-
this.tab_trigger_class = TabTrigger;
|
354
|
-
},
|
355
|
-
deactivateTabTriggers: function(){
|
356
|
-
$.each(this.tab_triggers,function(){
|
357
|
-
this.$tab_trigger.removeClass('active');
|
358
|
-
})
|
359
|
-
},
|
360
|
-
setActiveTab: function(tab_trigger){
|
361
|
-
if(this.active_tab){
|
362
|
-
var parent_height = this.$content_parent.height();
|
363
|
-
this.$content_parent.css({'height': parent_height, 'overflow': 'hidden'});
|
364
|
-
}
|
365
|
-
this.hideAll();
|
366
|
-
this.deactivateTabTriggers();
|
367
|
-
this.active_tab = tab_trigger;
|
368
|
-
tab_trigger.revealTarget();
|
369
|
-
},
|
370
|
-
resize: function(){
|
371
|
-
this.$content_parent.css({'height': 'auto', 'overflow': 'visible'});
|
372
|
-
},
|
373
|
-
getActiveTab: function(){
|
374
|
-
return this.active_tab;
|
375
|
-
}
|
376
|
-
})
|
377
|
-
TabGroup.addGroup = function(group){
|
378
|
-
if(!TabGroup.all_groups){
|
379
|
-
TabGroup.all_groups = [];
|
380
|
-
}
|
381
|
-
TabGroup.all_groups.push(group);
|
382
|
-
}
|
383
|
-
TabGroup.find = function(name){
|
384
|
-
var selected_group = null;
|
385
|
-
$.each(TabGroup.all_groups,function(index,group){
|
386
|
-
if(group.name == name){
|
387
|
-
selected_group = group;
|
388
|
-
}
|
389
|
-
});
|
390
|
-
return selected_group;
|
391
|
-
}
|
392
|
-
var AjaxTabGroup = TabGroup.extend({
|
393
|
-
getTabTriggerClass: function(){
|
394
|
-
this.tab_trigger_class = AjaxTabTrigger;
|
395
|
-
}
|
396
|
-
})
|
397
|
-
var TabTrigger = Class.extend({
|
398
|
-
init: function($tab_trigger,tab_group){
|
399
|
-
this.$tab_trigger = $tab_trigger;
|
400
|
-
this.tab_group = tab_group;
|
401
|
-
this.tab_group_name = tab_group.name;
|
402
|
-
this.tab_id = $tab_trigger.data('tab-target-id');
|
403
|
-
this.getPushState();
|
404
|
-
this.getTarget();
|
405
|
-
var tab_trigger = this;
|
406
|
-
$tab_trigger.on('click', function(e){
|
407
|
-
e.preventDefault();
|
408
|
-
tab_trigger.toggleTarget()
|
409
|
-
})
|
410
|
-
},
|
411
|
-
getTarget: function(){
|
412
|
-
this.$target = $('[data-tab-id="' + this.tab_id + '"]');
|
413
|
-
},
|
414
|
-
getPushState: function(){
|
415
|
-
if(this.$tab_trigger.data('push-state') != null && this.$tab_trigger.data('push-state') != ""){
|
416
|
-
this.push_state = this.$tab_trigger.data('push-state')
|
417
|
-
}
|
418
|
-
},
|
419
|
-
toggleTarget: function(state_behavior){
|
420
|
-
var was_visible = this.$target.is(':visible');
|
421
|
-
if(!was_visible){
|
422
|
-
this.tab_group.setActiveTab(this);
|
423
|
-
this.resize();
|
424
|
-
var change_history = true;
|
425
|
-
var history_method = 'pushState'
|
426
|
-
if('no history' == state_behavior){
|
427
|
-
change_history = false
|
428
|
-
} else if('replace' == state_behavior){
|
429
|
-
history_method = 'replaceState'
|
430
|
-
}
|
431
|
-
if (this.push_state && change_history) {
|
432
|
-
var current_state = new IhHistoryState(history.state)
|
433
|
-
current_state.addState(this.tab_group_name, this.push_state);
|
434
|
-
history[history_method](current_state.state, null, current_state.toUrl());
|
340
|
+
}),
|
341
|
+
IhHistoryState: Class.extend({
|
342
|
+
init: function(state){
|
343
|
+
this.state = jQuery.extend(true, {}, state);
|
344
|
+
},
|
345
|
+
toQueryString: function(){
|
346
|
+
return $.param(this.state)
|
347
|
+
},
|
348
|
+
toUrl: function(){
|
349
|
+
return [location.protocol, '//', location.host, location.pathname, '?', this.toQueryString()].join('');
|
350
|
+
},
|
351
|
+
addState: function(key,value){
|
352
|
+
var new_state = {}
|
353
|
+
new_state[key] = value
|
354
|
+
this.state = $.extend(true, this.state, new_state);
|
435
355
|
}
|
436
|
-
}
|
437
|
-
|
438
|
-
|
439
|
-
|
440
|
-
|
441
|
-
|
442
|
-
|
443
|
-
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
|
448
|
-
|
449
|
-
|
450
|
-
|
451
|
-
})
|
452
|
-
|
453
|
-
|
454
|
-
|
455
|
-
|
456
|
-
if(!this.ajax_loaded){
|
457
|
-
this.ajax_loaded = true;
|
458
|
-
this.$tab_trigger.data('ajax-target','[data-tab-id="' + this.tab_id + '"]')
|
459
|
-
new AjaxLinkSubmission(this.$tab_trigger,{'on_complete': function(){tab_group.resize()}});
|
460
|
-
this._super(pop);
|
461
|
-
} else {
|
462
|
-
this._super(pop);
|
463
|
-
tab_group.resize()
|
464
|
-
}
|
465
|
-
},
|
466
|
-
resize: function(){
|
467
|
-
// noop
|
468
|
-
}
|
469
|
-
})
|
470
|
-
var IhHistoryState = Class.extend({
|
471
|
-
init: function(state){
|
472
|
-
this.state = jQuery.extend(true, {}, state);
|
473
|
-
},
|
474
|
-
toQueryString: function(){
|
475
|
-
return $.param(this.state)
|
476
|
-
},
|
477
|
-
toUrl: function(){
|
478
|
-
return [location.protocol, '//', location.host, location.pathname, '?', this.toQueryString()].join('');
|
479
|
-
},
|
480
|
-
addState: function(key,value){
|
481
|
-
var new_state = {}
|
482
|
-
new_state[key] = value
|
483
|
-
this.state = $.extend(true, this.state, new_state);
|
484
|
-
}
|
485
|
-
})
|
486
|
-
var GoProxy = Class.extend({
|
487
|
-
init: function($proxy){
|
488
|
-
this.first_submit = true;
|
489
|
-
var go_proxy = this;
|
490
|
-
go_proxy.$proxy = $proxy;
|
491
|
-
go_proxy.target = go_proxy.getTarget();
|
492
|
-
go_proxy.prevent_double_submit = $proxy.data('prevent-double-submit')
|
493
|
-
switch($proxy.get(0).nodeName.toLowerCase()){
|
494
|
-
case 'input':
|
495
|
-
switch($proxy.attr('type')){
|
496
|
-
case 'checkbox':
|
497
|
-
default:
|
356
|
+
}),
|
357
|
+
GoProxy: Class.extend({
|
358
|
+
init: function($proxy){
|
359
|
+
this.first_submit = true;
|
360
|
+
var go_proxy = this;
|
361
|
+
go_proxy.$proxy = $proxy;
|
362
|
+
go_proxy.target = go_proxy.getTarget();
|
363
|
+
go_proxy.prevent_double_submit = $proxy.data('prevent-double-submit')
|
364
|
+
switch($proxy.get(0).nodeName.toLowerCase()){
|
365
|
+
case 'input':
|
366
|
+
switch($proxy.attr('type')){
|
367
|
+
case 'checkbox':
|
368
|
+
default:
|
369
|
+
$proxy.on('change',function(){
|
370
|
+
go_proxy.doItNow();
|
371
|
+
})
|
372
|
+
break;
|
373
|
+
}
|
374
|
+
break;
|
375
|
+
case 'select':
|
498
376
|
$proxy.on('change',function(){
|
499
377
|
go_proxy.doItNow();
|
500
378
|
})
|
501
379
|
break;
|
380
|
+
case 'a':
|
381
|
+
default:
|
382
|
+
$proxy.on('click',function(e){
|
383
|
+
e.preventDefault();
|
384
|
+
go_proxy.doItNow();
|
385
|
+
return false;
|
386
|
+
});
|
387
|
+
break;
|
502
388
|
}
|
503
|
-
|
504
|
-
|
505
|
-
|
506
|
-
|
389
|
+
},
|
390
|
+
doable: function(){
|
391
|
+
return(this.first_submit || !this.prevent_double_submit)
|
392
|
+
}
|
393
|
+
}),
|
394
|
+
FieldFiller: Class.extend({
|
395
|
+
init: function($field_filler){
|
396
|
+
this.$field_filler = $field_filler
|
397
|
+
this.value = $field_filler.data('value');
|
398
|
+
this.target = $($field_filler.data('target'));
|
399
|
+
var field_filler = this
|
400
|
+
this.$field_filler.bind('click', function(e){field_filler.fill(e)})
|
401
|
+
},
|
402
|
+
fill: function(e){
|
403
|
+
e.preventDefault();
|
404
|
+
this.target.val(this.value);
|
405
|
+
return false;
|
406
|
+
}
|
407
|
+
}),
|
408
|
+
Remover: Class.extend({
|
409
|
+
init: function($remover){
|
410
|
+
$target = $($remover.data('target'));
|
411
|
+
$remover.click(function(e){
|
412
|
+
$target.remove();
|
507
413
|
})
|
508
|
-
|
509
|
-
|
510
|
-
|
511
|
-
|
512
|
-
|
513
|
-
|
514
|
-
|
414
|
+
}
|
415
|
+
}),
|
416
|
+
Link: Class.extend({
|
417
|
+
init: function($link){
|
418
|
+
$link.click(function(){
|
419
|
+
window.location = $link.attr('href');
|
420
|
+
})
|
421
|
+
}
|
422
|
+
}),
|
423
|
+
CheckboxHiddenProxy: Class.extend({
|
424
|
+
init: function($checkbox){
|
425
|
+
this.checked_value = $checkbox.data('checked-value');
|
426
|
+
this.unchecked_value = $checkbox.data('unchecked-value');
|
427
|
+
var target_selector = $checkbox.data('target');
|
428
|
+
this.target = $(target_selector);
|
429
|
+
var checkbox = this;
|
430
|
+
$checkbox.click(function(){
|
431
|
+
if ($(this).is(':checked')) {
|
432
|
+
checkbox.target.val(checkbox.checked_value);
|
433
|
+
} else {
|
434
|
+
checkbox.target.val(checkbox.unchecked_value);
|
435
|
+
}
|
436
|
+
})
|
437
|
+
}
|
438
|
+
}),
|
439
|
+
PreventDoubleSubmit: Class.extend({
|
440
|
+
init: function($clickable){
|
441
|
+
this.$clickable = $clickable;
|
442
|
+
var double_click_preventer = this;
|
443
|
+
switch($clickable.get(0).nodeName.toLowerCase()){
|
444
|
+
case 'form':
|
445
|
+
$clickable.submit(function(e){ double_click_preventer.preventItNow(); });
|
446
|
+
break;
|
447
|
+
case 'input':
|
448
|
+
$clickable.click(function() {
|
449
|
+
setTimeout(function(){
|
450
|
+
$clickable.attr("disabled", "disabled");
|
451
|
+
}, 10);
|
452
|
+
});
|
453
|
+
break;
|
454
|
+
}
|
455
|
+
},
|
456
|
+
preventItNow: function(){
|
457
|
+
this.$clickable.submit(function(e){ e.preventDefault(); return false; });
|
458
|
+
}
|
459
|
+
}),
|
460
|
+
PreventDoubleLinkClick: Class.extend({
|
461
|
+
init: function($clickable){
|
462
|
+
$clickable.click(function(e) {
|
463
|
+
if($clickable.data('clicked')) {
|
464
|
+
e.preventDefault();
|
465
|
+
return false;
|
466
|
+
} else {
|
467
|
+
$clickable.data('clicked',true);
|
468
|
+
return true;
|
469
|
+
}
|
515
470
|
});
|
516
|
-
|
471
|
+
}
|
472
|
+
}),
|
473
|
+
ReloadPage: Class.extend({
|
474
|
+
init: function(reload_page){
|
475
|
+
window.location.href = reload_page;
|
476
|
+
}
|
477
|
+
})
|
478
|
+
};
|
479
|
+
hooch.AjaxExpandable = hooch.Expandable.extend({
|
480
|
+
expand: function(){
|
481
|
+
if(!this.ajax_loaded){
|
482
|
+
this.ajax_loaded = true;
|
483
|
+
new thin_man.AjaxLinkSubmission(this.$expander);
|
484
|
+
}
|
485
|
+
this._super();
|
486
|
+
}
|
487
|
+
});
|
488
|
+
hooch.FormFieldRevealer = hooch.Revealer.extend({
|
489
|
+
init: function($revealer){
|
490
|
+
this.children_id = $revealer.data('revealer-children-id');
|
491
|
+
this.$revelation_target = $('[data-revealer-target="' + this.children_id + '"]');
|
492
|
+
this._super($revealer);
|
493
|
+
},
|
494
|
+
hideChildren: function(){
|
495
|
+
this._super();
|
496
|
+
this.$form = this.$revealer.parents('form:first')
|
497
|
+
if(this.$form.length > 0){
|
498
|
+
this.$form.after(this.$all_children)
|
499
|
+
}
|
500
|
+
},
|
501
|
+
revealChosenOnes: function(){
|
502
|
+
this.$revelation_target.html(this.$children);
|
503
|
+
this._super();
|
517
504
|
}
|
518
|
-
}
|
519
|
-
|
520
|
-
|
521
|
-
|
522
|
-
});
|
523
|
-
var ClickProxy = GoProxy.extend({
|
524
|
-
getTarget: function(){
|
525
|
-
if(this.$proxy.data('target')){
|
526
|
-
return $(this.$proxy.data('target'));
|
527
|
-
} else {
|
528
|
-
return this.$proxy.siblings('a');
|
505
|
+
});
|
506
|
+
hooch.AjaxTabGroup = hooch.TabGroup.extend({
|
507
|
+
getTabTriggerClass: function(){
|
508
|
+
this.tab_trigger_class = hooch.AjaxTabTrigger;
|
529
509
|
}
|
530
|
-
}
|
531
|
-
|
532
|
-
|
533
|
-
this.
|
534
|
-
this.
|
510
|
+
});
|
511
|
+
hooch.AjaxTabTrigger = hooch.TabTrigger.extend({
|
512
|
+
toggleTarget: function(pop){
|
513
|
+
var tab_group = this.tab_group;
|
514
|
+
if(!this.ajax_loaded){
|
515
|
+
this.ajax_loaded = true;
|
516
|
+
this.$tab_trigger.data('ajax-target','[data-tab-id="' + this.tab_id + '"]')
|
517
|
+
new thin_man.AjaxLinkSubmission(this.$tab_trigger,{'on_complete': function(){tab_group.resize()}});
|
518
|
+
this._super(pop);
|
519
|
+
} else {
|
520
|
+
this._super(pop);
|
521
|
+
tab_group.resize()
|
522
|
+
}
|
523
|
+
},
|
524
|
+
resize: function(){
|
525
|
+
// noop
|
535
526
|
}
|
536
|
-
}
|
537
|
-
|
538
|
-
|
539
|
-
|
540
|
-
|
541
|
-
|
542
|
-
|
543
|
-
|
544
|
-
|
527
|
+
});
|
528
|
+
hooch.ClickProxy = hooch.GoProxy.extend({
|
529
|
+
getTarget: function(){
|
530
|
+
if(this.$proxy.data('target')){
|
531
|
+
return $(this.$proxy.data('target'));
|
532
|
+
} else {
|
533
|
+
return this.$proxy.siblings('a');
|
534
|
+
}
|
535
|
+
},
|
536
|
+
doItNow: function(){
|
537
|
+
if(this.doable()) {
|
538
|
+
if(this.target.data('ajax-target')){
|
539
|
+
this.target.click();
|
540
|
+
}else if(this.target.attr('href')){
|
541
|
+
window.location = this.target.attr('href');
|
542
|
+
}
|
543
|
+
this.first_submit = false;
|
544
|
+
}
|
545
545
|
}
|
546
|
-
}
|
547
|
-
|
548
|
-
|
549
|
-
this.target
|
550
|
-
|
546
|
+
});
|
547
|
+
hooch.SubmitProxy = hooch.GoProxy.extend({
|
548
|
+
getTarget: function(){
|
549
|
+
if(this.$proxy.data('target')){
|
550
|
+
return $(this.$proxy.data('target'));
|
551
|
+
} else {
|
552
|
+
return this.$proxy.parents('form:first');
|
553
|
+
}
|
554
|
+
},
|
555
|
+
doItNow: function(){
|
556
|
+
if(this.doable()) {
|
557
|
+
this.target.submit();
|
558
|
+
this.first_submit = false;
|
559
|
+
}
|
551
560
|
}
|
552
|
-
}
|
553
|
-
|
554
|
-
|
555
|
-
|
556
|
-
|
557
|
-
|
558
|
-
|
559
|
-
|
560
|
-
var
|
561
|
-
|
562
|
-
|
563
|
-
|
564
|
-
|
565
|
-
|
566
|
-
return
|
567
|
-
}
|
568
|
-
|
569
|
-
|
570
|
-
|
571
|
-
|
572
|
-
|
573
|
-
|
574
|
-
|
561
|
+
});
|
562
|
+
hooch.TabGroup.addGroup = function(group){
|
563
|
+
if(!hooch.TabGroup.all_groups){
|
564
|
+
hooch.TabGroup.all_groups = [];
|
565
|
+
}
|
566
|
+
hooch.TabGroup.all_groups.push(group);
|
567
|
+
};
|
568
|
+
hooch.TabGroup.find = function(name){
|
569
|
+
var selected_group = null;
|
570
|
+
$.each(hooch.TabGroup.all_groups,function(index,group){
|
571
|
+
if(group.name == name){
|
572
|
+
selected_group = group;
|
573
|
+
}
|
574
|
+
});
|
575
|
+
return selected_group;
|
576
|
+
};
|
577
|
+
hooch.loadClasses = function(){
|
578
|
+
window.any_time_manager.registerListWithClasses({
|
579
|
+
'expand-state' : 'Expandable', 'prevent-double-click' : 'PreventDoubleLinkClick'
|
580
|
+
},'hooch');
|
581
|
+
window.any_time_manager.registerList(
|
582
|
+
['hover_overflow','hidey_button','submit-proxy','click-proxy','field-filler','revealer',
|
583
|
+
'checkbox-hidden-proxy','prevent-double-submit','prevent-double-link-click', 'tab-group',
|
584
|
+
'hover-reveal', 'emptier', 'remover'],'hooch');
|
585
|
+
window.any_time_manager.load();
|
586
|
+
};
|
587
|
+
$(document).ready(function(){
|
588
|
+
if(typeof window.any_time_manager === "undefined" && typeof window.loading_any_time_manager === "undefined"){
|
589
|
+
window.loading_any_time_manager = true;
|
590
|
+
$.getScript("https://cdn.rawgit.com/edraut/anytime_manager/9f710d2280e68ea6156551728cb7e2d537a06ee6/anytime_manager.js",function(){
|
591
|
+
window.loading_any_time_manager = false
|
592
|
+
hooch.loadClasses();
|
593
|
+
});
|
594
|
+
}else if(typeof window.any_time_manager === "undefined"){
|
595
|
+
if(typeof window.any_time_load_functions === 'undefined'){
|
596
|
+
window.any_time_load_functions = []
|
597
|
+
}
|
598
|
+
window.any_time_load_functions.push(hooch.loadClasses)
|
599
|
+
}else{
|
600
|
+
hooch.loadClasses();
|
601
|
+
};
|
602
|
+
$(document).on('change','[data-toggler]',function(){
|
603
|
+
new hooch.Toggler($(this));
|
575
604
|
})
|
576
|
-
|
577
|
-
|
578
|
-
|
579
|
-
var Remover = Class.extend({
|
580
|
-
init: function($remover){
|
581
|
-
$target = $($remover.data('target'));
|
582
|
-
$remover.click(function(e){
|
583
|
-
$target.remove();
|
605
|
+
$('[data-toggler]').each(function(){
|
606
|
+
new hooch.Toggler($(this));
|
584
607
|
})
|
585
|
-
|
586
|
-
|
587
|
-
|
588
|
-
var Link = Class.extend({
|
589
|
-
init: function($link){
|
590
|
-
$link.click(function(){
|
591
|
-
window.location = $link.attr('href');
|
608
|
+
$('[data-disable_forms]').each(function(){
|
609
|
+
new hooch.DisableForms($(this));
|
592
610
|
})
|
593
|
-
|
594
|
-
|
595
|
-
|
596
|
-
var CheckboxHiddenProxy = Class.extend({
|
597
|
-
init: function($checkbox){
|
598
|
-
this.checked_value = $checkbox.data('checked-value');
|
599
|
-
this.unchecked_value = $checkbox.data('unchecked-value');
|
600
|
-
var target_selector = $checkbox.data('target');
|
601
|
-
this.target = $(target_selector);
|
602
|
-
var checkbox = this;
|
603
|
-
$checkbox.click(function(){
|
604
|
-
if ($(this).is(':checked')) {
|
605
|
-
checkbox.target.val(checkbox.checked_value);
|
606
|
-
} else {
|
607
|
-
checkbox.target.val(checkbox.unchecked_value);
|
608
|
-
}
|
611
|
+
$('[data-link]').each(function(){
|
612
|
+
new hooch.Link($(this));
|
609
613
|
})
|
610
|
-
|
611
|
-
|
612
|
-
|
613
|
-
|
614
|
-
init: function($clickable){
|
615
|
-
this.$clickable = $clickable;
|
616
|
-
var double_click_preventer = this;
|
617
|
-
switch($clickable.get(0).nodeName.toLowerCase()){
|
618
|
-
case 'form':
|
619
|
-
$clickable.submit(function(e){ double_click_preventer.preventItNow(); });
|
620
|
-
break;
|
621
|
-
case 'input':
|
622
|
-
$clickable.click(function() {
|
623
|
-
setTimeout(function(){
|
624
|
-
$clickable.attr("disabled", "disabled");
|
625
|
-
}, 10);
|
626
|
-
});
|
627
|
-
break;
|
628
|
-
}
|
629
|
-
},
|
630
|
-
preventItNow: function(){
|
631
|
-
this.$clickable.submit(function(e){ e.preventDefault(); return false; });
|
632
|
-
}
|
633
|
-
});
|
634
|
-
|
635
|
-
var PreventDoubleLinkClick = Class.extend({
|
636
|
-
init: function($clickable){
|
637
|
-
$clickable.click(function(e) {
|
638
|
-
if($clickable.data('clicked')) {
|
639
|
-
e.preventDefault();
|
640
|
-
return false;
|
641
|
-
} else {
|
642
|
-
$clickable.data('clicked',true);
|
643
|
-
return true;
|
614
|
+
// Initailizes auto complete for select inputs
|
615
|
+
$('input,select,textarea').filter(':visible:enabled:first').each(function(){
|
616
|
+
if(!$(this).data('date-picker')){
|
617
|
+
$(this).focus();
|
644
618
|
}
|
645
619
|
});
|
646
|
-
}
|
647
|
-
|
648
|
-
|
649
|
-
|
650
|
-
|
651
|
-
|
652
|
-
|
653
|
-
|
654
|
-
|
655
|
-
|
656
|
-
var previous_state = new IhHistoryState(e.originalEvent.state)
|
657
|
-
$.each(previous_state.state, function(key,value){
|
658
|
-
var tab_group = TabGroup.find(key)
|
659
|
-
if(tab_group){
|
660
|
-
var tab_trigger = tab_group.getTabByPushState(value)
|
661
|
-
if(tab_trigger){
|
662
|
-
tab_trigger.toggleTarget('no history');
|
620
|
+
});
|
621
|
+
$(window).bind("popstate", function(e){
|
622
|
+
var previous_state = new hooch.IhHistoryState(e.originalEvent.state)
|
623
|
+
$.each(previous_state.state, function(key,value){
|
624
|
+
var tab_group = hooch.TabGroup.find(key)
|
625
|
+
if(tab_group){
|
626
|
+
var tab_trigger = tab_group.getTabByPushState(value)
|
627
|
+
if(tab_trigger){
|
628
|
+
tab_trigger.toggleTarget('no history');
|
629
|
+
}
|
663
630
|
}
|
664
|
-
}
|
665
|
-
})
|
666
|
-
});
|
667
|
-
$(document).ready(function(){
|
668
|
-
$(document).on('change','[data-toggler]',function(){
|
669
|
-
new Toggler($(this));
|
670
|
-
})
|
671
|
-
$('[data-toggler]').each(function(){
|
672
|
-
new Toggler($(this));
|
673
|
-
})
|
674
|
-
$('[data-disable_forms]').each(function(){
|
675
|
-
new DisableForms($(this));
|
676
|
-
})
|
677
|
-
$('[data-link]').each(function(){
|
678
|
-
new Link($(this));
|
679
|
-
})
|
680
|
-
// Initailizes auto complete for select inputs
|
681
|
-
$('input,select,textarea').filter(':visible:enabled:first').each(function(){
|
682
|
-
if(!$(this).data('date-picker')){
|
683
|
-
$(this).focus();
|
684
|
-
}
|
631
|
+
})
|
685
632
|
});
|
686
|
-
}
|
633
|
+
}
|
634
|
+
if(typeof Class === "undefined"){
|
635
|
+
$.getScript('https://rawgit.com/edraut/js_inheritance/a6c1e40986ecb276335b0a0b1792abd01f05ff6c/inheritance.js', function(){
|
636
|
+
initHooch();
|
637
|
+
});
|
638
|
+
}else{
|
639
|
+
initHooch();
|
640
|
+
}
|
data/lib/hooch/hooch_helper.rb
CHANGED
@@ -2,7 +2,7 @@ module Hooch
|
|
2
2
|
module HoochHelper
|
3
3
|
def tab_set(name, type: nil, default_tab: nil)
|
4
4
|
if :ajax == type
|
5
|
-
type = 'AjaxTabGroup'
|
5
|
+
type = 'hooch.AjaxTabGroup'
|
6
6
|
end
|
7
7
|
attrs = 'data-tab-group=' + name
|
8
8
|
attrs += ' data-sub-type=' + type if type.present?
|
@@ -39,7 +39,7 @@ module Hooch
|
|
39
39
|
|
40
40
|
def expanded(id, type: nil)
|
41
41
|
if :ajax == type
|
42
|
-
type = 'AjaxExpandable'
|
42
|
+
type = 'hooch.AjaxExpandable'
|
43
43
|
end
|
44
44
|
attrs = "data-expand-state=expanded data-expand-id=" + id
|
45
45
|
attrs += " data-sub-type=" + type if type.present?
|
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.0.
|
4
|
+
version: 0.0.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: 2015-05-
|
11
|
+
date: 2015-05-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|