pushnote 0.0.4 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (59) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +3 -0
  3. data/.rspec +3 -0
  4. data/README.md +11 -30
  5. data/Rakefile +20 -0
  6. data/bin/pushnote +20 -2
  7. data/config.codekit +1005 -0
  8. data/config.ru +2 -0
  9. data/config/database.yml +17 -0
  10. data/db/migrate/20150131202537_create_notes_table.rb +9 -0
  11. data/db/schema.rb +23 -0
  12. data/lib/pushnote.rb +0 -3
  13. data/lib/pushnote/adapters.rb +1 -0
  14. data/lib/pushnote/adapters/base.rb +7 -0
  15. data/lib/pushnote/adapters/local.rb +17 -0
  16. data/lib/pushnote/app.rb +50 -0
  17. data/lib/pushnote/models/note.rb +4 -0
  18. data/lib/pushnote/public/css/foundation.css +6139 -0
  19. data/lib/pushnote/public/css/foundation.min.css +1 -0
  20. data/lib/pushnote/public/css/normalize.css +427 -0
  21. data/lib/pushnote/public/humans.txt +8 -0
  22. data/lib/pushnote/public/img/.gitkeep +1 -0
  23. data/lib/pushnote/public/index.html +166 -0
  24. data/lib/pushnote/public/js/foundation.min.js +5960 -0
  25. data/lib/pushnote/public/js/foundation/foundation.abide.js +318 -0
  26. data/lib/pushnote/public/js/foundation/foundation.accordion.js +67 -0
  27. data/lib/pushnote/public/js/foundation/foundation.alert.js +43 -0
  28. data/lib/pushnote/public/js/foundation/foundation.clearing.js +558 -0
  29. data/lib/pushnote/public/js/foundation/foundation.dropdown.js +439 -0
  30. data/lib/pushnote/public/js/foundation/foundation.equalizer.js +73 -0
  31. data/lib/pushnote/public/js/foundation/foundation.interchange.js +348 -0
  32. data/lib/pushnote/public/js/foundation/foundation.joyride.js +924 -0
  33. data/lib/pushnote/public/js/foundation/foundation.js +690 -0
  34. data/lib/pushnote/public/js/foundation/foundation.magellan.js +198 -0
  35. data/lib/pushnote/public/js/foundation/foundation.offcanvas.js +152 -0
  36. data/lib/pushnote/public/js/foundation/foundation.orbit.js +472 -0
  37. data/lib/pushnote/public/js/foundation/foundation.reveal.js +449 -0
  38. data/lib/pushnote/public/js/foundation/foundation.slider.js +267 -0
  39. data/lib/pushnote/public/js/foundation/foundation.tab.js +217 -0
  40. data/lib/pushnote/public/js/foundation/foundation.tooltip.js +300 -0
  41. data/lib/pushnote/public/js/foundation/foundation.topbar.js +445 -0
  42. data/lib/pushnote/public/js/vendor/fastclick.js +9 -0
  43. data/lib/pushnote/public/js/vendor/jquery.cookie.js +8 -0
  44. data/lib/pushnote/public/js/vendor/jquery.js +26 -0
  45. data/lib/pushnote/public/js/vendor/modernizr.js +8 -0
  46. data/lib/pushnote/public/js/vendor/placeholder.js +2 -0
  47. data/lib/pushnote/public/robots.txt +4 -0
  48. data/lib/pushnote/version.rb +1 -1
  49. data/lib/pushnote/views/index.erb +15 -0
  50. data/lib/pushnote/views/layout.erb +48 -0
  51. data/lib/pushnote/views/show.erb +8 -0
  52. data/pushnote.gemspec +15 -5
  53. data/spec/lib/controllers/notes_spec.rb +21 -0
  54. data/spec/spec_helper.rb +16 -0
  55. metadata +193 -9
  56. data/.pushnote.yml +0 -1
  57. data/lib/pushnote/cli.rb +0 -40
  58. data/lib/pushnote/configuration.rb +0 -12
  59. data/lib/pushnote/note.rb +0 -36
@@ -0,0 +1,439 @@
1
+ ;(function ($, window, document, undefined) {
2
+ 'use strict';
3
+
4
+ Foundation.libs.dropdown = {
5
+ name : 'dropdown',
6
+
7
+ version : '5.5.0',
8
+
9
+ settings : {
10
+ active_class: 'open',
11
+ disabled_class: 'disabled',
12
+ mega_class: 'mega',
13
+ align: 'bottom',
14
+ is_hover: false,
15
+ hover_timeout: 150,
16
+ opened: function(){},
17
+ closed: function(){}
18
+ },
19
+
20
+ init : function (scope, method, options) {
21
+ Foundation.inherit(this, 'throttle');
22
+
23
+ $.extend(true, this.settings, method, options);
24
+ this.bindings(method, options);
25
+ },
26
+
27
+ events : function (scope) {
28
+ var self = this,
29
+ S = self.S;
30
+
31
+ S(this.scope)
32
+ .off('.dropdown')
33
+ .on('click.fndtn.dropdown', '[' + this.attr_name() + ']', function (e) {
34
+ var settings = S(this).data(self.attr_name(true) + '-init') || self.settings;
35
+ if (!settings.is_hover || Modernizr.touch) {
36
+ e.preventDefault();
37
+ if (S(this).parent('[data-reveal-id]')) {
38
+ e.stopPropagation();
39
+ }
40
+ self.toggle($(this));
41
+ }
42
+ })
43
+ .on('mouseenter.fndtn.dropdown', '[' + this.attr_name() + '], [' + this.attr_name() + '-content]', function (e) {
44
+ var $this = S(this),
45
+ dropdown,
46
+ target;
47
+
48
+ clearTimeout(self.timeout);
49
+
50
+ if ($this.data(self.data_attr())) {
51
+ dropdown = S('#' + $this.data(self.data_attr()));
52
+ target = $this;
53
+ } else {
54
+ dropdown = $this;
55
+ target = S('[' + self.attr_name() + '="' + dropdown.attr('id') + '"]');
56
+ }
57
+
58
+ var settings = target.data(self.attr_name(true) + '-init') || self.settings;
59
+
60
+ if(S(e.currentTarget).data(self.data_attr()) && settings.is_hover) {
61
+ self.closeall.call(self);
62
+ }
63
+
64
+ if (settings.is_hover) self.open.apply(self, [dropdown, target]);
65
+ })
66
+ .on('mouseleave.fndtn.dropdown', '[' + this.attr_name() + '], [' + this.attr_name() + '-content]', function (e) {
67
+ var $this = S(this);
68
+ var settings;
69
+
70
+ if ($this.data(self.data_attr())) {
71
+ settings = $this.data(self.data_attr(true) + '-init') || self.settings;
72
+ }
73
+ else {
74
+ var target = S('[' + self.attr_name() + '="' + S(this).attr('id') + '"]'),
75
+ settings = target.data(self.attr_name(true) + '-init') || self.settings;
76
+ }
77
+
78
+ self.timeout = setTimeout(function () {
79
+ if ($this.data(self.data_attr())) {
80
+ if (settings.is_hover) self.close.call(self, S('#' + $this.data(self.data_attr())));
81
+ } else {
82
+ if (settings.is_hover) self.close.call(self, $this);
83
+ }
84
+ }.bind(this), settings.hover_timeout);
85
+ })
86
+ .on('click.fndtn.dropdown', function (e) {
87
+ var parent = S(e.target).closest('[' + self.attr_name() + '-content]');
88
+ var links = parent.find('a');
89
+
90
+ if (links.length > 0 && parent.attr('aria-autoclose') !== "false") {
91
+ self.close.call(self, S('[' + self.attr_name() + '-content]'));
92
+ }
93
+
94
+ if (S(e.target).closest('[' + self.attr_name() + ']').length > 0) {
95
+ return;
96
+ }
97
+
98
+ if (!(S(e.target).data('revealId')) &&
99
+ (parent.length > 0 && (S(e.target).is('[' + self.attr_name() + '-content]') ||
100
+ $.contains(parent.first()[0], e.target)))) {
101
+ e.stopPropagation();
102
+ return;
103
+ }
104
+
105
+ self.close.call(self, S('[' + self.attr_name() + '-content]'));
106
+ })
107
+ .on('opened.fndtn.dropdown', '[' + self.attr_name() + '-content]', function () {
108
+ self.settings.opened.call(this);
109
+ })
110
+ .on('closed.fndtn.dropdown', '[' + self.attr_name() + '-content]', function () {
111
+ self.settings.closed.call(this);
112
+ });
113
+
114
+ S(window)
115
+ .off('.dropdown')
116
+ .on('resize.fndtn.dropdown', self.throttle(function () {
117
+ self.resize.call(self);
118
+ }, 50));
119
+
120
+ this.resize();
121
+ },
122
+
123
+ close: function (dropdown) {
124
+ var self = this;
125
+ dropdown.each(function () {
126
+ var original_target = $('[' + self.attr_name() + '=' + dropdown[0].id + ']') || $('aria-controls=' + dropdown[0].id+ ']');
127
+ original_target.attr('aria-expanded', 'false');
128
+ if (self.S(this).hasClass(self.settings.active_class)) {
129
+ self.S(this)
130
+ .css(Foundation.rtl ? 'right':'left', '-99999px')
131
+ .attr('aria-hidden', 'true')
132
+ .removeClass(self.settings.active_class)
133
+ .prev('[' + self.attr_name() + ']')
134
+ .removeClass(self.settings.active_class)
135
+ .removeData('target');
136
+
137
+ self.S(this).trigger('closed').trigger('closed.fndtn.dropdown', [dropdown]);
138
+ }
139
+ });
140
+ dropdown.removeClass('f-open-' + this.attr_name(true));
141
+ },
142
+
143
+ closeall: function() {
144
+ var self = this;
145
+ $.each(self.S('.f-open-' + this.attr_name(true)), function() {
146
+ self.close.call(self, self.S(this));
147
+ });
148
+ },
149
+
150
+ open: function (dropdown, target) {
151
+ this
152
+ .css(dropdown
153
+ .addClass(this.settings.active_class), target);
154
+ dropdown.prev('[' + this.attr_name() + ']').addClass(this.settings.active_class);
155
+ dropdown.data('target', target.get(0)).trigger('opened').trigger('opened.fndtn.dropdown', [dropdown, target]);
156
+ dropdown.attr('aria-hidden', 'false');
157
+ target.attr('aria-expanded', 'true');
158
+ dropdown.focus();
159
+ dropdown.addClass('f-open-' + this.attr_name(true));
160
+ },
161
+
162
+ data_attr: function () {
163
+ if (this.namespace.length > 0) {
164
+ return this.namespace + '-' + this.name;
165
+ }
166
+
167
+ return this.name;
168
+ },
169
+
170
+ toggle : function (target) {
171
+ if (target.hasClass(this.settings.disabled_class)) {
172
+ return;
173
+ }
174
+ var dropdown = this.S('#' + target.data(this.data_attr()));
175
+ if (dropdown.length === 0) {
176
+ // No dropdown found, not continuing
177
+ return;
178
+ }
179
+
180
+ this.close.call(this, this.S('[' + this.attr_name() + '-content]').not(dropdown));
181
+
182
+ if (dropdown.hasClass(this.settings.active_class)) {
183
+ this.close.call(this, dropdown);
184
+ if (dropdown.data('target') !== target.get(0))
185
+ this.open.call(this, dropdown, target);
186
+ } else {
187
+ this.open.call(this, dropdown, target);
188
+ }
189
+ },
190
+
191
+ resize : function () {
192
+ var dropdown = this.S('[' + this.attr_name() + '-content].open'),
193
+ target = this.S('[' + this.attr_name() + '="' + dropdown.attr('id') + '"]');
194
+
195
+ if (dropdown.length && target.length) {
196
+ this.css(dropdown, target);
197
+ }
198
+ },
199
+
200
+ css : function (dropdown, target) {
201
+ var left_offset = Math.max((target.width() - dropdown.width()) / 2, 8),
202
+ settings = target.data(this.attr_name(true) + '-init') || this.settings;
203
+
204
+ this.clear_idx();
205
+
206
+ if (this.small()) {
207
+ var p = this.dirs.bottom.call(dropdown, target, settings);
208
+
209
+ dropdown.attr('style', '').removeClass('drop-left drop-right drop-top').css({
210
+ position : 'absolute',
211
+ width: '95%',
212
+ 'max-width': 'none',
213
+ top: p.top
214
+ });
215
+
216
+ dropdown.css(Foundation.rtl ? 'right':'left', left_offset);
217
+ } else {
218
+
219
+ this.style(dropdown, target, settings);
220
+ }
221
+
222
+ return dropdown;
223
+ },
224
+
225
+ style : function (dropdown, target, settings) {
226
+ var css = $.extend({position: 'absolute'},
227
+ this.dirs[settings.align].call(dropdown, target, settings));
228
+
229
+ dropdown.attr('style', '').css(css);
230
+ },
231
+
232
+ // return CSS property object
233
+ // `this` is the dropdown
234
+ dirs : {
235
+ // Calculate target offset
236
+ _base : function (t) {
237
+ var o_p = this.offsetParent(),
238
+ o = o_p.offset(),
239
+ p = t.offset();
240
+
241
+ p.top -= o.top;
242
+ p.left -= o.left;
243
+
244
+ //set some flags on the p object to pass along
245
+ p.missRight = false;
246
+ p.missTop = false;
247
+ p.missLeft = false;
248
+ p.leftRightFlag = false;
249
+
250
+ //lets see if the panel will be off the screen
251
+ //get the actual width of the page and store it
252
+ var actualBodyWidth;
253
+ if (document.getElementsByClassName('row')[0]) {
254
+ actualBodyWidth = document.getElementsByClassName('row')[0].clientWidth;
255
+ } else {
256
+ actualBodyWidth = window.outerWidth;
257
+ }
258
+
259
+ var actualMarginWidth = (window.outerWidth - actualBodyWidth) / 2;
260
+ var actualBoundary = actualBodyWidth;
261
+
262
+ if (!this.hasClass('mega')) {
263
+ //miss top
264
+ if (t.offset().top <= this.outerHeight()) {
265
+ p.missTop = true;
266
+ actualBoundary = window.outerWidth - actualMarginWidth;
267
+ p.leftRightFlag = true;
268
+ }
269
+
270
+ //miss right
271
+ if (t.offset().left + this.outerWidth() > t.offset().left + actualMarginWidth && t.offset().left - actualMarginWidth > this.outerWidth()) {
272
+ p.missRight = true;
273
+ p.missLeft = false;
274
+ }
275
+
276
+ //miss left
277
+ if (t.offset().left - this.outerWidth() <= 0) {
278
+ p.missLeft = true;
279
+ p.missRight = false;
280
+ }
281
+ }
282
+
283
+ return p;
284
+ },
285
+
286
+ top: function (t, s) {
287
+ var self = Foundation.libs.dropdown,
288
+ p = self.dirs._base.call(this, t);
289
+
290
+ this.addClass('drop-top');
291
+
292
+ if (p.missTop == true) {
293
+ p.top = p.top + t.outerHeight() + this.outerHeight();
294
+ this.removeClass('drop-top');
295
+ }
296
+
297
+ if (p.missRight == true) {
298
+ p.left = p.left - this.outerWidth() + t.outerWidth();
299
+ }
300
+
301
+ if (t.outerWidth() < this.outerWidth() || self.small() || this.hasClass(s.mega_menu)) {
302
+ self.adjust_pip(this,t,s,p);
303
+ }
304
+
305
+ if (Foundation.rtl) {
306
+ return {left: p.left - this.outerWidth() + t.outerWidth(),
307
+ top: p.top - this.outerHeight()};
308
+ }
309
+
310
+ return {left: p.left, top: p.top - this.outerHeight()};
311
+ },
312
+
313
+ bottom: function (t,s) {
314
+ var self = Foundation.libs.dropdown,
315
+ p = self.dirs._base.call(this, t);
316
+
317
+ if (p.missRight == true) {
318
+ p.left = p.left - this.outerWidth() + t.outerWidth();
319
+ }
320
+
321
+ if (t.outerWidth() < this.outerWidth() || self.small() || this.hasClass(s.mega_menu)) {
322
+ self.adjust_pip(this,t,s,p);
323
+ }
324
+
325
+ if (self.rtl) {
326
+ return {left: p.left - this.outerWidth() + t.outerWidth(), top: p.top + t.outerHeight()};
327
+ }
328
+
329
+ return {left: p.left, top: p.top + t.outerHeight()};
330
+ },
331
+
332
+ left: function (t, s) {
333
+ var p = Foundation.libs.dropdown.dirs._base.call(this, t);
334
+
335
+ this.addClass('drop-left');
336
+
337
+ if (p.missLeft == true) {
338
+ p.left = p.left + this.outerWidth();
339
+ p.top = p.top + t.outerHeight();
340
+ this.removeClass('drop-left');
341
+ }
342
+
343
+ return {left: p.left - this.outerWidth(), top: p.top};
344
+ },
345
+
346
+ right: function (t, s) {
347
+ var p = Foundation.libs.dropdown.dirs._base.call(this, t);
348
+
349
+ this.addClass('drop-right');
350
+
351
+ if (p.missRight == true) {
352
+ p.left = p.left - this.outerWidth();
353
+ p.top = p.top + t.outerHeight();
354
+ this.removeClass('drop-right');
355
+ } else {
356
+ p.triggeredRight = true;
357
+ }
358
+
359
+ var self = Foundation.libs.dropdown;
360
+
361
+ if (t.outerWidth() < this.outerWidth() || self.small() || this.hasClass(s.mega_menu)) {
362
+ self.adjust_pip(this,t,s,p);
363
+ }
364
+
365
+ return {left: p.left + t.outerWidth(), top: p.top};
366
+ }
367
+ },
368
+
369
+ // Insert rule to style psuedo elements
370
+ adjust_pip : function (dropdown,target,settings,position) {
371
+ var sheet = Foundation.stylesheet,
372
+ pip_offset_base = 8;
373
+
374
+ if (dropdown.hasClass(settings.mega_class)) {
375
+ pip_offset_base = position.left + (target.outerWidth()/2) - 8;
376
+ }
377
+ else if (this.small()) {
378
+ pip_offset_base += position.left - 8;
379
+ }
380
+
381
+ this.rule_idx = sheet.cssRules.length;
382
+
383
+ //default
384
+ var sel_before = '.f-dropdown.open:before',
385
+ sel_after = '.f-dropdown.open:after',
386
+ css_before = 'left: ' + pip_offset_base + 'px;',
387
+ css_after = 'left: ' + (pip_offset_base - 1) + 'px;';
388
+
389
+ if (position.missRight == true) {
390
+ pip_offset_base = dropdown.outerWidth() - 23;
391
+ sel_before = '.f-dropdown.open:before',
392
+ sel_after = '.f-dropdown.open:after',
393
+ css_before = 'left: ' + pip_offset_base + 'px;',
394
+ css_after = 'left: ' + (pip_offset_base - 1) + 'px;';
395
+ }
396
+
397
+ //just a case where right is fired, but its not missing right
398
+ if (position.triggeredRight == true) {
399
+ sel_before = '.f-dropdown.open:before',
400
+ sel_after = '.f-dropdown.open:after',
401
+ css_before = 'left:-12px;',
402
+ css_after = 'left:-14px;';
403
+ }
404
+
405
+ if (sheet.insertRule) {
406
+ sheet.insertRule([sel_before, '{', css_before, '}'].join(' '), this.rule_idx);
407
+ sheet.insertRule([sel_after, '{', css_after, '}'].join(' '), this.rule_idx + 1);
408
+ } else {
409
+ sheet.addRule(sel_before, css_before, this.rule_idx);
410
+ sheet.addRule(sel_after, css_after, this.rule_idx + 1);
411
+ }
412
+ },
413
+
414
+ // Remove old dropdown rule index
415
+ clear_idx : function () {
416
+ var sheet = Foundation.stylesheet;
417
+
418
+ if (typeof this.rule_idx !== 'undefined') {
419
+ sheet.deleteRule(this.rule_idx);
420
+ sheet.deleteRule(this.rule_idx);
421
+ delete this.rule_idx;
422
+ }
423
+ },
424
+
425
+ small : function () {
426
+ return matchMedia(Foundation.media_queries.small).matches &&
427
+ !matchMedia(Foundation.media_queries.medium).matches;
428
+ },
429
+
430
+ off: function () {
431
+ this.S(this.scope).off('.fndtn.dropdown');
432
+ this.S('html, body').off('.fndtn.dropdown');
433
+ this.S(window).off('.fndtn.dropdown');
434
+ this.S('[data-dropdown-content]').off('.fndtn.dropdown');
435
+ },
436
+
437
+ reflow : function () {}
438
+ };
439
+ }(jQuery, window, window.document));
@@ -0,0 +1,73 @@
1
+ ;(function ($, window, document, undefined) {
2
+ 'use strict';
3
+
4
+ Foundation.libs.equalizer = {
5
+ name : 'equalizer',
6
+
7
+ version : '5.5.0',
8
+
9
+ settings : {
10
+ use_tallest: true,
11
+ before_height_change: $.noop,
12
+ after_height_change: $.noop,
13
+ equalize_on_stack: false
14
+ },
15
+
16
+ init : function (scope, method, options) {
17
+ Foundation.inherit(this, 'image_loaded');
18
+ this.bindings(method, options);
19
+ this.reflow();
20
+ },
21
+
22
+ events : function () {
23
+ this.S(window).off('.equalizer').on('resize.fndtn.equalizer', function(e){
24
+ this.reflow();
25
+ }.bind(this));
26
+ },
27
+
28
+ equalize: function(equalizer) {
29
+ var isStacked = false,
30
+ vals = equalizer.find('[' + this.attr_name() + '-watch]:visible'),
31
+ settings = equalizer.data(this.attr_name(true)+'-init');
32
+
33
+ if (vals.length === 0) return;
34
+ var firstTopOffset = vals.first().offset().top;
35
+ settings.before_height_change();
36
+ equalizer.trigger('before-height-change').trigger('before-height-change.fndth.equalizer');
37
+ vals.height('inherit');
38
+ vals.each(function(){
39
+ var el = $(this);
40
+ if (el.offset().top !== firstTopOffset) {
41
+ isStacked = true;
42
+ }
43
+ });
44
+
45
+ if (settings.equalize_on_stack === false) {
46
+ if (isStacked) return;
47
+ };
48
+
49
+ var heights = vals.map(function(){ return $(this).outerHeight(false) }).get();
50
+
51
+ if (settings.use_tallest) {
52
+ var max = Math.max.apply(null, heights);
53
+ vals.css('height', max);
54
+ } else {
55
+ var min = Math.min.apply(null, heights);
56
+ vals.css('height', min);
57
+ }
58
+ settings.after_height_change();
59
+ equalizer.trigger('after-height-change').trigger('after-height-change.fndtn.equalizer');
60
+ },
61
+
62
+ reflow : function () {
63
+ var self = this;
64
+
65
+ this.S('[' + this.attr_name() + ']', this.scope).each(function(){
66
+ var $eq_target = $(this);
67
+ self.image_loaded(self.S('img', this), function(){
68
+ self.equalize($eq_target)
69
+ });
70
+ });
71
+ }
72
+ };
73
+ })(jQuery, window, window.document);