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,195 @@
1
+ /*jslint unparam: true, browser: true, indent: 2 */
2
+
3
+ ;(function ($, window, document, undefined) {
4
+ 'use strict';
5
+
6
+ Foundation.libs.tooltips = {
7
+ name: 'tooltips',
8
+
9
+ version : '4.0.2',
10
+
11
+ settings : {
12
+ selector : '.has-tip',
13
+ additionalInheritableClasses : [],
14
+ tooltipClass : '.tooltip',
15
+ tipTemplate : function (selector, content) {
16
+ return '<span data-selector="' + selector + '" class="'
17
+ + Foundation.libs.tooltips.settings.tooltipClass.substring(1)
18
+ + '">' + content + '<span class="nub"></span></span>';
19
+ }
20
+ },
21
+
22
+ cache : {},
23
+
24
+ init : function (scope, method, options) {
25
+ var self = this;
26
+ this.scope = scope || this.scope;
27
+
28
+ if (typeof method === 'object') {
29
+ $.extend(true, this.settings, method);
30
+ }
31
+
32
+ if (typeof method != 'string') {
33
+ if (Modernizr.touch) {
34
+ $(this.scope)
35
+ .on('click.fndtn.tooltip touchstart.fndtn.tooltip touchend.fndtn.tooltip',
36
+ '[data-tooltip]', function (e) {
37
+ e.preventDefault();
38
+ $(self.settings.tooltipClass).hide();
39
+ self.showOrCreateTip($(this));
40
+ })
41
+ .on('click.fndtn.tooltip touchstart.fndtn.tooltip touchend.fndtn.tooltip',
42
+ this.settings.tooltipClass, function (e) {
43
+ e.preventDefault();
44
+ $(this).fadeOut(150);
45
+ });
46
+ } else {
47
+ $(this.scope)
48
+ .on('mouseenter.fndtn.tooltip mouseleave.fndtn.tooltip',
49
+ '[data-tooltip]', function (e) {
50
+ var $this = $(this);
51
+
52
+ if (e.type === 'mouseover' || e.type === 'mouseenter') {
53
+ self.showOrCreateTip($this);
54
+ } else if (e.type === 'mouseout' || e.type === 'mouseleave') {
55
+ self.hide($this);
56
+ }
57
+ });
58
+ }
59
+
60
+ // $(this.scope).data('fndtn-tooltips', true);
61
+ } else {
62
+ return this[method].call(this, options);
63
+ }
64
+
65
+ },
66
+
67
+ showOrCreateTip : function ($target) {
68
+ var $tip = this.getTip($target);
69
+
70
+ if ($tip && $tip.length > 0) {
71
+ return this.show($target);
72
+ }
73
+
74
+ return this.create($target);
75
+ },
76
+
77
+ getTip : function ($target) {
78
+ var selector = this.selector($target),
79
+ tip = null;
80
+
81
+ if (selector) {
82
+ tip = $('span[data-selector=' + selector + ']' + this.settings.tooltipClass);
83
+ }
84
+
85
+ return (typeof tip === 'object') ? tip : false;
86
+ },
87
+
88
+ selector : function ($target) {
89
+ var id = $target.attr('id'),
90
+ dataSelector = $target.attr('data-tooltip') || $target.attr('data-selector');
91
+
92
+ if ((id && id.length < 1 || !id) && typeof dataSelector != 'string') {
93
+ dataSelector = 'tooltip' + Math.random().toString(36).substring(7);
94
+ $target.attr('data-selector', dataSelector);
95
+ }
96
+
97
+ return (id && id.length > 0) ? id : dataSelector;
98
+ },
99
+
100
+ create : function ($target) {
101
+ var $tip = $(this.settings.tipTemplate(this.selector($target), $('<div>').html($target.attr('title')).html())),
102
+ classes = this.inheritable_classes($target);
103
+
104
+ $tip.addClass(classes).appendTo('body');
105
+ if (Modernizr.touch) {
106
+ $tip.append('<span class="tap-to-close">tap to close </span>');
107
+ }
108
+ $target.removeAttr('title').attr('title','');
109
+ this.show($target);
110
+ },
111
+
112
+ reposition : function (target, tip, classes) {
113
+ var width, nub, nubHeight, nubWidth, column, objPos;
114
+
115
+ tip.css('visibility', 'hidden').show();
116
+
117
+ width = target.data('width');
118
+ nub = tip.children('.nub');
119
+ nubHeight = this.outerHeight(nub);
120
+ nubWidth = this.outerHeight(nub);
121
+
122
+ objPos = function (obj, top, right, bottom, left, width) {
123
+ return obj.css({
124
+ 'top' : (top) ? top : 'auto',
125
+ 'bottom' : (bottom) ? bottom : 'auto',
126
+ 'left' : (left) ? left : 'auto',
127
+ 'right' : (right) ? right : 'auto',
128
+ 'width' : (width) ? width : 'auto'
129
+ }).end();
130
+ };
131
+
132
+ objPos(tip, (target.offset().top + this.outerHeight(target) + 10), 'auto', 'auto', target.offset().left, width);
133
+
134
+ if ($(window).width() < 767) {
135
+ objPos(tip, (target.offset().top + this.outerHeight(target) + 10), 'auto', 'auto', 12.5, $(this.scope).width());
136
+ tip.addClass('tip-override');
137
+ objPos(nub, -nubHeight, 'auto', 'auto', target.offset().left);
138
+ } else {
139
+ objPos(tip, (target.offset().top + this.outerHeight(target) + 10), 'auto', 'auto', target.offset().left, width);
140
+ tip.removeClass('tip-override');
141
+ if (classes && classes.indexOf('tip-top') > -1) {
142
+ objPos(tip, (target.offset().top - this.outerHeight(tip)), 'auto', 'auto', target.offset().left, width)
143
+ .removeClass('tip-override');
144
+ } else if (classes && classes.indexOf('tip-left') > -1) {
145
+ objPos(tip, (target.offset().top + (this.outerHeight(target) / 2) - nubHeight*2.5), 'auto', 'auto', (target.offset().left - this.outerWidth(tip) - nubHeight), width)
146
+ .removeClass('tip-override');
147
+ } else if (classes && classes.indexOf('tip-right') > -1) {
148
+ objPos(tip, (target.offset().top + (this.outerHeight(target) / 2) - nubHeight*2.5), 'auto', 'auto', (target.offset().left + this.outerWidth(target) + nubHeight), width)
149
+ .removeClass('tip-override');
150
+ }
151
+ }
152
+
153
+ tip.css('visibility', 'visible').hide();
154
+ },
155
+
156
+ inheritable_classes : function (target) {
157
+ var inheritables = ['tip-top', 'tip-left', 'tip-bottom', 'tip-right', 'noradius'].concat(this.settings.additionalInheritableClasses),
158
+ classes = target.attr('class'),
159
+ filtered = classes ? $.map(classes.split(' '), function (el, i) {
160
+ if ($.inArray(el, inheritables) !== -1) {
161
+ return el;
162
+ }
163
+ }).join(' ') : '';
164
+
165
+ return $.trim(filtered);
166
+ },
167
+
168
+ show : function ($target) {
169
+ var $tip = this.getTip($target);
170
+
171
+ this.reposition($target, $tip, $target.attr('class'));
172
+ $tip.fadeIn(150);
173
+ },
174
+
175
+ hide : function ($target) {
176
+ var $tip = this.getTip($target);
177
+
178
+ $tip.fadeOut(150);
179
+ },
180
+
181
+ // deprecate reload
182
+ reload : function () {
183
+ var $self = $(this);
184
+
185
+ return ($self.data('fndtn-tooltips')) ? $self.foundationTooltips('destroy').foundationTooltips('init') : $self.foundationTooltips('init');
186
+ },
187
+
188
+ off : function () {
189
+ $(this.scope).off('.fndtn.tooltip');
190
+ $(this.settings.tooltipClass).each(function (i) {
191
+ $('[data-tooltip]').get(i).attr('title', $(this).text());
192
+ }).remove();
193
+ }
194
+ };
195
+ }(Foundation.zj, this, this.document));
@@ -0,0 +1,208 @@
1
+ /*jslint unparam: true, browser: true, indent: 2 */
2
+
3
+ ;(function ($, window, document, undefined) {
4
+ 'use strict';
5
+
6
+ Foundation.libs.topbar = {
7
+ name : 'topbar',
8
+
9
+ version : '4.0.0',
10
+
11
+ settings : {
12
+ index : 0,
13
+ stickyClass : 'sticky',
14
+ back_text: '&laquo; Back',
15
+ init : false
16
+ },
17
+
18
+ init : function (scope, method, options) {
19
+ var self = this;
20
+ this.scope = scope || this.scope;
21
+
22
+ if (typeof method === 'object') {
23
+ $.extend(true, this.settings, method);
24
+ }
25
+
26
+ if (typeof method != 'string') {
27
+
28
+ $('nav.top-bar').each(function () {
29
+ self.settings.$w = $(window);
30
+ self.settings.$topbar = $(this);
31
+ self.settings.$section = self.settings.$topbar.find('section');
32
+ self.settings.$titlebar = self.settings.$topbar.children('ul').first();
33
+
34
+
35
+ self.settings.$topbar.data('index', 0);
36
+
37
+ var breakpoint = $("<div class='top-bar-js-breakpoint'/>").insertAfter(self.settings.$topbar);
38
+ self.settings.breakPoint = breakpoint.width();
39
+ breakpoint.remove();
40
+
41
+ self.assemble();
42
+
43
+ if (self.settings.$topbar.parent().hasClass('fixed')) {
44
+ $('body').css('padding-top', self.outerHeight(self.settings.$topbar));
45
+ }
46
+ });
47
+
48
+ if (!self.settings.init) {
49
+ this.events();
50
+ }
51
+
52
+ return this.settings.init;
53
+ } else {
54
+ // fire method
55
+ return this[method].call(this, options);
56
+ }
57
+ },
58
+
59
+ events : function () {
60
+ var self = this;
61
+
62
+ $(this.scope)
63
+ .on('click.fndtn.topbar', '.top-bar .toggle-topbar', function (e) {
64
+ var topbar = $(this).closest('.top-bar'),
65
+ section = topbar.find('section, .section'),
66
+ titlebar = topbar.children('ul').first();
67
+
68
+ if (!self.settings.$topbar.data('height')) self.largestUL();
69
+
70
+ e.preventDefault();
71
+
72
+ if (self.breakpoint()) {
73
+ topbar
74
+ .toggleClass('expanded')
75
+ .css('min-height', '');
76
+ }
77
+
78
+ if (!topbar.hasClass('expanded')) {
79
+ section.css({left: '0%'});
80
+ section.find('>.name').css({left: '100%'});
81
+ section.find('li.moved').removeClass('moved');
82
+ topbar.data('index', 0);
83
+ }
84
+ })
85
+
86
+ .on('click.fndtn.topbar', '.top-bar .has-dropdown>a', function (e) {
87
+ var topbar = $(this).closest('.top-bar'),
88
+ section = topbar.find('section, .section'),
89
+ titlebar = topbar.children('ul').first();
90
+
91
+ if (Modernizr.touch || self.breakpoint()) {
92
+ e.preventDefault();
93
+ }
94
+
95
+ if (self.breakpoint()) {
96
+ var $this = $(this),
97
+ $selectedLi = $this.closest('li');
98
+
99
+ topbar.data('index', topbar.data('index') + 1);
100
+ $selectedLi.addClass('moved');
101
+ section.css({left: -(100 * topbar.data('index')) + '%'});
102
+ section.find('>.name').css({left: 100 * topbar.data('index') + '%'});
103
+
104
+ $this.siblings('ul')
105
+ .height(topbar.data('height') + self.outerHeight(titlebar, true));
106
+ topbar
107
+ .css('min-height', topbar.data('height') + self.outerHeight(titlebar, true) * 2)
108
+ }
109
+ });
110
+
111
+ $(window).on('resize.fndtn.topbar', function () {
112
+ if (!this.breakpoint()) {
113
+ $('.top-bar').css('min-height', '');
114
+ }
115
+ }.bind(this));
116
+
117
+ // Go up a level on Click
118
+ $(this.scope).on('click.fndtn', '.top-bar .has-dropdown .back', function (e) {
119
+ e.preventDefault();
120
+
121
+ var $this = $(this),
122
+ topbar = $this.closest('.top-bar'),
123
+ section = topbar.find('section, .section'),
124
+ $movedLi = $this.closest('li.moved'),
125
+ $previousLevelUl = $movedLi.parent();
126
+
127
+ topbar.data('index', topbar.data('index') - 1);
128
+ section.css({left: -(100 * topbar.data('index')) + '%'});
129
+ section.find('>.name').css({'left': 100 * topbar.data('index') + '%'});
130
+
131
+ if (topbar.data('index') === 0) {
132
+ topbar.css('min-height', 0);
133
+ }
134
+
135
+ setTimeout(function () {
136
+ $movedLi.removeClass('moved');
137
+ }, 300);
138
+ });
139
+ },
140
+
141
+ breakpoint : function () {
142
+ return $(window).width() <= this.settings.breakPoint || $('html').hasClass('lt-ie9');
143
+ },
144
+
145
+ assemble : function () {
146
+ var self = this;
147
+ // Pull element out of the DOM for manipulation
148
+ this.settings.$section.detach();
149
+
150
+ this.settings.$section.find('.has-dropdown>a').each(function () {
151
+ var $link = $(this),
152
+ $dropdown = $link.siblings('.dropdown'),
153
+ $titleLi = $('<li class="title back js-generated"><h5><a href="#">' + self.settings.back_text + '</a></h5></li>');
154
+ // Copy link to subnav
155
+ $dropdown.prepend($titleLi);
156
+ });
157
+
158
+ // Put element back in the DOM
159
+ this.settings.$section.appendTo(this.settings.$topbar);
160
+
161
+ // check for sticky
162
+ this.sticky();
163
+ },
164
+
165
+ largestUL : function () {
166
+ var uls = this.settings.$topbar.find('section ul ul'),
167
+ largest = uls.first(),
168
+ total = 0,
169
+ self = this;
170
+
171
+ uls.each(function () {
172
+ if ($(this).children('li').length > largest.children('li').length) {
173
+ largest = $(this);
174
+ }
175
+ });
176
+
177
+ largest.children('li').each(function () { total += self.outerHeight($(this), true); });
178
+
179
+ this.settings.$topbar.data('height', total);
180
+ },
181
+
182
+ sticky : function () {
183
+ var klass = '.' + this.settings.stickyClass;
184
+ if ($(klass).length > 0) {
185
+ var distance = $(klass).length ? $(klass).offset().top: 0,
186
+ $window = $(window);
187
+ var offst = this.outerHeight($('nav.top-bar'))+20;
188
+
189
+ $window.scroll(function() {
190
+ if ($window.scrollTop() >= (distance)) {
191
+ $(klass).addClass("fixed");
192
+ $('body').css('padding-top',offst);
193
+ }
194
+
195
+ else if ($window.scrollTop() < distance) {
196
+ $(klass).removeClass("fixed");
197
+ $('body').css('padding-top','0');
198
+ }
199
+ });
200
+ }
201
+ },
202
+
203
+ off : function () {
204
+ $(this.scope).off('.fndtn.topbar');
205
+ $(window).off('.fndtn.topbar');
206
+ }
207
+ };
208
+ }(Foundation.zj, this, this.document));
@@ -0,0 +1,48 @@
1
+ window.Helios = {
2
+ Version: "0.0.1"
3
+
4
+ Models: {}
5
+ Collections: {}
6
+ Views: {}
7
+ Routers: {}
8
+
9
+ initialize: ->
10
+ console.log("initialize")
11
+
12
+ @entities = Helios.entities
13
+
14
+
15
+ window.app = new Helios.Routers.Root
16
+ for entity in @entities.models
17
+ do (entity) ->
18
+ name = entity.get('name').toLowerCase()
19
+ window.app[name] = ->
20
+ @views.entity = new Helios.Views.Entity({model: entity})
21
+ window.app.route entity.url(), name
22
+
23
+ window.app.views.entities = new Helios.Views.Entities({collection: @entities})
24
+ window.app.views.entities.render()
25
+
26
+ Backbone.history.start({
27
+ root: window.location.pathname,
28
+ pushState: false,
29
+ hashChange: true
30
+ })
31
+ }
32
+
33
+ $ ->
34
+ # $('a').on('click', (event) ->
35
+ # console.log("click!", $(this).attr('href'))
36
+ # href = $(this).attr('href')
37
+ # event.preventDefault()
38
+ # window.app.navigate(href, {trigger: true})
39
+ # )
40
+ $('body').delegate 'a[href^=#]', 'click', (event) ->
41
+ event.preventDefault()
42
+ href = $(this).attr('href')
43
+ # window.app[window.app.routes[href]]()
44
+ console.log(href)
45
+ window.app.navigate(href, {trigger: true, replace: true})
46
+
47
+ Helios.entities = new Helios.Collections.Entities
48
+ Helios.entities.fetch(type: 'OPTIONS', success: Helios.initialize)