helios 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (69) hide show
  1. data/Gemfile.lock +82 -37
  2. data/README.md +16 -0
  3. data/bin/helios +4 -0
  4. data/example/Gemfile +7 -0
  5. data/example/Gemfile.lock +149 -0
  6. data/example/Procfile +1 -0
  7. data/example/Sample.xcdatamodeld/Sample.xcdatamodel/contents +23 -0
  8. data/example/config.ru +6 -0
  9. data/helios.gemspec +17 -7
  10. data/lib/helios.rb +15 -1
  11. data/lib/helios/backend.rb +46 -0
  12. data/lib/helios/backend/data.rb +36 -0
  13. data/lib/helios/backend/in-app-purchase.rb +33 -0
  14. data/lib/helios/backend/passbook.rb +25 -0
  15. data/lib/helios/backend/push-notification.rb +90 -0
  16. data/lib/helios/commands.rb +1 -0
  17. data/lib/helios/commands/new.rb +27 -0
  18. data/lib/helios/frontend.rb +56 -0
  19. data/lib/helios/frontend/images/data.png +0 -0
  20. data/lib/helios/frontend/images/data.svg +1 -0
  21. data/lib/helios/frontend/images/in-app-purchase.png +0 -0
  22. data/lib/helios/frontend/images/in-app-purchase.svg +1 -0
  23. data/lib/helios/frontend/images/passbook.png +0 -0
  24. data/lib/helios/frontend/images/passbook.svg +1 -0
  25. data/lib/helios/frontend/images/push-notification.png +0 -0
  26. data/lib/helios/frontend/images/push-notification.svg +1 -0
  27. data/lib/helios/frontend/javascripts/foundation/foundation.alerts.js +50 -0
  28. data/lib/helios/frontend/javascripts/foundation/foundation.clearing.js +478 -0
  29. data/lib/helios/frontend/javascripts/foundation/foundation.cookie.js +74 -0
  30. data/lib/helios/frontend/javascripts/foundation/foundation.dropdown.js +122 -0
  31. data/lib/helios/frontend/javascripts/foundation/foundation.forms.js +403 -0
  32. data/lib/helios/frontend/javascripts/foundation/foundation.joyride.js +613 -0
  33. data/lib/helios/frontend/javascripts/foundation/foundation.js +331 -0
  34. data/lib/helios/frontend/javascripts/foundation/foundation.magellan.js +130 -0
  35. data/lib/helios/frontend/javascripts/foundation/foundation.orbit.js +355 -0
  36. data/lib/helios/frontend/javascripts/foundation/foundation.placeholder.js +159 -0
  37. data/lib/helios/frontend/javascripts/foundation/foundation.reveal.js +272 -0
  38. data/lib/helios/frontend/javascripts/foundation/foundation.section.js +183 -0
  39. data/lib/helios/frontend/javascripts/foundation/foundation.tooltips.js +195 -0
  40. data/lib/helios/frontend/javascripts/foundation/foundation.topbar.js +208 -0
  41. data/lib/helios/frontend/javascripts/helios.coffee +48 -0
  42. data/lib/helios/frontend/javascripts/helios/collections.coffee +30 -0
  43. data/lib/helios/frontend/javascripts/helios/models.coffee +23 -0
  44. data/lib/helios/frontend/javascripts/helios/router.coffee +52 -0
  45. data/lib/helios/frontend/javascripts/helios/views.coffee +92 -0
  46. data/lib/helios/frontend/javascripts/vendor/backbone.datagrid.js +662 -0
  47. data/lib/helios/frontend/javascripts/vendor/backbone.js +1487 -0
  48. data/lib/helios/frontend/javascripts/vendor/jquery.js +9597 -0
  49. data/lib/helios/frontend/javascripts/vendor/underscore.js +1227 -0
  50. data/lib/helios/frontend/stylesheets/_settings.scss +988 -0
  51. data/lib/helios/frontend/stylesheets/screen.sass +98 -0
  52. data/lib/helios/frontend/templates/data/entities.hbs +7 -0
  53. data/lib/helios/frontend/templates/data/entity.hbs +17 -0
  54. data/lib/helios/frontend/templates/in-app-purchase/receipt.hbs +53 -0
  55. data/lib/helios/frontend/templates/in-app-purchase/receipts.hbs +39 -0
  56. data/lib/helios/frontend/templates/passbook/passes.hbs +25 -0
  57. data/lib/helios/frontend/templates/push-notification/device.hbs +35 -0
  58. data/lib/helios/frontend/templates/push-notification/devices.hbs +37 -0
  59. data/lib/helios/frontend/views/devices.jst.tpl +3 -0
  60. data/lib/helios/frontend/views/entities.jst.tpl +9 -0
  61. data/lib/helios/frontend/views/index.haml +30 -0
  62. data/lib/helios/frontend/views/passes.jst.tpl +3 -0
  63. data/lib/helios/frontend/views/receipts.jst.tpl +3 -0
  64. data/lib/helios/templates/Gemfile.erb +7 -0
  65. data/lib/helios/templates/Procfile.erb +1 -0
  66. data/lib/helios/templates/README.md.erb +9 -0
  67. data/lib/helios/templates/config.ru.erb +6 -0
  68. data/lib/helios/version.rb +3 -0
  69. metadata +199 -26
@@ -0,0 +1,331 @@
1
+ /*
2
+ * Foundation Responsive Library
3
+ * http://foundation.zurb.com
4
+ * Copyright 2013, ZURB
5
+ * Free to use under the MIT license.
6
+ * http://www.opensource.org/licenses/mit-license.php
7
+ */
8
+
9
+ /*jslint unparam: true, browser: true, indent: 2 */
10
+
11
+ (function () {
12
+ // add dusty browser stuff
13
+ if (!Array.prototype.filter) {
14
+ Array.prototype.filter = function(fun /*, thisp */) {
15
+ "use strict";
16
+
17
+ if (this == null) {
18
+ throw new TypeError();
19
+ }
20
+
21
+ var t = Object(this),
22
+ len = t.length >>> 0;
23
+ if (typeof fun != "function") {
24
+ try {
25
+ throw new TypeError();
26
+ } catch (e) {
27
+ return;
28
+ }
29
+ }
30
+
31
+ var res = [],
32
+ thisp = arguments[1];
33
+ for (var i = 0; i < len; i++) {
34
+ if (i in t) {
35
+ var val = t[i]; // in case fun mutates this
36
+ if (fun && fun.call(thisp, val, i, t)) {
37
+ res.push(val);
38
+ }
39
+ }
40
+ }
41
+
42
+ return res;
43
+ };
44
+
45
+ if (!Function.prototype.bind) {
46
+ Function.prototype.bind = function (oThis) {
47
+ if (typeof this !== "function") {
48
+ // closest thing possible to the ECMAScript 5 internal IsCallable function
49
+ throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable");
50
+ }
51
+
52
+ var aArgs = Array.prototype.slice.call(arguments, 1),
53
+ fToBind = this,
54
+ fNOP = function () {},
55
+ fBound = function () {
56
+ return fToBind.apply(this instanceof fNOP && oThis
57
+ ? this
58
+ : oThis,
59
+ aArgs.concat(Array.prototype.slice.call(arguments)));
60
+ };
61
+
62
+ fNOP.prototype = this.prototype;
63
+ fBound.prototype = new fNOP();
64
+
65
+ return fBound;
66
+ };
67
+ }
68
+ }
69
+
70
+ // fake stop() for zepto.
71
+ $.fn.stop = $.fn.stop || function() {
72
+ return this;
73
+ };
74
+ }());
75
+
76
+ ;(function (window, document, undefined) {
77
+ 'use strict';
78
+
79
+ window.Foundation = {
80
+ name : 'Foundation',
81
+
82
+ version : '4.0.0',
83
+
84
+ // global Foundation cache object
85
+ cache : {},
86
+
87
+ init : function (scope, libraries, method, options, response, /* internal */ nc) {
88
+ var library_arr,
89
+ args = [scope, method, options, response],
90
+ responses = [],
91
+ nc = nc || false;
92
+
93
+ // disable library error catching,
94
+ // used for development only
95
+ if (nc) this.nc = nc;
96
+
97
+ // set foundation global scope
98
+ this.scope = scope || this.scope;
99
+
100
+ if (libraries && typeof libraries === 'string') {
101
+ if (/off/i.test(libraries)) return this.off();
102
+
103
+ library_arr = libraries.split(' ');
104
+
105
+ if (library_arr.length > 0) {
106
+ for (var i = library_arr.length - 1; i >= 0; i--) {
107
+ responses.push(this.init_lib(library_arr[i], args));
108
+ }
109
+ }
110
+ } else {
111
+ for (var lib in this.libs) {
112
+ responses.push(this.init_lib(lib, args));
113
+ }
114
+ }
115
+
116
+ // if first argument is callback, add to args
117
+ if (typeof libraries === 'function') {
118
+ args.unshift(libraries);
119
+ }
120
+
121
+ return this.response_obj(responses, args);
122
+ },
123
+
124
+ response_obj : function (response_arr, args) {
125
+ for (var callback in args) {
126
+ if (typeof args[callback] === 'function') {
127
+ return args[callback]({
128
+ errors: response_arr.filter(function (s) {
129
+ if (typeof s === 'string') return s;
130
+ })
131
+ });
132
+ }
133
+ }
134
+
135
+ return response_arr;
136
+ },
137
+
138
+ init_lib : function (lib, args) {
139
+ return this.trap(function () {
140
+ if (this.libs.hasOwnProperty(lib)) {
141
+ this.patch(this.libs[lib]);
142
+ return this.libs[lib].init.apply(this.libs[lib], args);
143
+ }
144
+ }.bind(this), lib);
145
+ },
146
+
147
+ trap : function (fun, lib) {
148
+ if (!this.nc) {
149
+ try {
150
+ return fun();
151
+ } catch (e) {
152
+ return this.error({name: lib, message: 'could not be initialized', more: e.name + ' ' + e.message});
153
+ }
154
+ }
155
+
156
+ return fun();
157
+ },
158
+
159
+ patch : function (lib) {
160
+ this.fix_outer(lib);
161
+ },
162
+
163
+ inherit : function (scope, methods) {
164
+ var methods_arr = methods.split(' ');
165
+
166
+ for (var i = methods_arr.length - 1; i >= 0; i--) {
167
+ if (this.lib_methods.hasOwnProperty(methods_arr[i])) {
168
+ this.libs[scope.name][methods_arr[i]] = this.lib_methods[methods_arr[i]];
169
+ }
170
+ }
171
+ },
172
+
173
+ libs : {},
174
+
175
+ // methods that can be inherited in libraries
176
+ lib_methods : {
177
+ set_data : function (node, data) {
178
+ // this.name references the name of the library calling this method
179
+ var id = this.name + (+new Date());
180
+
181
+ Foundation.cache[id] = data;
182
+ node.attr('data-' + this.name + '-id', id);
183
+ },
184
+
185
+ get_data : function (node) {
186
+ return Foundation.cache[node.attr('data-' + this.name + '-id')];
187
+ },
188
+
189
+ remove_data : function (node) {
190
+ if (node) {
191
+ delete Foundation.cache[node.attr('data-' + this.name + '-id')];
192
+ node.attr('data-' + this.name + '-id', '');
193
+ } else {
194
+ $('[data-' + this.name + '-id]').each(function () {
195
+ delete Foundation.cache[$(this).attr('data-' + this.name + '-id')];
196
+ $(this).attr('data-' + this.name + '-id', '');
197
+ });
198
+ }
199
+ },
200
+
201
+ throttle : function(fun, delay) {
202
+ var timer = null;
203
+ return function () {
204
+ var context = this, args = arguments;
205
+ clearTimeout(timer);
206
+ timer = setTimeout(function () {
207
+ fun.apply(context, args);
208
+ }, delay);
209
+ };
210
+ },
211
+
212
+ // parses dat-options attribute on page nodes and turns
213
+ // them into an object
214
+ data_options : function (el) {
215
+ var opts = {}, ii, p,
216
+ opts_arr = (el.attr('data-options') || ':').split(';'),
217
+ opts_len = opts_arr.length;
218
+
219
+ function trim(str) {
220
+ if (typeof str === 'string') return $.trim(str);
221
+ return str;
222
+ }
223
+
224
+ // parse options
225
+ for (ii = opts_len - 1; ii >= 0; ii--) {
226
+ p = opts_arr[ii].split(':');
227
+
228
+ if (/true/i.test(p[1])) p[1] = true;
229
+ if (/false/i.test(p[1])) p[1] = false;
230
+
231
+ if (p.length === 2) {
232
+ opts[trim(p[0])] = trim(p[1]);
233
+ }
234
+ }
235
+
236
+ return opts;
237
+ },
238
+
239
+ delay : function (fun, delay) {
240
+ return setTimeout(fun, delay);
241
+ },
242
+
243
+ // animated scrolling
244
+ scrollTo : function (el, to, duration) {
245
+ if (duration < 0) return;
246
+ var difference = to - $(window).scrollTop();
247
+ var perTick = difference / duration * 10;
248
+
249
+ this.scrollToTimerCache = setTimeout(function() {
250
+ if (!isNaN(parseInt(perTick, 10))) {
251
+ window.scrollTo(0, $(window).scrollTop() + perTick);
252
+ this.scrollTo(el, to, duration - 10);
253
+ }
254
+ }.bind(this), 10);
255
+ },
256
+
257
+ // not supported in core Zepto
258
+ scrollLeft : function (el) {
259
+ if (!el.length) return;
260
+ return ('scrollLeft' in el[0]) ? el[0].scrollLeft : el[0].pageXOffset;
261
+ },
262
+
263
+ // test for empty object or array
264
+ empty : function (obj) {
265
+ if (obj.length && obj.length > 0) return false;
266
+ if (obj.length && obj.length === 0) return true;
267
+
268
+ for (var key in obj) {
269
+ if (hasOwnProperty.call(obj, key)) return false;
270
+ }
271
+
272
+ return true;
273
+ }
274
+ },
275
+
276
+ fix_outer : function (lib) {
277
+ lib.outerHeight = function (el, bool) {
278
+ if (typeof Zepto === 'function') {
279
+ return el.height();
280
+ }
281
+
282
+ if (typeof bool !== 'undefined') {
283
+ return el.outerHeight(bool);
284
+ }
285
+
286
+ return el.outerHeight();
287
+ };
288
+
289
+ lib.outerWidth = function (el) {
290
+ if (typeof Zepto === 'function') {
291
+ return el.width();
292
+ }
293
+
294
+ if (typeof bool !== 'undefined') {
295
+ return el.outerWidth(bool);
296
+ }
297
+
298
+ return el.outerWidth();
299
+ };
300
+ },
301
+
302
+ error : function (error) {
303
+ return error.name + ' ' + error.message + '; ' + error.more;
304
+ },
305
+
306
+ // remove all foundation events.
307
+ off: function () {
308
+ $(this.scope).off('.fndtn');
309
+ $(window).off('.fndtn');
310
+ return true;
311
+ },
312
+
313
+ zj : function () {
314
+ try {
315
+ return Zepto;
316
+ } catch (e) {
317
+ return jQuery;
318
+ }
319
+ }()
320
+ },
321
+
322
+ $.fn.foundation = function () {
323
+ var args = Array.prototype.slice.call(arguments, 0);
324
+
325
+ return this.each(function () {
326
+ Foundation.init.apply(Foundation, [this].concat(args));
327
+ return this;
328
+ });
329
+ };
330
+
331
+ }(this, this.document));
@@ -0,0 +1,130 @@
1
+ /*jslint unparam: true, browser: true, indent: 2 */
2
+
3
+ ;(function ($, window, document, undefined) {
4
+ 'use strict';
5
+
6
+ Foundation.libs.magellan = {
7
+ name : 'magellan',
8
+
9
+ version : '4.0.0',
10
+
11
+ settings : {
12
+ activeClass: 'active'
13
+ },
14
+
15
+ init : function (scope, method, options) {
16
+ this.scope = scope || this.scope;
17
+ Foundation.inherit(this, 'data_options');
18
+
19
+ if (typeof method === 'object') {
20
+ $.extend(true, this.settings, method);
21
+ }
22
+
23
+ if (typeof method != 'string') {
24
+ if (!this.settings.init) {
25
+ this.fixed_magellan = $("[data-magellan-expedition]");
26
+ this.set_threshold();
27
+ this.last_destination = $('[data-magellan-destination]').last();
28
+ this.events();
29
+ }
30
+
31
+ return this.settings.init;
32
+ } else {
33
+ return this[method].call(this, options);
34
+ }
35
+ },
36
+
37
+ events : function () {
38
+ var self = this;
39
+ $(this.scope).on('arrival.fndtn.magellan', '[data-magellan-arrival]', function (e) {
40
+ var $destination = $(this),
41
+ $expedition = $destination.closest('[data-magellan-expedition]'),
42
+ activeClass = $expedition.attr('data-magellan-active-class')
43
+ || self.settings.activeClass;
44
+
45
+ $destination
46
+ .closest('[data-magellan-expedition]')
47
+ .find('[data-magellan-arrival]')
48
+ .not($destination)
49
+ .removeClass(activeClass);
50
+ $destination.addClass(activeClass);
51
+ });
52
+
53
+ this.fixed_magellan
54
+ .on('update-position.fndtn.magellan', function(){
55
+ var $el = $(this);
56
+ // $el.data("magellan-fixed-position","");
57
+ //$el.data("magellan-top-offset", "");
58
+ })
59
+ .trigger('update-position');
60
+
61
+ $(window)
62
+ .on('resize.fndtn.magellan', function() {
63
+ this.fixed_magellan.trigger('update-position');
64
+ }.bind(this))
65
+
66
+ .on('scroll.fndtn.magellan', function() {
67
+ var windowScrollTop = $(window).scrollTop();
68
+ self.fixed_magellan.each(function() {
69
+ var $expedition = $(this);
70
+ if (typeof $expedition.data('magellan-top-offset') === 'undefined') {
71
+ $expedition.data('magellan-top-offset', $expedition.offset().top);
72
+ }
73
+ if (typeof $expedition.data('magellan-fixed-position') === 'undefined') {
74
+ $expedition.data('magellan-fixed-position', false)
75
+ }
76
+ var fixed_position = (windowScrollTop + self.settings.threshold) > $expedition.data("magellan-top-offset");
77
+ var attr = $expedition.attr('data-magellan-top-offset');
78
+
79
+ if ($expedition.data("magellan-fixed-position") != fixed_position) {
80
+ $expedition.data("magellan-fixed-position", fixed_position);
81
+ if (fixed_position) {
82
+ $expedition.css({position:"fixed", top:0});
83
+ } else {
84
+ $expedition.css({position:"", top:""});
85
+ }
86
+ if (fixed_position && typeof attr != 'undefined' && attr != false) {
87
+ $expedition.css({position:"fixed", top:attr + "px"});
88
+ }
89
+ }
90
+ });
91
+ });
92
+
93
+
94
+ if (this.last_destination.length > 0) {
95
+ $(window).on('scroll.fndtn.magellan', function (e) {
96
+ var windowScrollTop = $(window).scrollTop(),
97
+ scrolltopPlusHeight = windowScrollTop + $(window).height(),
98
+ lastDestinationTop = Math.ceil(self.last_destination.offset().top);
99
+
100
+ $('[data-magellan-destination]').each(function () {
101
+ var $destination = $(this),
102
+ destination_name = $destination.attr('data-magellan-destination'),
103
+ topOffset = $destination.offset().top - windowScrollTop;
104
+
105
+ if (topOffset <= self.settings.threshold) {
106
+ $("[data-magellan-arrival='" + destination_name + "']").trigger('arrival');
107
+ }
108
+ // In large screens we may hit the bottom of the page and dont reach the top of the last magellan-destination, so lets force it
109
+ if (scrolltopPlusHeight >= $(self.scope).height() && lastDestinationTop > windowScrollTop && lastDestinationTop < scrolltopPlusHeight) {
110
+ $('[data-magellan-arrival]').last().trigger('arrival');
111
+ }
112
+ });
113
+ });
114
+ }
115
+
116
+ this.settings.init = true;
117
+ },
118
+
119
+ set_threshold : function () {
120
+ if (!this.settings.threshold) {
121
+ this.settings.threshold = (this.fixed_magellan.length > 0) ?
122
+ this.outerHeight(this.fixed_magellan, true) : 0;
123
+ }
124
+ },
125
+
126
+ off : function () {
127
+ $(this.scope).off('.fndtn.magellan');
128
+ }
129
+ };
130
+ }(Foundation.zj, this, this.document));