pbw 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (69) hide show
  1. checksums.yaml +8 -8
  2. data/MIT-LICENSE +1 -1
  3. data/Rakefile +7 -0
  4. data/app/controllers/pbw/application_controller.rb +9 -3
  5. data/app/controllers/pbw/areas_controller.rb +7 -0
  6. data/app/controllers/pbw/base_models_controller.rb +106 -0
  7. data/app/controllers/pbw/capabilities_controller.rb +7 -0
  8. data/app/controllers/pbw/constraints_controller.rb +7 -0
  9. data/app/controllers/pbw/item_containers_controller.rb +7 -0
  10. data/app/controllers/pbw/item_conversions_controller.rb +7 -0
  11. data/app/controllers/pbw/item_transfers_controller.rb +7 -0
  12. data/app/controllers/pbw/items_controller.rb +7 -0
  13. data/app/controllers/pbw/processes_controller.rb +7 -0
  14. data/app/controllers/pbw/roles_controller.rb +5 -2
  15. data/app/controllers/pbw/tokens_controller.rb +7 -0
  16. data/app/controllers/pbw/triggers_controller.rb +7 -0
  17. data/app/controllers/pbw/user_tokens_controller.rb +7 -0
  18. data/app/models/pbw/area.rb +17 -0
  19. data/app/models/pbw/capability.rb +5 -0
  20. data/app/models/pbw/constraint.rb +6 -0
  21. data/app/models/pbw/item.rb +15 -0
  22. data/app/models/pbw/item_container.rb +12 -0
  23. data/app/models/pbw/item_conversion.rb +9 -0
  24. data/app/models/pbw/item_transfer.rb +9 -0
  25. data/app/models/pbw/permission.rb +1 -0
  26. data/app/models/pbw/process.rb +10 -0
  27. data/app/models/pbw/role.rb +1 -0
  28. data/app/models/pbw/rule.rb +11 -0
  29. data/app/models/pbw/token.rb +16 -0
  30. data/app/models/pbw/trigger.rb +7 -0
  31. data/app/models/pbw/user.rb +7 -5
  32. data/app/models/pbw/user_token.rb +16 -0
  33. data/app/views/layouts/pbw/application.html.erb +41 -8
  34. data/config/initializers/devise.rb +80 -4
  35. data/config/locales/devise.en.yml +59 -0
  36. data/config/routes.rb +11 -0
  37. data/lib/generators/pbw/install/install_generator.rb +9 -1
  38. data/lib/generators/pbw/install/templates/application.html.erb +47 -0
  39. data/lib/pbw/engine.rb +33 -13
  40. data/lib/pbw/version.rb +1 -1
  41. data/public/Foundation-MIT-LICENSE.txt +20 -0
  42. data/public/config.rb +26 -0
  43. data/public/humans.txt +8 -0
  44. data/public/javascripts/foundation/foundation.alerts.js +52 -0
  45. data/public/javascripts/foundation/foundation.clearing.js +516 -0
  46. data/public/javascripts/foundation/foundation.cookie.js +74 -0
  47. data/public/javascripts/foundation/foundation.dropdown.js +178 -0
  48. data/public/javascripts/foundation/foundation.forms.js +525 -0
  49. data/public/javascripts/foundation/foundation.interchange.js +271 -0
  50. data/public/javascripts/foundation/foundation.joyride.js +844 -0
  51. data/public/javascripts/foundation/foundation.js +447 -0
  52. data/public/javascripts/foundation/foundation.magellan.js +134 -0
  53. data/public/javascripts/foundation/foundation.orbit.js +390 -0
  54. data/public/javascripts/foundation/foundation.placeholder.js +179 -0
  55. data/public/javascripts/foundation/foundation.reveal.js +330 -0
  56. data/public/javascripts/foundation/foundation.section.js +422 -0
  57. data/public/javascripts/foundation/foundation.tooltips.js +208 -0
  58. data/public/javascripts/foundation/foundation.topbar.js +303 -0
  59. data/public/javascripts/vendor/custom.modernizr.js +4 -0
  60. data/public/javascripts/vendor/jquery.js +9807 -0
  61. data/public/javascripts/vendor/zepto.js +2000 -0
  62. data/public/robots.txt +4 -0
  63. data/public/sass/_normalize.scss +402 -0
  64. data/public/sass/_settings.scss +1271 -0
  65. data/public/sass/app.scss +48 -0
  66. data/public/stylesheets/app.css +6686 -0
  67. metadata +82 -4
  68. data/app/assets/javascripts/pbw/application.js +0 -13
  69. data/app/assets/stylesheets/pbw/application.css +0 -13
@@ -0,0 +1,447 @@
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));
@@ -0,0 +1,134 @@
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));