gumby_on_rails 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/Rakefile +34 -0
- data/app/assets/javascripts/gumby/libs/extensions/gumby.comments.js +152 -0
- data/app/assets/javascripts/gumby/libs/extensions/gumby.fittext.js +126 -0
- data/app/assets/javascripts/gumby/libs/extensions/gumby.images.js +202 -0
- data/app/assets/javascripts/gumby/libs/extensions/gumby.inview.js +219 -0
- data/app/assets/javascripts/gumby/libs/extensions/gumby.parallax.js +106 -0
- data/app/assets/javascripts/gumby/libs/extensions/gumby.shuffle.js +198 -0
- data/app/assets/javascripts/gumby/libs/gumby.init.js +47 -0
- data/app/assets/javascripts/gumby/libs/gumby.js +258 -0
- data/app/assets/javascripts/gumby/libs/gumby.min.js +1 -0
- data/app/assets/javascripts/gumby/libs/jquery-1.10.1.min.js +6 -0
- data/app/assets/javascripts/gumby/libs/jquery-1.10.1.min.map +1 -0
- data/app/assets/javascripts/gumby/libs/jquery-2.0.2.min.js +6 -0
- data/app/assets/javascripts/gumby/libs/jquery-2.0.2.min.map +1 -0
- data/app/assets/javascripts/gumby/libs/jquery.mobile.custom.min.js +3 -0
- data/app/assets/javascripts/gumby/libs/modernizr-2.6.2.min.js +4 -0
- data/app/assets/javascripts/gumby/libs/ui/gumby.checkbox.js +101 -0
- data/app/assets/javascripts/gumby/libs/ui/gumby.fixed.js +240 -0
- data/app/assets/javascripts/gumby/libs/ui/gumby.navbar.js +115 -0
- data/app/assets/javascripts/gumby/libs/ui/gumby.radiobtn.js +90 -0
- data/app/assets/javascripts/gumby/libs/ui/gumby.retina.js +81 -0
- data/app/assets/javascripts/gumby/libs/ui/gumby.skiplink.js +157 -0
- data/app/assets/javascripts/gumby/libs/ui/gumby.tabs.js +80 -0
- data/app/assets/javascripts/gumby/libs/ui/gumby.toggleswitch.js +264 -0
- data/app/assets/javascripts/gumby/libs/ui/jquery.validation.js +142 -0
- data/app/assets/javascripts/gumby/main.js +23 -0
- data/app/assets/javascripts/gumby/plugins.js +4 -0
- data/app/assets/javascripts/gumby.all.js +19 -0
- data/app/assets/javascripts/gumby.js +13 -0
- data/app/assets/stylesheets/gumby/_base.scss +49 -0
- data/app/assets/stylesheets/gumby/_custom.scss +1 -0
- data/app/assets/stylesheets/gumby/_fonts.scss +28 -0
- data/app/assets/stylesheets/gumby/_grid.scss +339 -0
- data/app/assets/stylesheets/gumby/_parallax.scss +11 -0
- data/app/assets/stylesheets/gumby/_shame.scss +36 -0
- data/app/assets/stylesheets/gumby/_typography.scss +272 -0
- data/app/assets/stylesheets/gumby/extensions/modular-scale/lib/modular-scale.rb +128 -0
- data/app/assets/stylesheets/gumby/extensions/modular-scale/stylesheets/_modular-scale.scss +310 -0
- data/app/assets/stylesheets/gumby/extensions/sassy-math/lib/sassy-math.rb +159 -0
- data/app/assets/stylesheets/gumby/extensions/sassy-math/stylesheets/_math.scss +310 -0
- data/app/assets/stylesheets/gumby/functions/_all.scss +25 -0
- data/app/assets/stylesheets/gumby/functions/_breakpoints.scss +11 -0
- data/app/assets/stylesheets/gumby/functions/_button-size.scss +44 -0
- data/app/assets/stylesheets/gumby/functions/_clearfix.scss +25 -0
- data/app/assets/stylesheets/gumby/functions/_em.scss +11 -0
- data/app/assets/stylesheets/gumby/functions/_even.scss +10 -0
- data/app/assets/stylesheets/gumby/functions/_fade.scss +20 -0
- data/app/assets/stylesheets/gumby/functions/_fancytiles.scss +29 -0
- data/app/assets/stylesheets/gumby/functions/_fixed.scss +21 -0
- data/app/assets/stylesheets/gumby/functions/_forms.scss +18 -0
- data/app/assets/stylesheets/gumby/functions/_grid-calc.scss +82 -0
- data/app/assets/stylesheets/gumby/functions/_height-calc.scss +6 -0
- data/app/assets/stylesheets/gumby/functions/_icons.scss +35 -0
- data/app/assets/stylesheets/gumby/functions/_line-and-height.scss +7 -0
- data/app/assets/stylesheets/gumby/functions/_palette.scss +76 -0
- data/app/assets/stylesheets/gumby/functions/_responsivity.scss +34 -0
- data/app/assets/stylesheets/gumby/functions/_semantic-grid.scss +170 -0
- data/app/assets/stylesheets/gumby/functions/_shapes.scss +22 -0
- data/app/assets/stylesheets/gumby/functions/_strip-units.scss +5 -0
- data/app/assets/stylesheets/gumby/functions/_tooltips.scss +98 -0
- data/app/assets/stylesheets/gumby/functions/_typography.scss +15 -0
- data/app/assets/stylesheets/gumby/functions/_visibility.scss +17 -0
- data/app/assets/stylesheets/gumby/gumby.scss +39 -0
- data/app/assets/stylesheets/gumby/ui/_all.scss +11 -0
- data/app/assets/stylesheets/gumby/ui/_buttons.scss +154 -0
- data/app/assets/stylesheets/gumby/ui/_forms.scss +392 -0
- data/app/assets/stylesheets/gumby/ui/_icons.scss +23 -0
- data/app/assets/stylesheets/gumby/ui/_images.scss +23 -0
- data/app/assets/stylesheets/gumby/ui/_labels.scss +87 -0
- data/app/assets/stylesheets/gumby/ui/_navbar.scss +440 -0
- data/app/assets/stylesheets/gumby/ui/_tables.scss +89 -0
- data/app/assets/stylesheets/gumby/ui/_tabs.scss +156 -0
- data/app/assets/stylesheets/gumby/ui/_toggles.scss +73 -0
- data/app/assets/stylesheets/gumby/ui/_tooltips.scss +12 -0
- data/app/assets/stylesheets/gumby/ui/_video.scss +24 -0
- data/app/assets/stylesheets/gumby/var/_lists.scss +20 -0
- data/app/assets/stylesheets/gumby/var/_settings.scss +169 -0
- data/app/assets/stylesheets/gumby/var/icons/_entypo-icon-list.scss +286 -0
- data/app/assets/stylesheets/gumby/var/icons/_entypo.scss +294 -0
- data/app/assets/stylesheets/gumby.all.css.scss +20 -0
- data/app/assets/stylesheets/gumby.css.scss +37 -0
- data/app/controllers/gumby/application_controller.rb +4 -0
- data/app/helpers/gumby/application_helper.rb +4 -0
- data/app/views/layouts/gumby/application.html.erb +14 -0
- data/config/routes.rb +2 -0
- data/lib/gumby/engine.rb +10 -0
- data/lib/gumby/version.rb +3 -0
- data/lib/gumby.rb +4 -0
- data/lib/tasks/gumby_tasks.rake +20 -0
- data/public/fonts/gumby/icons/entypo.eot +0 -0
- data/public/fonts/gumby/icons/entypo.ttf +0 -0
- data/public/fonts/gumby/icons/entypo.woff +0 -0
- metadata +235 -0
@@ -0,0 +1,80 @@
|
|
1
|
+
/**
|
2
|
+
* Gumby Tabs
|
3
|
+
*/
|
4
|
+
!function($) {
|
5
|
+
|
6
|
+
'use strict';
|
7
|
+
|
8
|
+
function Tabs($el) {
|
9
|
+
|
10
|
+
Gumby.debug('Initializing Tabs', $el);
|
11
|
+
|
12
|
+
this.$el = $el;
|
13
|
+
this.$nav = this.$el.find('> ul.tab-nav > li');
|
14
|
+
this.$content = this.$el.children('.tab-content');
|
15
|
+
|
16
|
+
var scope = this;
|
17
|
+
|
18
|
+
// listen for click event on tab nav and custom gumby set event
|
19
|
+
this.$nav.children('a').on(Gumby.click, function(e) {
|
20
|
+
e.preventDefault();
|
21
|
+
scope.click($(this));
|
22
|
+
});
|
23
|
+
|
24
|
+
// listen for gumby.set value for dynamically set tabs
|
25
|
+
this.$el.on('gumby.set', function(e, index) {
|
26
|
+
Gumby.debug('Set event triggered', scope.$el);
|
27
|
+
scope.set(e, index);
|
28
|
+
});
|
29
|
+
}
|
30
|
+
|
31
|
+
// handle tab nav click event
|
32
|
+
Tabs.prototype.click = function($this) {
|
33
|
+
// index of item to activate
|
34
|
+
var index = $this.parent().index();
|
35
|
+
|
36
|
+
if(this.$nav.eq(index).add(this.$content.eq(index)).hasClass('active')) {
|
37
|
+
return;
|
38
|
+
}
|
39
|
+
|
40
|
+
Gumby.debug('Setting active tab to '+index, this.$el);
|
41
|
+
|
42
|
+
// deactivate other tab navigation and content
|
43
|
+
this.$nav.add(this.$content).removeClass('active');
|
44
|
+
|
45
|
+
// activate this tab nav link and content
|
46
|
+
this.$nav.eq(index).add(this.$content.eq(index)).addClass('active');
|
47
|
+
|
48
|
+
// trigger gumby.change event and pass current active tab index
|
49
|
+
Gumby.debug('Triggering onChange event', this.$el);
|
50
|
+
this.$el.trigger('gumby.onChange', index);
|
51
|
+
};
|
52
|
+
|
53
|
+
// set specific tab
|
54
|
+
Tabs.prototype.set = function(e, index) {
|
55
|
+
this.$nav.eq(index).find('a').trigger(Gumby.click);
|
56
|
+
};
|
57
|
+
|
58
|
+
// add initialisation
|
59
|
+
Gumby.addInitalisation('tabs', function() {
|
60
|
+
$('.tabs').each(function() {
|
61
|
+
var $this = $(this);
|
62
|
+
// this element has already been initialized
|
63
|
+
if($this.data('isTabs')) {
|
64
|
+
return true;
|
65
|
+
}
|
66
|
+
// mark element as initialized
|
67
|
+
$this.data('isTabs', true);
|
68
|
+
new Tabs($this);
|
69
|
+
});
|
70
|
+
});
|
71
|
+
|
72
|
+
// register UI module
|
73
|
+
Gumby.UIModule({
|
74
|
+
module: 'tabs',
|
75
|
+
events: ['onChange', 'set'],
|
76
|
+
init: function() {
|
77
|
+
Gumby.initialize('tabs');
|
78
|
+
}
|
79
|
+
});
|
80
|
+
}(jQuery);
|
@@ -0,0 +1,264 @@
|
|
1
|
+
/**
|
2
|
+
* Gumby Toggles/Switches
|
3
|
+
*/
|
4
|
+
!function($) {
|
5
|
+
|
6
|
+
'use strict';
|
7
|
+
|
8
|
+
// Toggle constructor
|
9
|
+
function Toggle($el) {
|
10
|
+
this.$el = $($el);
|
11
|
+
this.targets = [];
|
12
|
+
this.on = '';
|
13
|
+
this.className = '';
|
14
|
+
this.self = false;
|
15
|
+
|
16
|
+
if(this.$el.length) {
|
17
|
+
Gumby.debug('Initializing Toggle', $el);
|
18
|
+
this.init();
|
19
|
+
}
|
20
|
+
}
|
21
|
+
|
22
|
+
// Switch constructor
|
23
|
+
function Switch($el) {
|
24
|
+
this.$el = $($el);
|
25
|
+
this.targets = [];
|
26
|
+
this.on = '';
|
27
|
+
this.className = '';
|
28
|
+
this.self = false;
|
29
|
+
|
30
|
+
if(this.$el.length) {
|
31
|
+
Gumby.debug('Initializing Switch', $el);
|
32
|
+
this.init();
|
33
|
+
}
|
34
|
+
}
|
35
|
+
|
36
|
+
// intialise toggles, switches will inherit method
|
37
|
+
Toggle.prototype.init = function() {
|
38
|
+
var scope = this;
|
39
|
+
|
40
|
+
// set up module based on attributes
|
41
|
+
this.setup();
|
42
|
+
|
43
|
+
// bind to specified event and trigger
|
44
|
+
this.$el.on(this.on, function(e) {
|
45
|
+
e.preventDefault();
|
46
|
+
scope.trigger(scope.triggered);
|
47
|
+
|
48
|
+
// listen for gumby.trigger to dynamically trigger toggle/switch
|
49
|
+
}).on('gumby.trigger', function() {
|
50
|
+
Gumby.debug('Trigger event triggered', scope.$el);
|
51
|
+
scope.trigger(scope.triggered);
|
52
|
+
// re-initialize module
|
53
|
+
}).on('gumby.initialize', function() {
|
54
|
+
Gumby.debug('Re-initializing '+scope.constructor, $el);
|
55
|
+
scope.setup();
|
56
|
+
});
|
57
|
+
};
|
58
|
+
|
59
|
+
// set up module based on attributes
|
60
|
+
Toggle.prototype.setup = function() {
|
61
|
+
this.targets = this.parseTargets();
|
62
|
+
this.on = Gumby.selectAttr.apply(this.$el, ['on']) || Gumby.click;
|
63
|
+
this.className = Gumby.selectAttr.apply(this.$el, ['classname']) || 'active';
|
64
|
+
this.self = Gumby.selectAttr.apply(this.$el, ['self']) === 'false';
|
65
|
+
};
|
66
|
+
|
67
|
+
// parse data-for attribute, switches will inherit method
|
68
|
+
Toggle.prototype.parseTargets = function() {
|
69
|
+
var targetStr = Gumby.selectAttr.apply(this.$el, ['trigger']),
|
70
|
+
secondaryTargets = 0,
|
71
|
+
targets = [];
|
72
|
+
|
73
|
+
// no targets so return false
|
74
|
+
if(!targetStr) {
|
75
|
+
return false;
|
76
|
+
}
|
77
|
+
|
78
|
+
secondaryTargets = targetStr.indexOf('|');
|
79
|
+
|
80
|
+
// no secondary targets specified so return single target
|
81
|
+
if(secondaryTargets === -1) {
|
82
|
+
if(!this.checkTargets([targetStr])) {
|
83
|
+
return false;
|
84
|
+
}
|
85
|
+
return [$(targetStr)];
|
86
|
+
}
|
87
|
+
|
88
|
+
// return array of both targets, split and return 0, 1
|
89
|
+
targets = targetStr.split('|');
|
90
|
+
if(!this.checkTargets(targets)) {
|
91
|
+
return false;
|
92
|
+
}
|
93
|
+
return targets.length > 1 ? [$(targets[0]), $(targets[1])] : [$(targets[0])];
|
94
|
+
};
|
95
|
+
|
96
|
+
Toggle.prototype.checkTargets = function(targets) {
|
97
|
+
var i = 0;
|
98
|
+
|
99
|
+
for(i; i < targets.length; i++) {
|
100
|
+
if(targets[i] && !$(targets[i]).length) {
|
101
|
+
Gumby.error('Cannot find '+this.constructor.name+' target: '+targets[i]);
|
102
|
+
return false;
|
103
|
+
}
|
104
|
+
}
|
105
|
+
|
106
|
+
return true;
|
107
|
+
};
|
108
|
+
|
109
|
+
// call triggered event and pass target data
|
110
|
+
Toggle.prototype.triggered = function() {
|
111
|
+
// trigger gumby.onTrigger event and pass array of target status data
|
112
|
+
Gumby.debug('Triggering onTrigger event', this.$el);
|
113
|
+
this.$el.trigger('gumby.onTrigger', [this.$el.hasClass(this.className)]);
|
114
|
+
};
|
115
|
+
|
116
|
+
// Switch object inherits from Toggle
|
117
|
+
Switch.prototype = new Toggle();
|
118
|
+
Switch.prototype.constructor = Switch;
|
119
|
+
|
120
|
+
// Toggle specific trigger method
|
121
|
+
Toggle.prototype.trigger = function(cb) {
|
122
|
+
|
123
|
+
Gumby.debug('Triggering Toggle', this.$el);
|
124
|
+
|
125
|
+
var $target;
|
126
|
+
|
127
|
+
// no targets just toggle active class on toggle
|
128
|
+
if(!this.targets) {
|
129
|
+
this.$el.toggleClass(this.className);
|
130
|
+
|
131
|
+
// combine single target with toggle and toggle active class
|
132
|
+
} else if(this.targets.length == 1) {
|
133
|
+
this.$el.add(this.targets[0]).toggleClass(this.className);
|
134
|
+
|
135
|
+
// if two targets check active state of first
|
136
|
+
// always combine toggle and first target
|
137
|
+
} else if(this.targets.length > 1) {
|
138
|
+
if(this.targets[0].hasClass(this.className)) {
|
139
|
+
$target = this.targets[0];
|
140
|
+
|
141
|
+
// add this element to it unless gumby-self set
|
142
|
+
if(!this.self) {
|
143
|
+
$target = $target.add(this.$el);
|
144
|
+
}
|
145
|
+
|
146
|
+
$target.removeClass(this.className);
|
147
|
+
this.targets[1].addClass(this.className);
|
148
|
+
} else {
|
149
|
+
$target = this.targets[0];
|
150
|
+
|
151
|
+
// add this element to it unless gumby-self set
|
152
|
+
if(!this.self) {
|
153
|
+
$target = $target.add(this.$el);
|
154
|
+
}
|
155
|
+
|
156
|
+
$target.addClass(this.className);
|
157
|
+
this.targets[1].removeClass(this.className);
|
158
|
+
}
|
159
|
+
}
|
160
|
+
|
161
|
+
// call event handler here, applying scope of object Switch/Toggle
|
162
|
+
if(cb && typeof cb === 'function') {
|
163
|
+
cb.apply(this);
|
164
|
+
}
|
165
|
+
};
|
166
|
+
|
167
|
+
// Switch specific trigger method
|
168
|
+
Switch.prototype.trigger = function(cb) {
|
169
|
+
|
170
|
+
Gumby.debug('Triggering Switch', this.$el);
|
171
|
+
|
172
|
+
var $target;
|
173
|
+
|
174
|
+
// no targets just add active class to switch
|
175
|
+
if(!this.targets) {
|
176
|
+
this.$el.addClass(this.className);
|
177
|
+
|
178
|
+
// combine single target with switch and add active class
|
179
|
+
} else if(this.targets.length == 1) {
|
180
|
+
$target = this.targets[0];
|
181
|
+
|
182
|
+
// add this element to it unless gumby-self set
|
183
|
+
if(!this.self) {
|
184
|
+
$target = $target.add(this.$el);
|
185
|
+
}
|
186
|
+
|
187
|
+
$target.addClass(this.className);
|
188
|
+
|
189
|
+
// if two targets check active state of first
|
190
|
+
// always combine switch and first target
|
191
|
+
} else if(this.targets.length > 1) {
|
192
|
+
$target = this.targets[0];
|
193
|
+
|
194
|
+
// add this element to it unless gumby-self set
|
195
|
+
if(!this.self) {
|
196
|
+
$target = $target.add(this.$el);
|
197
|
+
}
|
198
|
+
|
199
|
+
$target.addClass(this.className);
|
200
|
+
this.targets[1].removeClass(this.className);
|
201
|
+
}
|
202
|
+
|
203
|
+
// call event handler here, applying scope of object Switch/Toggle
|
204
|
+
if(cb && typeof cb === 'function') {
|
205
|
+
cb.apply(this);
|
206
|
+
}
|
207
|
+
};
|
208
|
+
|
209
|
+
// add toggle initialisation
|
210
|
+
Gumby.addInitalisation('toggles', function(all) {
|
211
|
+
$('.toggle').each(function() {
|
212
|
+
var $this = $(this);
|
213
|
+
|
214
|
+
// this element has already been initialized
|
215
|
+
// and we're only initializing new modules
|
216
|
+
if($this.data('isToggle') && !all) {
|
217
|
+
return true;
|
218
|
+
|
219
|
+
// this element has already been initialized
|
220
|
+
// and we need to reinitialize it
|
221
|
+
} else if($this.data('isToggle') && all) {
|
222
|
+
$this.trigger('gumby.initialize');
|
223
|
+
}
|
224
|
+
|
225
|
+
// mark element as initialized
|
226
|
+
$this.data('isToggle', true);
|
227
|
+
new Toggle($this);
|
228
|
+
});
|
229
|
+
});
|
230
|
+
|
231
|
+
// add switches initialisation
|
232
|
+
Gumby.addInitalisation('switches', function(all) {
|
233
|
+
$('.switch').each(function() {
|
234
|
+
var $this = $(this);
|
235
|
+
|
236
|
+
// this element has already been initialized
|
237
|
+
// and we're only initializing new modules
|
238
|
+
if($this.data('isSwitch') && !all) {
|
239
|
+
return true;
|
240
|
+
|
241
|
+
// this element has already been initialized
|
242
|
+
// and we need to reinitialize it
|
243
|
+
} else if($this.data('isSwitch') && all) {
|
244
|
+
$this.trigger('gumby.initialize');
|
245
|
+
return true;
|
246
|
+
}
|
247
|
+
|
248
|
+
// mark element as initialized
|
249
|
+
$this.data('isSwitch', true);
|
250
|
+
new Switch($this);
|
251
|
+
});
|
252
|
+
});
|
253
|
+
|
254
|
+
// register UI module
|
255
|
+
Gumby.UIModule({
|
256
|
+
module: 'toggleswitch',
|
257
|
+
events: ['initialize', 'trigger', 'onTrigger'],
|
258
|
+
init: function() {
|
259
|
+
// Run initialize methods
|
260
|
+
Gumby.initialize('switches');
|
261
|
+
Gumby.initialize('toggles');
|
262
|
+
}
|
263
|
+
});
|
264
|
+
}(jQuery);
|
@@ -0,0 +1,142 @@
|
|
1
|
+
/**
|
2
|
+
* Gumby jQuery Validation Plugin
|
3
|
+
*/
|
4
|
+
!function($) {
|
5
|
+
|
6
|
+
'use strict';
|
7
|
+
|
8
|
+
function Validation($this, req) {
|
9
|
+
|
10
|
+
if(Gumby) {
|
11
|
+
Gumby.debug('Initializing Validation', $this);
|
12
|
+
}
|
13
|
+
|
14
|
+
// input and holder .field
|
15
|
+
this.$this = $this;
|
16
|
+
this.$field = this.$this.parents('.field');
|
17
|
+
|
18
|
+
// supplied validation function with default length check
|
19
|
+
this.req = req || function() {
|
20
|
+
return !!this.$this.val().length;
|
21
|
+
};
|
22
|
+
|
23
|
+
// reference to this class
|
24
|
+
var scope = this;
|
25
|
+
|
26
|
+
// checkboxes and radio buttons use gumby.onChange event to validate
|
27
|
+
if(this.$this.is('[type=checkbox], [type=radio]')) {
|
28
|
+
this.$field = this.$this.parent('label');
|
29
|
+
this.$field.on('gumby.onChange', function() {
|
30
|
+
scope.validate();
|
31
|
+
});
|
32
|
+
|
33
|
+
// selects validate on change
|
34
|
+
} else if(this.$this.is('select')) {
|
35
|
+
this.$field = this.$this.parents('.picker');
|
36
|
+
this.$field.on('change', function() {
|
37
|
+
scope.validate();
|
38
|
+
});
|
39
|
+
|
40
|
+
// others (text input, textarea) use blur
|
41
|
+
} else {
|
42
|
+
this.$this.on('blur', function(e) {
|
43
|
+
// ignore tab
|
44
|
+
if(e.which !== 9) {
|
45
|
+
scope.validate();
|
46
|
+
}
|
47
|
+
});
|
48
|
+
}
|
49
|
+
}
|
50
|
+
|
51
|
+
// validate field
|
52
|
+
Validation.prototype.validate = function() {
|
53
|
+
|
54
|
+
var result = this.req(this.$this);
|
55
|
+
|
56
|
+
// failed
|
57
|
+
if(!result) {
|
58
|
+
this.$field.removeClass('success').addClass('danger');
|
59
|
+
|
60
|
+
// passed
|
61
|
+
} else {
|
62
|
+
//} else if(this.$field.hasClass('danger')) {
|
63
|
+
this.$field.removeClass('danger').addClass('success');
|
64
|
+
}
|
65
|
+
|
66
|
+
return result;
|
67
|
+
};
|
68
|
+
|
69
|
+
// jQuery plugin definition
|
70
|
+
$.fn.validation = function(options) {
|
71
|
+
|
72
|
+
var // extend params with defaults
|
73
|
+
settings = $.extend({
|
74
|
+
submit : false,
|
75
|
+
fail: false,
|
76
|
+
required : []
|
77
|
+
}, options),
|
78
|
+
// store validation objects
|
79
|
+
validations = [];
|
80
|
+
|
81
|
+
// init each form plugin is called on
|
82
|
+
return this.each(function() {
|
83
|
+
|
84
|
+
// no required fields so plugin is pointless
|
85
|
+
if(!settings.required.length) {
|
86
|
+
return false;
|
87
|
+
}
|
88
|
+
|
89
|
+
var $this = $(this),
|
90
|
+
reqLength = settings.required.length,
|
91
|
+
i;
|
92
|
+
|
93
|
+
// loop round each required field and instantiate new validation object
|
94
|
+
for(i = 0; i < reqLength; i++) {
|
95
|
+
validations.push(new Validation(
|
96
|
+
$this.find('[name="'+settings.required[i].name+'"]'),
|
97
|
+
settings.required[i].validate || false
|
98
|
+
));
|
99
|
+
}
|
100
|
+
|
101
|
+
// hijack submit event
|
102
|
+
$this.on('submit', function(e) {
|
103
|
+
|
104
|
+
// reference to whole form pass/fail
|
105
|
+
var failed = false;
|
106
|
+
|
107
|
+
// if no passed attribute found we should halt form submit
|
108
|
+
if(!$this.data('passed')) {
|
109
|
+
e.preventDefault();
|
110
|
+
|
111
|
+
// loop round validation objects and validate each
|
112
|
+
var reqLength = validations.length, i;
|
113
|
+
for(i = 0; i < reqLength; i++) {
|
114
|
+
if(!validations[i].validate()) {
|
115
|
+
failed = true;
|
116
|
+
}
|
117
|
+
}
|
118
|
+
|
119
|
+
// passed
|
120
|
+
if(!failed) {
|
121
|
+
// if submit method present call that otherwise submit form
|
122
|
+
if(settings.submit && typeof settings.submit === 'function') {
|
123
|
+
settings.submit($this.serializeArray());
|
124
|
+
return;
|
125
|
+
}
|
126
|
+
|
127
|
+
// store passed bool and re-submit
|
128
|
+
$this.data('passed', true).submit();
|
129
|
+
|
130
|
+
// failed
|
131
|
+
} else {
|
132
|
+
// call fail method if present
|
133
|
+
if(settings.fail && typeof settings.fail === 'function') {
|
134
|
+
settings.fail();
|
135
|
+
return;
|
136
|
+
}
|
137
|
+
}
|
138
|
+
}
|
139
|
+
});
|
140
|
+
});
|
141
|
+
};
|
142
|
+
}(jQuery);
|
@@ -0,0 +1,23 @@
|
|
1
|
+
// Gumby is ready to go
|
2
|
+
Gumby.ready(function() {
|
3
|
+
Gumby.log('Gumby is ready to go...', Gumby.dump());
|
4
|
+
|
5
|
+
// placeholder polyfil
|
6
|
+
if(Gumby.isOldie || Gumby.$dom.find('html').hasClass('ie9')) {
|
7
|
+
$('input, textarea').placeholder();
|
8
|
+
}
|
9
|
+
|
10
|
+
// skip link and toggle on one element
|
11
|
+
// when the skip link completes, trigger the switch
|
12
|
+
$('#skip-switch').on('gumby.onComplete', function() {
|
13
|
+
$(this).trigger('gumby.trigger');
|
14
|
+
});
|
15
|
+
|
16
|
+
// Oldie document loaded
|
17
|
+
}).oldie(function() {
|
18
|
+
Gumby.warn("This is an oldie browser...");
|
19
|
+
|
20
|
+
// Touch devices loaded
|
21
|
+
}).touch(function() {
|
22
|
+
Gumby.log("This is a touch enabled device...");
|
23
|
+
});
|
@@ -0,0 +1,4 @@
|
|
1
|
+
/*! http://mths.be/placeholder v2.0.7 by @mathias */
|
2
|
+
;(function(f,h,$){var a='placeholder' in h.createElement('input'),d='placeholder' in h.createElement('textarea'),i=$.fn,c=$.valHooks,k,j;if(a&&d){j=i.placeholder=function(){return this};j.input=j.textarea=true}else{j=i.placeholder=function(){var l=this;l.filter((a?'textarea':':input')+'[placeholder]').not('.placeholder').bind({'focus.placeholder':b,'blur.placeholder':e}).data('placeholder-enabled',true).trigger('blur.placeholder');return l};j.input=a;j.textarea=d;k={get:function(m){var l=$(m);return l.data('placeholder-enabled')&&l.hasClass('placeholder')?'':m.value},set:function(m,n){var l=$(m);if(!l.data('placeholder-enabled')){return m.value=n}if(n==''){m.value=n;if(m!=h.activeElement){e.call(m)}}else{if(l.hasClass('placeholder')){b.call(m,true,n)||(m.value=n)}else{m.value=n}}return l}};a||(c.input=k);d||(c.textarea=k);$(function(){$(h).delegate('form','submit.placeholder',function(){var l=$('.placeholder',this).each(b);setTimeout(function(){l.each(e)},10)})});$(f).bind('beforeunload.placeholder',function(){$('.placeholder').each(function(){this.value=''})})}function g(m){var l={},n=/^jQuery\d+$/;$.each(m.attributes,function(p,o){if(o.specified&&!n.test(o.name)){l[o.name]=o.value}});return l}function b(m,n){var l=this,o=$(l);if(l.value==o.attr('placeholder')&&o.hasClass('placeholder')){if(o.data('placeholder-password')){o=o.hide().next().show().attr('id',o.removeAttr('id').data('placeholder-id'));if(m===true){return o[0].value=n}o.focus()}else{l.value='';o.removeClass('placeholder');l==h.activeElement&&l.select()}}}function e(){var q,l=this,p=$(l),m=p,o=this.id;if(l.value==''){if(l.type=='password'){if(!p.data('placeholder-textinput')){try{q=p.clone().attr({type:'text'})}catch(n){q=$('<input>').attr($.extend(g(this),{type:'text'}))}q.removeAttr('name').data({'placeholder-password':true,'placeholder-id':o}).bind('focus.placeholder',b);p.data({'placeholder-textinput':q,'placeholder-id':o}).before(q)}p=p.removeAttr('id').hide().prev().attr('id',o).show()}p.addClass('placeholder');p[0].value=p.attr('placeholder')}else{p.removeClass('placeholder')}}}(this,document,jQuery));
|
3
|
+
|
4
|
+
// place any jQuery/helper plugins in here, instead of separate, slower script files.
|
@@ -0,0 +1,19 @@
|
|
1
|
+
//= require jquery
|
2
|
+
//= require gumby/libs/modernizr-2.6.2.min.js
|
3
|
+
//= require gumby/libs/gumby.js
|
4
|
+
//= require gumby/libs/ui/gumby.checkbox.js
|
5
|
+
//= require gumby/libs/ui/gumby.fixed.js
|
6
|
+
//= require gumby/libs/ui/gumby.navbar.js
|
7
|
+
//= require gumby/libs/ui/gumby.radiobtn.js
|
8
|
+
//= require gumby/libs/ui/gumby.retina.js
|
9
|
+
//= require gumby/libs/ui/gumby.skiplink.js
|
10
|
+
//= require gumby/libs/ui/gumby.tabs.js
|
11
|
+
//= require gumby/libs/ui/gumby.toggleswitch.js
|
12
|
+
//= require gumby/libs/ui/jquery.validation.js
|
13
|
+
//= require gumby/libs/extensions/gumby.comments.js
|
14
|
+
//= require gumby/libs/extensions/gumby.fittext.js
|
15
|
+
//= require gumby/libs/extensions/gumby.images.js
|
16
|
+
//= require gumby/libs/extensions/gumby.inview.js
|
17
|
+
//= require gumby/libs/extensions/gumby.parallax.js
|
18
|
+
//= require gumby/libs/extensions/gumby.shuffle.js
|
19
|
+
//= require gumby/libs/gumby.init.js
|
@@ -0,0 +1,13 @@
|
|
1
|
+
//= require jquery
|
2
|
+
//= require gumby/libs/modernizr-2.6.2.min.js
|
3
|
+
//= require gumby/libs/gumby.js
|
4
|
+
//= require gumby/libs/ui/gumby.checkbox.js
|
5
|
+
//= require gumby/libs/ui/gumby.fixed.js
|
6
|
+
//= require gumby/libs/ui/gumby.navbar.js
|
7
|
+
//= require gumby/libs/ui/gumby.radiobtn.js
|
8
|
+
//= require gumby/libs/ui/gumby.retina.js
|
9
|
+
//= require gumby/libs/ui/gumby.skiplink.js
|
10
|
+
//= require gumby/libs/ui/gumby.tabs.js
|
11
|
+
//= require gumby/libs/ui/gumby.toggleswitch.js
|
12
|
+
//= require gumby/libs/ui/jquery.validation.js
|
13
|
+
//= require gumby/libs/gumby.init.js
|
@@ -0,0 +1,49 @@
|
|
1
|
+
/* Base Styles */
|
2
|
+
|
3
|
+
@import "compass/typography/vertical_rhythm";
|
4
|
+
@include establish-baseline;
|
5
|
+
|
6
|
+
* { @include box-sizing(border-box); }
|
7
|
+
|
8
|
+
body {
|
9
|
+
background: $global-bg-color;
|
10
|
+
font-family: $font-family;
|
11
|
+
font-weight: $body-font-weight;
|
12
|
+
color: $body-font-color;
|
13
|
+
position: relative;
|
14
|
+
-webkit-font-smoothing: $font-smoothing;
|
15
|
+
-moz-osx-font-smoothing: grayscale;
|
16
|
+
@include respond(all-phones) {
|
17
|
+
-webkit-text-size-adjust: none;
|
18
|
+
-ms-text-size-adjust: none;
|
19
|
+
width: 100%;
|
20
|
+
min-width: 0;
|
21
|
+
}
|
22
|
+
}
|
23
|
+
|
24
|
+
html, body {
|
25
|
+
height: 100%;
|
26
|
+
}
|
27
|
+
|
28
|
+
.hide {
|
29
|
+
display: none;
|
30
|
+
}
|
31
|
+
|
32
|
+
.hide.active, .show {
|
33
|
+
display: block;
|
34
|
+
}
|
35
|
+
|
36
|
+
// include all entypo icon classes
|
37
|
+
@include icon(all);
|
38
|
+
|
39
|
+
// .fixed elements will be static at supplied breakpoint
|
40
|
+
// set arg to false for permanent .fixed elements
|
41
|
+
@include fixed(portrait-tablets);
|
42
|
+
|
43
|
+
.text-center { @extend %text-center; }
|
44
|
+
.text-left { @extend %text-left; }
|
45
|
+
.text-right { @extend %text-right; }
|
46
|
+
// Partial to align Text Left or Right
|
47
|
+
%text-center { text-align: center; }
|
48
|
+
%text-left { text-align: left; }
|
49
|
+
%text-right { text-align: right; }
|
@@ -0,0 +1 @@
|
|
1
|
+
// Your custom SCSS should be written here...
|
@@ -0,0 +1,28 @@
|
|
1
|
+
/* Fonts */
|
2
|
+
|
3
|
+
// Import Google Web Fonts
|
4
|
+
@import url(//fonts.googleapis.com/css?family=Open+Sans:400,300,600,700);
|
5
|
+
|
6
|
+
|
7
|
+
// Set local icon font
|
8
|
+
@font-face {
|
9
|
+
font-family: '#{$icons}';
|
10
|
+
font-style: normal;
|
11
|
+
font-weight: 400;
|
12
|
+
src: url(../fonts/icons/#{$icons}.eot);
|
13
|
+
src: url('../fonts/gumby/icons/#{$icons}.eot?#iefix') format('ie9-skip-eot'),
|
14
|
+
url('../fonts/gumby/icons/#{$icons}.woff') format('woff'),
|
15
|
+
url('../fonts/gumby/icons/#{$icons}.ttf') format('truetype');
|
16
|
+
}
|
17
|
+
|
18
|
+
// To include your own, local copies of fonts, use the following template
|
19
|
+
//
|
20
|
+
//@font-face {
|
21
|
+
// font-family: '#{$some-font-variable}';
|
22
|
+
// font-style: normal;
|
23
|
+
// font-weight: 400;
|
24
|
+
// src: url(../fonts/icons/#{$some-font-variable}.eot);
|
25
|
+
// src: url('../fonts/icons/#{$some-font-variable}.eot?#iefix') format('ie9-skip-eot'),
|
26
|
+
// url('../fonts/icons/#{$some-font-variable}.woff') format('woff'),
|
27
|
+
// url('../fonts/icons/#{$some-font-variable}.ttf') format('truetype');
|
28
|
+
//}
|