pbw 0.0.9 → 0.0.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (80) hide show
  1. checksums.yaml +8 -8
  2. data/app/controllers/pbw/application_controller.rb +3 -16
  3. data/app/controllers/pbw/base_models_controller.rb +10 -32
  4. data/app/controllers/pbw/passwords_controller.rb +14 -0
  5. data/app/controllers/pbw/registrations_controller.rb +9 -6
  6. data/app/controllers/pbw/sessions_controller.rb +9 -4
  7. data/app/mailers/pbw/user_mailer.rb +16 -0
  8. data/app/models/pbw/area.rb +5 -5
  9. data/app/models/pbw/attached_process.rb +3 -3
  10. data/app/models/pbw/capability.rb +1 -1
  11. data/app/models/pbw/command.rb +2 -2
  12. data/app/models/pbw/constraint.rb +2 -2
  13. data/app/models/pbw/item.rb +2 -2
  14. data/app/models/pbw/item_container.rb +4 -4
  15. data/app/models/pbw/item_conversion.rb +1 -1
  16. data/app/models/pbw/process.rb +2 -2
  17. data/app/models/pbw/token.rb +7 -7
  18. data/app/models/pbw/trigger.rb +3 -3
  19. data/app/models/pbw/user.rb +30 -8
  20. data/config/initializers/devise.rb +1 -66
  21. data/config/locales/pbw.en.yml +7 -0
  22. data/config/routes.rb +2 -4
  23. data/lib/generators/pbw/install/install_generator.rb +22 -3
  24. data/lib/generators/pbw/model_generator.rb +6 -0
  25. data/lib/generators/pbw/resource_helpers.rb +16 -0
  26. data/lib/generators/pbw/rules/capability/capability_generator.rb +4 -2
  27. data/lib/generators/pbw/rules/constraint/constraint_generator.rb +4 -2
  28. data/lib/generators/pbw/rules/process/process_generator.rb +4 -2
  29. data/lib/generators/pbw/rules/trigger/trigger_generator.rb +4 -2
  30. data/lib/generators/pbw/scaffold_generator.rb +0 -12
  31. data/lib/generators/pbw/templates/app.coffee +5 -3
  32. data/lib/generators/pbw/templates/application.erb +24 -0
  33. data/lib/generators/pbw/templates/lifecycle.rb +1 -0
  34. data/lib/generators/pbw/templates/pbw.coffee +21 -0
  35. data/lib/generators/pbw/templates/router.coffee +15 -0
  36. data/lib/generators/pbw/templates/templates/home.jst +10 -1
  37. data/lib/generators/pbw/templates/templates/login.jst +25 -0
  38. data/lib/generators/pbw/templates/templates/recover_password.jst +17 -0
  39. data/lib/generators/pbw/templates/templates/signup.jst +29 -0
  40. data/lib/generators/pbw/templates/user_recovery.coffee +6 -0
  41. data/lib/generators/pbw/templates/user_registration.coffee +9 -0
  42. data/lib/generators/pbw/templates/user_session.coffee +8 -0
  43. data/lib/generators/pbw/templates/views/edit_view.coffee +15 -8
  44. data/lib/generators/pbw/templates/views/login_view.coffee +39 -0
  45. data/lib/generators/pbw/templates/views/new_view.coffee +5 -9
  46. data/lib/generators/pbw/templates/views/recovery_view.coffee +38 -0
  47. data/lib/generators/pbw/templates/views/signup_view.coffee +39 -0
  48. data/lib/pbw/engine.rb +5 -9
  49. data/lib/pbw/version.rb +1 -1
  50. data/lib/pbw.rb +15 -2
  51. data/vendor/assets/javascripts/backbone_datalink.js +21 -0
  52. metadata +16 -44
  53. data/app/controllers/pbw/capabilities_controller.rb +0 -7
  54. data/app/controllers/pbw/constraints_controller.rb +0 -7
  55. data/app/controllers/pbw/processes_controller.rb +0 -7
  56. data/app/controllers/pbw/triggers_controller.rb +0 -7
  57. data/public/Foundation-MIT-LICENSE.txt +0 -20
  58. data/public/config.rb +0 -26
  59. data/public/javascripts/foundation/foundation.alerts.js +0 -52
  60. data/public/javascripts/foundation/foundation.clearing.js +0 -516
  61. data/public/javascripts/foundation/foundation.cookie.js +0 -74
  62. data/public/javascripts/foundation/foundation.dropdown.js +0 -178
  63. data/public/javascripts/foundation/foundation.forms.js +0 -525
  64. data/public/javascripts/foundation/foundation.interchange.js +0 -271
  65. data/public/javascripts/foundation/foundation.joyride.js +0 -844
  66. data/public/javascripts/foundation/foundation.js +0 -447
  67. data/public/javascripts/foundation/foundation.magellan.js +0 -134
  68. data/public/javascripts/foundation/foundation.orbit.js +0 -390
  69. data/public/javascripts/foundation/foundation.placeholder.js +0 -179
  70. data/public/javascripts/foundation/foundation.reveal.js +0 -330
  71. data/public/javascripts/foundation/foundation.section.js +0 -422
  72. data/public/javascripts/foundation/foundation.tooltips.js +0 -208
  73. data/public/javascripts/foundation/foundation.topbar.js +0 -303
  74. data/public/javascripts/vendor/custom.modernizr.js +0 -4
  75. data/public/javascripts/vendor/jquery.js +0 -9807
  76. data/public/javascripts/vendor/zepto.js +0 -2000
  77. data/public/sass/_normalize.scss +0 -402
  78. data/public/sass/_settings.scss +0 -1271
  79. data/public/sass/app.scss +0 -48
  80. data/public/stylesheets/app.css +0 -6686
@@ -1,447 +0,0 @@
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
- // Accommodate running jQuery or Zepto in noConflict() mode by
12
- // using an anonymous function to redefine the $ shorthand name.
13
- // See http://docs.jquery.com/Using_jQuery_with_Other_Libraries
14
- // and http://zeptojs.com/
15
- var libFuncName = null;
16
-
17
- if (typeof jQuery === "undefined" &&
18
- typeof Zepto === "undefined" &&
19
- typeof $ === "function") {
20
- libFuncName = $;
21
- } else if (typeof jQuery === "function") {
22
- libFuncName = jQuery;
23
- } else if (typeof Zepto === "function") {
24
- libFuncName = Zepto;
25
- } else {
26
- throw new TypeError();
27
- }
28
-
29
- (function ($, window, document, undefined) {
30
- 'use strict';
31
-
32
- /*
33
- matchMedia() polyfill - Test a CSS media
34
- type/query in JS. Authors & copyright (c) 2012:
35
- Scott Jehl, Paul Irish, Nicholas Zakas.
36
- Dual MIT/BSD license
37
-
38
- https://github.com/paulirish/matchMedia.js
39
- */
40
-
41
- window.matchMedia = window.matchMedia || (function( doc, undefined ) {
42
-
43
- "use strict";
44
-
45
- var bool,
46
- docElem = doc.documentElement,
47
- refNode = docElem.firstElementChild || docElem.firstChild,
48
- // fakeBody required for <FF4 when executed in <head>
49
- fakeBody = doc.createElement( "body" ),
50
- div = doc.createElement( "div" );
51
-
52
- div.id = "mq-test-1";
53
- div.style.cssText = "position:absolute;top:-100em";
54
- fakeBody.style.background = "none";
55
- fakeBody.appendChild(div);
56
-
57
- return function(q){
58
-
59
- div.innerHTML = "&shy;<style media=\"" + q + "\"> #mq-test-1 { width: 42px; }</style>";
60
-
61
- docElem.insertBefore( fakeBody, refNode );
62
- bool = div.offsetWidth === 42;
63
- docElem.removeChild( fakeBody );
64
-
65
- return {
66
- matches: bool,
67
- media: q
68
- };
69
-
70
- };
71
-
72
- }( document ));
73
-
74
- // add dusty browser stuff
75
- if (!Array.prototype.filter) {
76
- Array.prototype.filter = function(fun /*, thisp */) {
77
- "use strict";
78
-
79
- if (this == null) {
80
- throw new TypeError();
81
- }
82
-
83
- var t = Object(this),
84
- len = t.length >>> 0;
85
- if (typeof fun !== "function") {
86
- return;
87
- }
88
-
89
- var res = [],
90
- thisp = arguments[1];
91
- for (var i = 0; i < len; i++) {
92
- if (i in t) {
93
- var val = t[i]; // in case fun mutates this
94
- if (fun && fun.call(thisp, val, i, t)) {
95
- res.push(val);
96
- }
97
- }
98
- }
99
-
100
- return res;
101
- }
102
- }
103
-
104
- if (!Function.prototype.bind) {
105
- Function.prototype.bind = function (oThis) {
106
- if (typeof this !== "function") {
107
- // closest thing possible to the ECMAScript 5 internal IsCallable function
108
- throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable");
109
- }
110
-
111
- var aArgs = Array.prototype.slice.call(arguments, 1),
112
- fToBind = this,
113
- fNOP = function () {},
114
- fBound = function () {
115
- return fToBind.apply(this instanceof fNOP && oThis
116
- ? this
117
- : oThis,
118
- aArgs.concat(Array.prototype.slice.call(arguments)));
119
- };
120
-
121
- fNOP.prototype = this.prototype;
122
- fBound.prototype = new fNOP();
123
-
124
- return fBound;
125
- };
126
- }
127
-
128
- if (!Array.prototype.indexOf) {
129
- Array.prototype.indexOf = function (searchElement /*, fromIndex */ ) {
130
- "use strict";
131
- if (this == null) {
132
- throw new TypeError();
133
- }
134
- var t = Object(this);
135
- var len = t.length >>> 0;
136
- if (len === 0) {
137
- return -1;
138
- }
139
- var n = 0;
140
- if (arguments.length > 1) {
141
- n = Number(arguments[1]);
142
- if (n != n) { // shortcut for verifying if it's NaN
143
- n = 0;
144
- } else if (n != 0 && n != Infinity && n != -Infinity) {
145
- n = (n > 0 || -1) * Math.floor(Math.abs(n));
146
- }
147
- }
148
- if (n >= len) {
149
- return -1;
150
- }
151
- var k = n >= 0 ? n : Math.max(len - Math.abs(n), 0);
152
- for (; k < len; k++) {
153
- if (k in t && t[k] === searchElement) {
154
- return k;
155
- }
156
- }
157
- return -1;
158
- }
159
- }
160
-
161
- // fake stop() for zepto.
162
- $.fn.stop = $.fn.stop || function() {
163
- return this;
164
- };
165
-
166
- window.Foundation = {
167
- name : 'Foundation',
168
-
169
- version : '4.2.3',
170
-
171
- cache : {},
172
-
173
- init : function (scope, libraries, method, options, response, /* internal */ nc) {
174
- var library_arr,
175
- args = [scope, method, options, response],
176
- responses = [],
177
- nc = nc || false;
178
-
179
- // disable library error catching,
180
- // used for development only
181
- if (nc) this.nc = nc;
182
-
183
- // check RTL
184
- this.rtl = /rtl/i.test($('html').attr('dir'));
185
-
186
- // set foundation global scope
187
- this.scope = scope || this.scope;
188
-
189
- if (libraries && typeof libraries === 'string' && !/reflow/i.test(libraries)) {
190
- if (/off/i.test(libraries)) return this.off();
191
-
192
- library_arr = libraries.split(' ');
193
-
194
- if (library_arr.length > 0) {
195
- for (var i = library_arr.length - 1; i >= 0; i--) {
196
- responses.push(this.init_lib(library_arr[i], args));
197
- }
198
- }
199
- } else {
200
- if (/reflow/i.test(libraries)) args[1] = 'reflow';
201
-
202
- for (var lib in this.libs) {
203
- responses.push(this.init_lib(lib, args));
204
- }
205
- }
206
-
207
- // if first argument is callback, add to args
208
- if (typeof libraries === 'function') {
209
- args.unshift(libraries);
210
- }
211
-
212
- return this.response_obj(responses, args);
213
- },
214
-
215
- response_obj : function (response_arr, args) {
216
- for (var i = 0, len = args.length; i < len; i++) {
217
- if (typeof args[i] === 'function') {
218
- return args[i]({
219
- errors: response_arr.filter(function (s) {
220
- if (typeof s === 'string') return s;
221
- })
222
- });
223
- }
224
- }
225
-
226
- return response_arr;
227
- },
228
-
229
- init_lib : function (lib, args) {
230
- return this.trap(function () {
231
- if (this.libs.hasOwnProperty(lib)) {
232
- this.patch(this.libs[lib]);
233
- return this.libs[lib].init.apply(this.libs[lib], args);
234
- }
235
- else {
236
- return function () {};
237
- }
238
- }.bind(this), lib);
239
- },
240
-
241
- trap : function (fun, lib) {
242
- if (!this.nc) {
243
- try {
244
- return fun();
245
- } catch (e) {
246
- return this.error({name: lib, message: 'could not be initialized', more: e.name + ' ' + e.message});
247
- }
248
- }
249
-
250
- return fun();
251
- },
252
-
253
- patch : function (lib) {
254
- this.fix_outer(lib);
255
- lib.scope = this.scope;
256
- lib.rtl = this.rtl;
257
- },
258
-
259
- inherit : function (scope, methods) {
260
- var methods_arr = methods.split(' ');
261
-
262
- for (var i = methods_arr.length - 1; i >= 0; i--) {
263
- if (this.lib_methods.hasOwnProperty(methods_arr[i])) {
264
- this.libs[scope.name][methods_arr[i]] = this.lib_methods[methods_arr[i]];
265
- }
266
- }
267
- },
268
-
269
- random_str : function (length) {
270
- var chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'.split('');
271
-
272
- if (!length) {
273
- length = Math.floor(Math.random() * chars.length);
274
- }
275
-
276
- var str = '';
277
- for (var i = 0; i < length; i++) {
278
- str += chars[Math.floor(Math.random() * chars.length)];
279
- }
280
- return str;
281
- },
282
-
283
- libs : {},
284
-
285
- // methods that can be inherited in libraries
286
- lib_methods : {
287
- set_data : function (node, data) {
288
- // this.name references the name of the library calling this method
289
- var id = [this.name,+new Date(),Foundation.random_str(5)].join('-');
290
-
291
- Foundation.cache[id] = data;
292
- node.attr('data-' + this.name + '-id', id);
293
- return data;
294
- },
295
-
296
- get_data : function (node) {
297
- return Foundation.cache[node.attr('data-' + this.name + '-id')];
298
- },
299
-
300
- remove_data : function (node) {
301
- if (node) {
302
- delete Foundation.cache[node.attr('data-' + this.name + '-id')];
303
- node.attr('data-' + this.name + '-id', '');
304
- } else {
305
- $('[data-' + this.name + '-id]').each(function () {
306
- delete Foundation.cache[$(this).attr('data-' + this.name + '-id')];
307
- $(this).attr('data-' + this.name + '-id', '');
308
- });
309
- }
310
- },
311
-
312
- throttle : function(fun, delay) {
313
- var timer = null;
314
- return function () {
315
- var context = this, args = arguments;
316
- clearTimeout(timer);
317
- timer = setTimeout(function () {
318
- fun.apply(context, args);
319
- }, delay);
320
- };
321
- },
322
-
323
- // parses data-options attribute on nodes and turns
324
- // them into an object
325
- data_options : function (el) {
326
- var opts = {}, ii, p,
327
- opts_arr = (el.attr('data-options') || ':').split(';'),
328
- opts_len = opts_arr.length;
329
-
330
- function isNumber (o) {
331
- return ! isNaN (o-0) && o !== null && o !== "" && o !== false && o !== true;
332
- }
333
-
334
- function trim(str) {
335
- if (typeof str === 'string') return $.trim(str);
336
- return str;
337
- }
338
-
339
- // parse options
340
- for (ii = opts_len - 1; ii >= 0; ii--) {
341
- p = opts_arr[ii].split(':');
342
-
343
- if (/true/i.test(p[1])) p[1] = true;
344
- if (/false/i.test(p[1])) p[1] = false;
345
- if (isNumber(p[1])) p[1] = parseInt(p[1], 10);
346
-
347
- if (p.length === 2 && p[0].length > 0) {
348
- opts[trim(p[0])] = trim(p[1]);
349
- }
350
- }
351
-
352
- return opts;
353
- },
354
-
355
- delay : function (fun, delay) {
356
- return setTimeout(fun, delay);
357
- },
358
-
359
- // animated scrolling
360
- scrollTo : function (el, to, duration) {
361
- if (duration < 0) return;
362
- var difference = to - $(window).scrollTop();
363
- var perTick = difference / duration * 10;
364
-
365
- this.scrollToTimerCache = setTimeout(function() {
366
- if (!isNaN(parseInt(perTick, 10))) {
367
- window.scrollTo(0, $(window).scrollTop() + perTick);
368
- this.scrollTo(el, to, duration - 10);
369
- }
370
- }.bind(this), 10);
371
- },
372
-
373
- // not supported in core Zepto
374
- scrollLeft : function (el) {
375
- if (!el.length) return;
376
- return ('scrollLeft' in el[0]) ? el[0].scrollLeft : el[0].pageXOffset;
377
- },
378
-
379
- // test for empty object or array
380
- empty : function (obj) {
381
- if (obj.length && obj.length > 0) return false;
382
- if (obj.length && obj.length === 0) return true;
383
-
384
- for (var key in obj) {
385
- if (hasOwnProperty.call(obj, key)) return false;
386
- }
387
-
388
- return true;
389
- }
390
- },
391
-
392
- fix_outer : function (lib) {
393
- lib.outerHeight = function (el, bool) {
394
- if (typeof Zepto === 'function') {
395
- return el.height();
396
- }
397
-
398
- if (typeof bool !== 'undefined') {
399
- return el.outerHeight(bool);
400
- }
401
-
402
- return el.outerHeight();
403
- };
404
-
405
- lib.outerWidth = function (el) {
406
- if (typeof Zepto === 'function') {
407
- return el.width();
408
- }
409
-
410
- if (typeof bool !== 'undefined') {
411
- return el.outerWidth(bool);
412
- }
413
-
414
- return el.outerWidth();
415
- };
416
- },
417
-
418
- error : function (error) {
419
- return error.name + ' ' + error.message + '; ' + error.more;
420
- },
421
-
422
- // remove all foundation events.
423
- off: function () {
424
- $(this.scope).off('.fndtn');
425
- $(window).off('.fndtn');
426
- return true;
427
- },
428
-
429
- zj : function () {
430
- if (typeof Zepto !== 'undefined') {
431
- return Zepto;
432
- } else {
433
- return jQuery;
434
- }
435
- }()
436
- };
437
-
438
- $.fn.foundation = function () {
439
- var args = Array.prototype.slice.call(arguments, 0);
440
-
441
- return this.each(function () {
442
- Foundation.init.apply(Foundation, [this].concat(args));
443
- return this;
444
- });
445
- };
446
-
447
- }(libFuncName, this, this.document));
@@ -1,134 +0,0 @@
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.2.2',
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.addClass('fixed');
83
- $expedition.css({position:"fixed", top:0});
84
- } else {
85
- $expedition.removeClass('fixed');
86
- $expedition.css({position:"", top:""});
87
- }
88
- if (fixed_position && typeof attr != 'undefined' && attr != false) {
89
- $expedition.css({position:"fixed", top:attr + "px"});
90
- }
91
- }
92
- });
93
- });
94
-
95
-
96
- if (this.last_destination.length > 0) {
97
- $(window).on('scroll.fndtn.magellan', function (e) {
98
- var windowScrollTop = $(window).scrollTop(),
99
- scrolltopPlusHeight = windowScrollTop + $(window).height(),
100
- lastDestinationTop = Math.ceil(self.last_destination.offset().top);
101
-
102
- $('[data-magellan-destination]').each(function () {
103
- var $destination = $(this),
104
- destination_name = $destination.attr('data-magellan-destination'),
105
- topOffset = $destination.offset().top - windowScrollTop;
106
-
107
- if (topOffset <= self.settings.threshold) {
108
- $("[data-magellan-arrival='" + destination_name + "']").trigger('arrival');
109
- }
110
- // 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
111
- if (scrolltopPlusHeight >= $(self.scope).height() && lastDestinationTop > windowScrollTop && lastDestinationTop < scrolltopPlusHeight) {
112
- $('[data-magellan-arrival]').last().trigger('arrival');
113
- }
114
- });
115
- });
116
- }
117
-
118
- this.settings.init = true;
119
- },
120
-
121
- set_threshold : function () {
122
- if (!this.settings.threshold) {
123
- this.settings.threshold = (this.fixed_magellan.length > 0) ?
124
- this.outerHeight(this.fixed_magellan, true) : 0;
125
- }
126
- },
127
-
128
- off : function () {
129
- $(this.scope).off('.fndtn.magellan');
130
- },
131
-
132
- reflow : function () {}
133
- };
134
- }(Foundation.zj, this, this.document));