helios 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +93 -71
- data/README.md +150 -127
- data/helios.gemspec +5 -4
- data/lib/helios/backend/push-notification.rb +1 -0
- data/lib/helios/commands/link.rb +2 -0
- data/lib/helios/commands/new.rb +1 -0
- data/lib/helios/frontend/javascripts/vendor/foundation.js +163 -47
- data/lib/helios/frontend/javascripts/vendor/foundation/foundation.alerts.js +6 -4
- data/lib/helios/frontend/javascripts/vendor/foundation/foundation.clearing.js +70 -32
- data/lib/helios/frontend/javascripts/vendor/foundation/foundation.dropdown.js +87 -31
- data/lib/helios/frontend/javascripts/vendor/foundation/foundation.forms.js +360 -238
- data/lib/helios/frontend/javascripts/vendor/foundation/foundation.interchange.js +271 -0
- data/lib/helios/frontend/javascripts/vendor/foundation/foundation.joyride.js +279 -48
- data/lib/helios/frontend/javascripts/vendor/foundation/foundation.magellan.js +8 -4
- data/lib/helios/frontend/javascripts/vendor/foundation/foundation.orbit.js +59 -24
- data/lib/helios/frontend/javascripts/vendor/foundation/foundation.placeholder.js +21 -1
- data/lib/helios/frontend/javascripts/vendor/foundation/foundation.reveal.js +100 -42
- data/lib/helios/frontend/javascripts/vendor/foundation/foundation.section.js +299 -60
- data/lib/helios/frontend/javascripts/vendor/foundation/foundation.tooltips.js +26 -13
- data/lib/helios/frontend/javascripts/vendor/foundation/foundation.topbar.js +154 -59
- data/lib/helios/frontend/javascripts/vendor/foundation/index.js +17 -0
- data/lib/helios/frontend/stylesheets/screen.sass +0 -1
- data/lib/helios/frontend/templates/push-notification/devices.jst.tpl +0 -3
- data/lib/helios/templates/.gitignore.erb +32 -0
- data/lib/helios/version.rb +1 -1
- metadata +31 -14
@@ -6,27 +6,34 @@
|
|
6
6
|
Foundation.libs.section = {
|
7
7
|
name: 'section',
|
8
8
|
|
9
|
-
version : '4.
|
9
|
+
version : '4.2.3',
|
10
10
|
|
11
11
|
settings : {
|
12
12
|
deep_linking: false,
|
13
|
+
small_breakpoint: 768,
|
13
14
|
one_up: true,
|
15
|
+
section_selector : '[data-section]',
|
16
|
+
region_selector : 'section, .section, [data-section-region]',
|
17
|
+
title_selector : '.title, [data-section-title]',
|
18
|
+
active_region_selector : 'section.active, .section.active, .active[data-section-region]',
|
19
|
+
content_selector : '.content, [data-section-content]',
|
20
|
+
nav_selector : '[data-section="vertical-nav"], [data-section="horizontal-nav"]',
|
14
21
|
callback: function (){}
|
15
22
|
},
|
16
23
|
|
17
24
|
init : function (scope, method, options) {
|
18
|
-
|
19
|
-
Foundation.inherit(this, 'throttle data_options');
|
25
|
+
var self = this;
|
26
|
+
Foundation.inherit(this, 'throttle data_options position_right offset_right');
|
20
27
|
|
21
28
|
if (typeof method === 'object') {
|
22
|
-
$.extend(true,
|
29
|
+
$.extend(true, self.settings, method);
|
23
30
|
}
|
24
31
|
|
25
|
-
if (typeof method
|
32
|
+
if (typeof method !== 'string') {
|
26
33
|
this.set_active_from_hash();
|
27
|
-
|
34
|
+
this.events();
|
28
35
|
|
29
|
-
return
|
36
|
+
return true;
|
30
37
|
} else {
|
31
38
|
return this[method].call(this, options);
|
32
39
|
}
|
@@ -34,134 +41,366 @@
|
|
34
41
|
|
35
42
|
events : function () {
|
36
43
|
var self = this;
|
37
|
-
$(this.scope).on('click.fndtn.section', '[data-section] .title', function (e) {
|
38
|
-
$.extend(true, self.settings, self.data_options($(this).closest('[data-section]')));
|
39
|
-
self.toggle_active.call(this, e, self);
|
40
|
-
});
|
41
44
|
|
42
|
-
$(
|
43
|
-
|
44
|
-
|
45
|
+
$(this.scope)
|
46
|
+
.on('click.fndtn.section', '[data-section] .title, [data-section] [data-section-title]', function (e) {
|
47
|
+
var $this = $(this),
|
48
|
+
section = $this.closest(self.settings.region_selector);
|
49
|
+
|
50
|
+
if (section.children(self.settings.content_selector).length > 0) {
|
51
|
+
self.toggle_active.call(this, e, self);
|
52
|
+
self.reflow();
|
53
|
+
}
|
54
|
+
});
|
55
|
+
|
56
|
+
$(window)
|
57
|
+
.on('resize.fndtn.section', self.throttle(function () {
|
58
|
+
self.resize.call(this);
|
59
|
+
}, 30))
|
60
|
+
.on('hashchange', function () {
|
61
|
+
if (!self.settings.toggled){
|
62
|
+
self.set_active_from_hash();
|
63
|
+
$(this).trigger('resize');
|
64
|
+
}
|
65
|
+
}).trigger('resize');
|
66
|
+
|
67
|
+
$(document)
|
68
|
+
.on('click.fndtn.section', function (e) {
|
69
|
+
if ($(e.target).closest(self.settings.title_selector).length < 1) {
|
70
|
+
$(self.settings.nav_selector)
|
71
|
+
.children(self.settings.region_selector)
|
72
|
+
.removeClass('active')
|
73
|
+
.attr('style', '');
|
74
|
+
}
|
75
|
+
});
|
45
76
|
|
46
|
-
this.settings.init = true;
|
47
77
|
},
|
48
78
|
|
49
79
|
toggle_active : function (e, self) {
|
50
80
|
var $this = $(this),
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
81
|
+
self = Foundation.libs.section,
|
82
|
+
region = $this.closest(self.settings.region_selector),
|
83
|
+
content = $this.siblings(self.settings.content_selector),
|
84
|
+
parent = region.parent(),
|
85
|
+
settings = $.extend({}, self.settings, self.data_options(parent)),
|
86
|
+
prev_active_section = parent
|
87
|
+
.children(self.settings.active_region_selector);
|
88
|
+
|
89
|
+
self.settings.toggled = true;
|
55
90
|
|
56
|
-
if (!
|
91
|
+
if (!settings.deep_linking && content.length > 0) {
|
57
92
|
e.preventDefault();
|
58
93
|
}
|
59
94
|
|
60
|
-
if (
|
95
|
+
if (region.hasClass('active')) {
|
96
|
+
// this is causing the style flash.
|
61
97
|
if (self.small(parent)
|
62
|
-
|| self.
|
98
|
+
|| self.is_vertical_nav(parent)
|
99
|
+
|| self.is_horizontal_nav(parent)
|
63
100
|
|| self.is_accordion(parent)) {
|
64
|
-
|
65
|
-
|
66
|
-
|
101
|
+
if (prev_active_section[0] !== region[0]
|
102
|
+
|| (prev_active_section[0] === region[0] && !settings.one_up)) {
|
103
|
+
region
|
104
|
+
.removeClass('active')
|
105
|
+
.attr('style', '');
|
106
|
+
}
|
67
107
|
}
|
68
108
|
} else {
|
69
|
-
|
70
|
-
|
71
|
-
.
|
72
|
-
|
73
|
-
|
74
|
-
|
109
|
+
var prev_active_section = parent
|
110
|
+
.children(self.settings.active_region_selector),
|
111
|
+
title_height = self.outerHeight(region
|
112
|
+
.children(self.settings.title_selector));
|
113
|
+
|
114
|
+
if (self.small(parent) || settings.one_up) {
|
75
115
|
|
76
|
-
|
116
|
+
if (self.small(parent)) {
|
117
|
+
prev_active_section.attr('style', '');
|
118
|
+
} else {
|
119
|
+
prev_active_section.attr('style',
|
120
|
+
'visibility: hidden; padding-top: '+title_height+'px;');
|
121
|
+
}
|
77
122
|
}
|
78
123
|
|
79
124
|
if (self.small(parent)) {
|
80
|
-
|
125
|
+
region.attr('style', '');
|
126
|
+
} else {
|
127
|
+
region.css('padding-top', title_height);
|
81
128
|
}
|
82
129
|
|
83
|
-
|
130
|
+
region.addClass('active');
|
131
|
+
|
132
|
+
if (prev_active_section.length > 0) {
|
133
|
+
prev_active_section
|
134
|
+
.removeClass('active')
|
135
|
+
.attr('style', '');
|
136
|
+
}
|
137
|
+
|
138
|
+
// Toggle the content display attribute. This is done to
|
139
|
+
// ensure accurate outerWidth measurements that account for
|
140
|
+
// the scrollbar.
|
141
|
+
if (self.is_vertical_tabs(parent)) {
|
142
|
+
content.css('display', 'block');
|
143
|
+
|
144
|
+
if (prev_active_section !== null) {
|
145
|
+
prev_active_section
|
146
|
+
.children(self.settings.content_selector)
|
147
|
+
.css('display', 'none');
|
148
|
+
}
|
149
|
+
}
|
84
150
|
}
|
85
151
|
|
86
|
-
|
152
|
+
setTimeout(function () {
|
153
|
+
self.settings.toggled = false;
|
154
|
+
}, 300);
|
155
|
+
|
156
|
+
settings.callback();
|
87
157
|
},
|
88
158
|
|
89
159
|
resize : function () {
|
90
|
-
var
|
91
|
-
|
160
|
+
var self = Foundation.libs.section,
|
161
|
+
sections = $(self.settings.section_selector);
|
92
162
|
|
93
163
|
sections.each(function() {
|
94
164
|
var $this = $(this),
|
95
|
-
active_section = $this
|
165
|
+
active_section = $this
|
166
|
+
.children(self.settings.active_region_selector),
|
167
|
+
settings = $.extend({}, self.settings, self.data_options($this));
|
168
|
+
|
96
169
|
if (active_section.length > 1) {
|
97
170
|
active_section
|
98
171
|
.not(':first')
|
99
172
|
.removeClass('active')
|
100
173
|
.attr('style', '');
|
101
174
|
} else if (active_section.length < 1
|
102
|
-
&& !self.
|
175
|
+
&& !self.is_vertical_nav($this)
|
176
|
+
&& !self.is_horizontal_nav($this)
|
103
177
|
&& !self.is_accordion($this)) {
|
104
|
-
|
105
|
-
first.
|
178
|
+
|
179
|
+
var first = $this.children(self.settings.region_selector).first();
|
180
|
+
|
181
|
+
if (settings.one_up || !self.small($this)) {
|
182
|
+
first.addClass('active');
|
183
|
+
}
|
106
184
|
|
107
185
|
if (self.small($this)) {
|
108
186
|
first.attr('style', '');
|
109
187
|
} else {
|
110
|
-
first.css('padding-top', self.outerHeight(first
|
188
|
+
first.css('padding-top', self.outerHeight(first
|
189
|
+
.children(self.settings.title_selector)));
|
111
190
|
}
|
112
191
|
}
|
113
192
|
|
114
193
|
if (self.small($this)) {
|
115
194
|
active_section.attr('style', '');
|
116
195
|
} else {
|
117
|
-
active_section.css('padding-top', self.outerHeight(active_section
|
196
|
+
active_section.css('padding-top', self.outerHeight(active_section
|
197
|
+
.children(self.settings.title_selector)));
|
118
198
|
}
|
199
|
+
|
119
200
|
self.position_titles($this);
|
201
|
+
|
202
|
+
if ( (self.is_horizontal_nav($this) && !self.small($this))
|
203
|
+
|| self.is_vertical_tabs($this) && !self.small($this)) {
|
204
|
+
self.position_content($this);
|
205
|
+
} else {
|
206
|
+
self.position_content($this, false);
|
207
|
+
}
|
120
208
|
});
|
121
209
|
},
|
122
210
|
|
123
|
-
|
124
|
-
return el.
|
211
|
+
is_vertical_nav : function (el) {
|
212
|
+
return /vertical-nav/i.test(el.data('section'));
|
213
|
+
},
|
214
|
+
|
215
|
+
is_horizontal_nav : function (el) {
|
216
|
+
return /horizontal-nav/i.test(el.data('section'));
|
125
217
|
},
|
126
218
|
|
127
219
|
is_accordion : function (el) {
|
128
|
-
return el.
|
220
|
+
return /accordion/i.test(el.data('section'));
|
221
|
+
},
|
222
|
+
|
223
|
+
is_horizontal_tabs : function (el) {
|
224
|
+
return /^tabs$/i.test(el.data('section'));
|
225
|
+
},
|
226
|
+
|
227
|
+
is_vertical_tabs : function (el) {
|
228
|
+
return /vertical-tabs/i.test(el.data('section'));
|
129
229
|
},
|
130
230
|
|
131
231
|
set_active_from_hash : function () {
|
132
232
|
var hash = window.location.hash.substring(1),
|
133
233
|
sections = $('[data-section]'),
|
134
234
|
self = this;
|
135
|
-
|
136
235
|
sections.each(function () {
|
137
|
-
var section = $(this)
|
138
|
-
|
139
|
-
|
140
|
-
if (hash.length > 0 &&
|
141
|
-
section
|
142
|
-
.
|
143
|
-
.
|
144
|
-
.
|
236
|
+
var section = $(this),
|
237
|
+
settings = $.extend({}, self.settings, self.data_options(section));
|
238
|
+
|
239
|
+
if (hash.length > 0 && settings.deep_linking) {
|
240
|
+
var regions = section
|
241
|
+
.children(self.settings.region_selector)
|
242
|
+
.attr('style', '')
|
243
|
+
.removeClass('active');
|
244
|
+
|
245
|
+
var hash_regions = regions.map(function () {
|
246
|
+
var content = $(self.settings.content_selector, this),
|
247
|
+
content_slug = content.data('slug');
|
248
|
+
|
249
|
+
if (new RegExp(content_slug, 'i').test(hash))
|
250
|
+
return content;
|
251
|
+
});
|
252
|
+
|
253
|
+
|
254
|
+
var count = hash_regions.length;
|
255
|
+
|
256
|
+
for (var i = count - 1; i >= 0; i--) {
|
257
|
+
$(hash_regions[i]).parent().addClass('active');
|
258
|
+
}
|
145
259
|
}
|
146
260
|
});
|
147
261
|
},
|
148
262
|
|
149
263
|
position_titles : function (section, off) {
|
150
|
-
var
|
264
|
+
var self = this,
|
265
|
+
titles = section
|
266
|
+
.children(this.settings.region_selector)
|
267
|
+
.map(function () {
|
268
|
+
return $(this).children(self.settings.title_selector);
|
269
|
+
}),
|
151
270
|
previous_width = 0,
|
271
|
+
previous_height = 0,
|
152
272
|
self = this;
|
153
273
|
|
154
274
|
if (typeof off === 'boolean') {
|
155
275
|
titles.attr('style', '');
|
276
|
+
|
156
277
|
} else {
|
157
278
|
titles.each(function () {
|
158
|
-
|
159
|
-
|
279
|
+
if (self.is_vertical_tabs(section)) {
|
280
|
+
$(this).css('top', previous_height);
|
281
|
+
previous_height += self.outerHeight($(this));
|
282
|
+
} else {
|
283
|
+
if (!self.rtl) {
|
284
|
+
$(this).css('left', previous_width);
|
285
|
+
} else {
|
286
|
+
$(this).css('right', previous_width);
|
287
|
+
}
|
288
|
+
previous_width += self.outerWidth($(this));
|
289
|
+
}
|
160
290
|
});
|
161
291
|
}
|
162
292
|
},
|
163
293
|
|
294
|
+
position_content : function (section, off) {
|
295
|
+
var self = this,
|
296
|
+
regions = section.children(self.settings.region_selector),
|
297
|
+
titles = regions
|
298
|
+
.map(function () {
|
299
|
+
return $(this).children(self.settings.title_selector);
|
300
|
+
}),
|
301
|
+
content = regions
|
302
|
+
.map(function () {
|
303
|
+
return $(this).children(self.settings.content_selector);
|
304
|
+
});
|
305
|
+
|
306
|
+
if (typeof off === 'boolean') {
|
307
|
+
content.attr('style', '');
|
308
|
+
section.attr('style', '');
|
309
|
+
|
310
|
+
// Reset the minHeight and maxWidth values (only applicable to
|
311
|
+
// vertical tabs)
|
312
|
+
content.css('minHeight', '');
|
313
|
+
content.css('maxWidth', '');
|
314
|
+
} else {
|
315
|
+
if (self.is_vertical_tabs(section)
|
316
|
+
&& !self.small(section)) {
|
317
|
+
var content_min_height = 0,
|
318
|
+
content_min_width = Number.MAX_VALUE,
|
319
|
+
title_width = null;
|
320
|
+
|
321
|
+
regions.each(function () {
|
322
|
+
var region = $(this),
|
323
|
+
title = region.children(self.settings.title_selector),
|
324
|
+
content = region.children(self.settings.content_selector),
|
325
|
+
content_width = 0;
|
326
|
+
|
327
|
+
title_width = self.outerWidth(title);
|
328
|
+
content_width = self.outerWidth(section) - title_width;
|
329
|
+
|
330
|
+
if (content_width < content_min_width) {
|
331
|
+
content_min_width = content_width;
|
332
|
+
}
|
333
|
+
|
334
|
+
// Increment the minimum height of the content region
|
335
|
+
// to align with the height of the titles.
|
336
|
+
content_min_height += self.outerHeight(title);
|
337
|
+
|
338
|
+
// Set all of the inactive tabs to 'display: none'
|
339
|
+
// The CSS sets all of the tabs as 'display: block'
|
340
|
+
// in order to account for scrollbars when measuring the width
|
341
|
+
// of the content regions.
|
342
|
+
if (!$(this).hasClass('active')) {
|
343
|
+
content.css('display', 'none');
|
344
|
+
}
|
345
|
+
});
|
346
|
+
|
347
|
+
regions.each(function () {
|
348
|
+
var content = $(this).children(self.settings.content_selector);
|
349
|
+
content.css('minHeight', content_min_height);
|
350
|
+
|
351
|
+
// Remove 2 pixels to account for the right-shift in the CSS
|
352
|
+
content.css('maxWidth', content_min_width - 2);
|
353
|
+
});
|
354
|
+
|
355
|
+
} else {
|
356
|
+
regions.each(function () {
|
357
|
+
var region = $(this),
|
358
|
+
title = region.children(self.settings.title_selector),
|
359
|
+
content = region.children(self.settings.content_selector);
|
360
|
+
if (!self.rtl) {
|
361
|
+
content
|
362
|
+
.css({left: title.position().left - 1,
|
363
|
+
top: self.outerHeight(title) - 2});
|
364
|
+
} else {
|
365
|
+
content
|
366
|
+
.css({right: self.position_right(title) + 1,
|
367
|
+
top: self.outerHeight(title) - 2});
|
368
|
+
}
|
369
|
+
});
|
370
|
+
|
371
|
+
// temporary work around for Zepto outerheight calculation issues.
|
372
|
+
if (typeof Zepto === 'function') {
|
373
|
+
section.height(this.outerHeight($(titles[0])));
|
374
|
+
} else {
|
375
|
+
section.height(this.outerHeight($(titles[0])) - 2);
|
376
|
+
}
|
377
|
+
}
|
378
|
+
}
|
379
|
+
},
|
380
|
+
|
381
|
+
position_right : function (el) {
|
382
|
+
var self = this,
|
383
|
+
section = el.closest(this.settings.section_selector),
|
384
|
+
regions = section.children(this.settings.region_selector),
|
385
|
+
section_width = el.closest(this.settings.section_selector).width(),
|
386
|
+
offset = regions
|
387
|
+
.map(function () {
|
388
|
+
return $(this).children(self.settings.title_selector);
|
389
|
+
}).length;
|
390
|
+
return (section_width - el.position().left - el.width() * (el.index() + 1) - offset);
|
391
|
+
},
|
392
|
+
|
393
|
+
reflow : function (scope) {
|
394
|
+
var scope = scope || document;
|
395
|
+
$(this.settings.section_selector, scope).trigger('resize');
|
396
|
+
},
|
397
|
+
|
164
398
|
small : function (el) {
|
399
|
+
var settings = $.extend({}, this.settings, this.data_options(el));
|
400
|
+
|
401
|
+
if (this.is_horizontal_tabs(el)) {
|
402
|
+
return false;
|
403
|
+
}
|
165
404
|
if (el && this.is_accordion(el)) {
|
166
405
|
return true;
|
167
406
|
}
|
@@ -171,13 +410,13 @@
|
|
171
410
|
if ($('html').hasClass('ie8compat')) {
|
172
411
|
return true;
|
173
412
|
}
|
174
|
-
return $(this.scope).width() <
|
413
|
+
return $(this.scope).width() < settings.small_breakpoint;
|
175
414
|
},
|
176
415
|
|
177
416
|
off : function () {
|
178
417
|
$(this.scope).off('.fndtn.section');
|
179
418
|
$(window).off('.fndtn.section');
|
180
|
-
|
419
|
+
$(document).off('.fndtn.section')
|
181
420
|
}
|
182
421
|
};
|
183
422
|
}(Foundation.zj, this, this.document));
|