helios_aim 0.2.2

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.
Files changed (79) hide show
  1. checksums.yaml +15 -0
  2. data/Gemfile +3 -0
  3. data/Gemfile.lock +173 -0
  4. data/LICENSE +19 -0
  5. data/README.md +363 -0
  6. data/Rakefile +10 -0
  7. data/bin/helios +20 -0
  8. data/helios_aim.gemspec +47 -0
  9. data/lib/helios.rb +27 -0
  10. data/lib/helios/backend.rb +64 -0
  11. data/lib/helios/backend/data.rb +40 -0
  12. data/lib/helios/backend/in-app-purchase.rb +43 -0
  13. data/lib/helios/backend/newsstand.rb +97 -0
  14. data/lib/helios/backend/passbook.rb +41 -0
  15. data/lib/helios/backend/push-notification.rb +110 -0
  16. data/lib/helios/commands.rb +4 -0
  17. data/lib/helios/commands/console.rb +21 -0
  18. data/lib/helios/commands/link.rb +19 -0
  19. data/lib/helios/commands/new.rb +76 -0
  20. data/lib/helios/commands/server.rb +52 -0
  21. data/lib/helios/frontend.rb +66 -0
  22. data/lib/helios/frontend/fonts/icons.eot +0 -0
  23. data/lib/helios/frontend/fonts/icons.ttf +0 -0
  24. data/lib/helios/frontend/fonts/icons.woff +0 -0
  25. data/lib/helios/frontend/images/bg.jpg +0 -0
  26. data/lib/helios/frontend/images/helios.svg +33 -0
  27. data/lib/helios/frontend/javascripts/helios.coffee +72 -0
  28. data/lib/helios/frontend/javascripts/helios/collections.coffee +99 -0
  29. data/lib/helios/frontend/javascripts/helios/models.coffee +23 -0
  30. data/lib/helios/frontend/javascripts/helios/router.coffee +50 -0
  31. data/lib/helios/frontend/javascripts/helios/views.coffee +307 -0
  32. data/lib/helios/frontend/javascripts/vendor/backbone.datagrid.js +662 -0
  33. data/lib/helios/frontend/javascripts/vendor/backbone.js +1487 -0
  34. data/lib/helios/frontend/javascripts/vendor/backbone.paginator.js +1046 -0
  35. data/lib/helios/frontend/javascripts/vendor/codemirror.javascript.js +411 -0
  36. data/lib/helios/frontend/javascripts/vendor/codemirror.js +3047 -0
  37. data/lib/helios/frontend/javascripts/vendor/date.js +104 -0
  38. data/lib/helios/frontend/javascripts/vendor/foundation.js +331 -0
  39. data/lib/helios/frontend/javascripts/vendor/foundation/foundation.alerts.js +50 -0
  40. data/lib/helios/frontend/javascripts/vendor/foundation/foundation.clearing.js +478 -0
  41. data/lib/helios/frontend/javascripts/vendor/foundation/foundation.cookie.js +74 -0
  42. data/lib/helios/frontend/javascripts/vendor/foundation/foundation.dropdown.js +122 -0
  43. data/lib/helios/frontend/javascripts/vendor/foundation/foundation.forms.js +403 -0
  44. data/lib/helios/frontend/javascripts/vendor/foundation/foundation.joyride.js +613 -0
  45. data/lib/helios/frontend/javascripts/vendor/foundation/foundation.magellan.js +130 -0
  46. data/lib/helios/frontend/javascripts/vendor/foundation/foundation.orbit.js +355 -0
  47. data/lib/helios/frontend/javascripts/vendor/foundation/foundation.placeholder.js +159 -0
  48. data/lib/helios/frontend/javascripts/vendor/foundation/foundation.reveal.js +272 -0
  49. data/lib/helios/frontend/javascripts/vendor/foundation/foundation.section.js +183 -0
  50. data/lib/helios/frontend/javascripts/vendor/foundation/foundation.tooltips.js +195 -0
  51. data/lib/helios/frontend/javascripts/vendor/foundation/foundation.topbar.js +208 -0
  52. data/lib/helios/frontend/javascripts/vendor/jquery.js +9597 -0
  53. data/lib/helios/frontend/javascripts/vendor/jquery/jquery.fileupload-ui.js +807 -0
  54. data/lib/helios/frontend/javascripts/vendor/jquery/jquery.fileupload.js +1201 -0
  55. data/lib/helios/frontend/javascripts/vendor/jquery/jquery.ui.widget.js +530 -0
  56. data/lib/helios/frontend/javascripts/vendor/linkheaders.js +117 -0
  57. data/lib/helios/frontend/javascripts/vendor/underscore.js +1227 -0
  58. data/lib/helios/frontend/stylesheets/_codemirror.sass +219 -0
  59. data/lib/helios/frontend/stylesheets/_fonts.sass +80 -0
  60. data/lib/helios/frontend/stylesheets/_iphone.sass +141 -0
  61. data/lib/helios/frontend/stylesheets/_settings.scss +989 -0
  62. data/lib/helios/frontend/stylesheets/screen.sass +187 -0
  63. data/lib/helios/frontend/templates/data/entities.jst.tpl +11 -0
  64. data/lib/helios/frontend/templates/in-app-purchase/receipts.jst.tpl +11 -0
  65. data/lib/helios/frontend/templates/navigation.jst.tpl +31 -0
  66. data/lib/helios/frontend/templates/newsstand/issues.jst.tpl +16 -0
  67. data/lib/helios/frontend/templates/newsstand/new.jst.tpl +28 -0
  68. data/lib/helios/frontend/templates/passbook/passes.jst.tpl +11 -0
  69. data/lib/helios/frontend/templates/push-notification/compose.jst.tpl +70 -0
  70. data/lib/helios/frontend/templates/push-notification/devices.jst.tpl +17 -0
  71. data/lib/helios/frontend/views/index.haml +22 -0
  72. data/lib/helios/templates/.env.erb +1 -0
  73. data/lib/helios/templates/.gitignore +3 -0
  74. data/lib/helios/templates/Gemfile.erb +10 -0
  75. data/lib/helios/templates/Procfile.erb +1 -0
  76. data/lib/helios/templates/README.md.erb +4 -0
  77. data/lib/helios/templates/config.ru.erb +11 -0
  78. data/lib/helios/version.rb +3 -0
  79. metadata +475 -0
@@ -0,0 +1,478 @@
1
+ /*jslint unparam: true, browser: true, indent: 2 */
2
+
3
+ ;(function ($, window, document, undefined) {
4
+ 'use strict';
5
+
6
+ Foundation.libs.clearing = {
7
+ name : 'clearing',
8
+
9
+ version : '4.0.0',
10
+
11
+ settings : {
12
+ templates : {
13
+ viewing : '<a href="#" class="clearing-close">&times;</a>' +
14
+ '<div class="visible-img" style="display: none"><img src="//:0">' +
15
+ '<p class="clearing-caption"></p><a href="#" class="clearing-main-left"><span></span></a>' +
16
+ '<a href="#" class="clearing-main-right"><span></span></a></div>'
17
+ },
18
+
19
+ // comma delimited list of selectors that, on click, will close clearing,
20
+ // add 'div.clearing-blackout, div.visible-img' to close on background click
21
+ close_selectors : '.clearing-close',
22
+
23
+ // event initializers and locks
24
+ init : false,
25
+ locked : false
26
+ },
27
+
28
+ init : function (scope, method, options) {
29
+ this.scope = this.scope || scope;
30
+ Foundation.inherit(this, 'set_data get_data remove_data throttle');
31
+
32
+ if (typeof method === 'object') {
33
+ options = $.extend(true, this.settings, method);
34
+ }
35
+
36
+ if (typeof method != 'string') {
37
+ $(this.scope).find('ul[data-clearing]').each(function () {
38
+ var self = Foundation.libs.clearing,
39
+ $el = $(this),
40
+ options = options || {},
41
+ settings = self.get_data($el);
42
+
43
+ if (!settings) {
44
+ options.$parent = $el.parent();
45
+
46
+ self.set_data($el, $.extend(true, self.settings, options));
47
+
48
+ self.assemble($el.find('li'));
49
+
50
+ if (!self.settings.init) {
51
+ self.events().swipe_events();
52
+ }
53
+ }
54
+ });
55
+
56
+ return this.settings.init;
57
+ } else {
58
+ // fire method
59
+ return this[method].call(this, options);
60
+ }
61
+ },
62
+
63
+ // event binding and initial setup
64
+
65
+ events : function () {
66
+ var self = this;
67
+
68
+ $(this.scope)
69
+ .on('click.fndtn.clearing', 'ul[data-clearing] li',
70
+ function (e, current, target) {
71
+ var current = current || $(this),
72
+ target = target || current,
73
+ settings = self.get_data(current.parent());
74
+
75
+ e.preventDefault();
76
+ if (!settings) self.init();
77
+
78
+ // set current and target to the clicked li if not otherwise defined.
79
+ self.open($(e.target), current, target);
80
+ self.update_paddles(target);
81
+ })
82
+
83
+ .on('click.fndtn.clearing', '.clearing-main-right',
84
+ function (e) { this.nav(e, 'next') }.bind(this))
85
+ .on('click.fndtn.clearing', '.clearing-main-left',
86
+ function (e) { this.nav(e, 'prev') }.bind(this))
87
+ .on('click.fndtn.clearing', this.settings.close_selectors,
88
+ function (e) { Foundation.libs.clearing.close(e, this) })
89
+ .on('keydown.fndtn.clearing',
90
+ function (e) { this.keydown(e) }.bind(this));
91
+
92
+ $(window).on('resize.fndtn.clearing',
93
+ function (e) { this.resize() }.bind(this));
94
+
95
+ this.settings.init = true;
96
+ return this;
97
+ },
98
+
99
+ swipe_events : function () {
100
+ var self = this;
101
+
102
+ $(this.scope)
103
+ .on('touchstart.fndtn.clearing', '.visible-img', function(e) {
104
+ var data = {
105
+ start_page_x: e.touches[0].pageX,
106
+ start_page_y: e.touches[0].pageY,
107
+ start_time: (new Date()).getTime(),
108
+ delta_x: 0,
109
+ is_scrolling: undefined
110
+ };
111
+
112
+ $(this).data('swipe-transition', data);
113
+ e.stopPropagation();
114
+ })
115
+ .on('touchmove.fndtn.clearing', '.visible-img', function(e) {
116
+ // Ignore pinch/zoom events
117
+ if(e.touches.length > 1 || e.scale && e.scale !== 1) return;
118
+
119
+ var data = $(this).data('swipe-transition');
120
+
121
+ if (typeof data === 'undefined') {
122
+ data = {};
123
+ }
124
+
125
+ data.delta_x = e.touches[0].pageX - data.start_page_x;
126
+
127
+ if ( typeof data.is_scrolling === 'undefined') {
128
+ data.is_scrolling = !!( data.is_scrolling || Math.abs(data.delta_x) < Math.abs(e.touches[0].pageY - data.start_page_y) );
129
+ }
130
+
131
+ if (!data.is_scrolling && !data.active) {
132
+ e.preventDefault();
133
+ var direction = (data.delta_x < 0) ? 'next' : 'prev';
134
+ data.active = true;
135
+ self.nav(e, direction);
136
+ }
137
+ })
138
+ .on('touchend.fndtn.clearing', '.visible-img', function(e) {
139
+ $(this).data('swipe-transition', {});
140
+ e.stopPropagation();
141
+ });
142
+ },
143
+
144
+ assemble : function ($li) {
145
+ var $el = $li.parent(),
146
+ settings = this.get_data($el),
147
+ grid = $el.detach(),
148
+ data = {
149
+ grid: '<div class="carousel">' + this.outerHTML(grid[0]) + '</div>',
150
+ viewing: settings.templates.viewing
151
+ },
152
+ wrapper = '<div class="clearing-assembled"><div>' + data.viewing +
153
+ data.grid + '</div></div>';
154
+
155
+ return settings.$parent.append(wrapper);
156
+ },
157
+
158
+ // event callbacks
159
+
160
+ open : function ($image, current, target) {
161
+ var root = target.closest('.clearing-assembled'),
162
+ container = root.find('div').first(),
163
+ visible_image = container.find('.visible-img'),
164
+ image = visible_image.find('img').not($image);
165
+
166
+ if (!this.locked()) {
167
+ // set the image to the selected thumbnail
168
+ image.attr('src', this.load($image));
169
+
170
+ this.loaded(image, function () {
171
+ // toggle the gallery
172
+ root.addClass('clearing-blackout');
173
+ container.addClass('clearing-container');
174
+ visible_image.show();
175
+ this.fix_height(target)
176
+ .caption(visible_image.find('.clearing-caption'), $image)
177
+ .center(image)
178
+ .shift(current, target, function () {
179
+ target.siblings().removeClass('visible');
180
+ target.addClass('visible');
181
+ });
182
+ }.bind(this));
183
+ }
184
+ },
185
+
186
+ close : function (e, el) {
187
+ e.preventDefault();
188
+
189
+ var root = (function (target) {
190
+ if (/blackout/.test(target.selector)) {
191
+ return target;
192
+ } else {
193
+ return target.closest('.clearing-blackout');
194
+ }
195
+ }($(el))), container, visible_image;
196
+
197
+ if (el === e.target && root) {
198
+ container = root.find('div').first(),
199
+ visible_image = container.find('.visible-img');
200
+ this.settings.prev_index = 0;
201
+ root.find('ul[data-clearing]')
202
+ .attr('style', '').closest('.clearing-blackout')
203
+ .removeClass('clearing-blackout');
204
+ container.removeClass('clearing-container');
205
+ visible_image.hide();
206
+ }
207
+
208
+ return false;
209
+ },
210
+
211
+ keydown : function (e) {
212
+ var clearing = $('.clearing-blackout').find('ul[data-clearing]');
213
+
214
+ if (e.which === 39) this.go(clearing, 'next');
215
+ if (e.which === 37) this.go(clearing, 'prev');
216
+ if (e.which === 27) $('a.clearing-close').trigger('click');
217
+ },
218
+
219
+ nav : function (e, direction) {
220
+ var clearing = $('.clearing-blackout').find('ul[data-clearing]');
221
+
222
+ e.preventDefault();
223
+ this.go(clearing, direction);
224
+ },
225
+
226
+ resize : function () {
227
+ var image = $('.clearing-blackout .visible-img').find('img');
228
+
229
+ if (image.length) {
230
+ this.center(image);
231
+ }
232
+ },
233
+
234
+ // visual adjustments
235
+ fix_height : function (target) {
236
+ var lis = target.parent().children(),
237
+ self = this;
238
+
239
+ lis.each(function () {
240
+ var li = $(this),
241
+ image = li.find('img');
242
+
243
+ if (li.height() > self.outerHeight(image)) {
244
+ li.addClass('fix-height');
245
+ }
246
+ })
247
+ .closest('ul')
248
+ .width(lis.length * 100 + '%');
249
+
250
+ return this;
251
+ },
252
+
253
+ update_paddles : function (target) {
254
+ var visible_image = target
255
+ .closest('.carousel')
256
+ .siblings('.visible-img');
257
+
258
+ if (target.next().length) {
259
+ visible_image
260
+ .find('.clearing-main-right')
261
+ .removeClass('disabled');
262
+ } else {
263
+ visible_image
264
+ .find('.clearing-main-right')
265
+ .addClass('disabled');
266
+ }
267
+
268
+ if (target.prev().length) {
269
+ visible_image
270
+ .find('.clearing-main-left')
271
+ .removeClass('disabled');
272
+ } else {
273
+ visible_image
274
+ .find('.clearing-main-left')
275
+ .addClass('disabled');
276
+ }
277
+ },
278
+
279
+ center : function (target) {
280
+ target.css({
281
+ marginLeft : -(this.outerWidth(target) / 2),
282
+ marginTop : -(this.outerHeight(target) / 2)
283
+ });
284
+ return this;
285
+ },
286
+
287
+ // image loading and preloading
288
+
289
+ load : function ($image) {
290
+ var href = $image.parent().attr('href');
291
+
292
+ this.preload($image);
293
+
294
+ if (href) return href;
295
+ return $image.attr('src');
296
+ },
297
+
298
+ preload : function ($image) {
299
+ this
300
+ .img($image.closest('li').next())
301
+ .img($image.closest('li').prev());
302
+ },
303
+
304
+ loaded : function (image, callback) {
305
+ // based on jquery.imageready.js
306
+ // @weblinc, @jsantell, (c) 2012
307
+
308
+ function loaded () {
309
+ callback();
310
+ }
311
+
312
+ function bindLoad () {
313
+ this.one('load', loaded);
314
+
315
+ if (/MSIE (\d+\.\d+);/.test(navigator.userAgent)) {
316
+ var src = this.attr( 'src' ),
317
+ param = src.match( /\?/ ) ? '&' : '?';
318
+
319
+ param += 'random=' + (new Date()).getTime();
320
+ this.attr('src', src + param);
321
+ }
322
+ }
323
+
324
+ if (!image.attr('src')) {
325
+ loaded();
326
+ return;
327
+ }
328
+
329
+ if (this.complete || this.readyState === 4) {
330
+ loaded();
331
+ } else {
332
+ bindLoad.call(image);
333
+ }
334
+ },
335
+
336
+ img : function (img) {
337
+ if (img.length) {
338
+ var new_img = new Image(),
339
+ new_a = img.find('a');
340
+
341
+ if (new_a.length) {
342
+ new_img.src = new_a.attr('href');
343
+ } else {
344
+ new_img.src = img.find('img').attr('src');
345
+ }
346
+ }
347
+ return this;
348
+ },
349
+
350
+ // image caption
351
+
352
+ caption : function (container, $image) {
353
+ var caption = $image.data('caption');
354
+
355
+ if (caption) {
356
+ container
357
+ .text(caption)
358
+ .show();
359
+ } else {
360
+ container
361
+ .text('')
362
+ .hide();
363
+ }
364
+ return this;
365
+ },
366
+
367
+ // directional methods
368
+
369
+ go : function ($ul, direction) {
370
+ var current = $ul.find('.visible'),
371
+ target = current[direction]();
372
+
373
+ if (target.length) {
374
+ target
375
+ .find('img')
376
+ .trigger('click', [current, target]);
377
+ }
378
+ },
379
+
380
+ shift : function (current, target, callback) {
381
+ var clearing = target.parent(),
382
+ old_index = this.settings.prev_index || target.index(),
383
+ direction = this.direction(clearing, current, target),
384
+ left = parseInt(clearing.css('left'), 10),
385
+ width = this.outerWidth(target),
386
+ skip_shift;
387
+
388
+ // we use jQuery animate instead of CSS transitions because we
389
+ // need a callback to unlock the next animation
390
+ if (target.index() !== old_index && !/skip/.test(direction)){
391
+ if (/left/.test(direction)) {
392
+ this.lock();
393
+ clearing.animate({left : left + width}, 300, this.unlock());
394
+ } else if (/right/.test(direction)) {
395
+ this.lock();
396
+ clearing.animate({left : left - width}, 300, this.unlock());
397
+ }
398
+ } else if (/skip/.test(direction)) {
399
+ // the target image is not adjacent to the current image, so
400
+ // do we scroll right or not
401
+ skip_shift = target.index() - this.settings.up_count;
402
+ this.lock();
403
+
404
+ if (skip_shift > 0) {
405
+ clearing.animate({left : -(skip_shift * width)}, 300, this.unlock());
406
+ } else {
407
+ clearing.animate({left : 0}, 300, this.unlock());
408
+ }
409
+ }
410
+
411
+ callback();
412
+ },
413
+
414
+ direction : function ($el, current, target) {
415
+ var lis = $el.find('li'),
416
+ li_width = this.outerWidth(lis) + (this.outerWidth(lis) / 4),
417
+ up_count = Math.floor(this.outerWidth($('.clearing-container')) / li_width) - 1,
418
+ target_index = lis.index(target),
419
+ response;
420
+
421
+ this.settings.up_count = up_count;
422
+
423
+ if (this.adjacent(this.settings.prev_index, target_index)) {
424
+ if ((target_index > up_count)
425
+ && target_index > this.settings.prev_index) {
426
+ response = 'right';
427
+ } else if ((target_index > up_count - 1)
428
+ && target_index <= this.settings.prev_index) {
429
+ response = 'left';
430
+ } else {
431
+ response = false;
432
+ }
433
+ } else {
434
+ response = 'skip';
435
+ }
436
+
437
+ this.settings.prev_index = target_index;
438
+
439
+ return response;
440
+ },
441
+
442
+ adjacent : function (current_index, target_index) {
443
+ for (var i = target_index + 1; i >= target_index - 1; i--) {
444
+ if (i === current_index) return true;
445
+ }
446
+ return false;
447
+ },
448
+
449
+ // lock management
450
+
451
+ lock : function () {
452
+ this.settings.locked = true;
453
+ },
454
+
455
+ unlock : function () {
456
+ this.settings.locked = false;
457
+ },
458
+
459
+ locked : function () {
460
+ return this.settings.locked;
461
+ },
462
+
463
+ // plugin management/browser quirks
464
+
465
+ outerHTML : function (el) {
466
+ // support FireFox < 11
467
+ return el.outerHTML || new XMLSerializer().serializeToString(el);
468
+ },
469
+
470
+ off : function () {
471
+ $(this.scope).off('.fndtn.clearing');
472
+ $(window).off('.fndtn.clearing');
473
+ this.remove_data(); // empty settings cache
474
+ this.settings.init = false;
475
+ }
476
+ };
477
+
478
+ }(Foundation.zj, this, this.document));