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,330 @@
1
+ /*jslint unparam: true, browser: true, indent: 2 */
2
+
3
+ ;(function ($, window, document, undefined) {
4
+ 'use strict';
5
+
6
+ Foundation.libs.reveal = {
7
+ name: 'reveal',
8
+
9
+ version : '4.2.2',
10
+
11
+ locked : false,
12
+
13
+ settings : {
14
+ animation: 'fadeAndPop',
15
+ animationSpeed: 250,
16
+ closeOnBackgroundClick: true,
17
+ closeOnEsc: true,
18
+ dismissModalClass: 'close-reveal-modal',
19
+ bgClass: 'reveal-modal-bg',
20
+ open: function(){},
21
+ opened: function(){},
22
+ close: function(){},
23
+ closed: function(){},
24
+ bg : $('.reveal-modal-bg'),
25
+ css : {
26
+ open : {
27
+ 'opacity': 0,
28
+ 'visibility': 'visible',
29
+ 'display' : 'block'
30
+ },
31
+ close : {
32
+ 'opacity': 1,
33
+ 'visibility': 'hidden',
34
+ 'display': 'none'
35
+ }
36
+ }
37
+ },
38
+
39
+ init : function (scope, method, options) {
40
+ Foundation.inherit(this, 'data_options delay');
41
+
42
+ if (typeof method === 'object') {
43
+ $.extend(true, this.settings, method);
44
+ } else if (typeof options !== 'undefined') {
45
+ $.extend(true, this.settings, options);
46
+ }
47
+
48
+ if (typeof method !== 'string') {
49
+ this.events();
50
+
51
+ return this.settings.init;
52
+ } else {
53
+ return this[method].call(this, options);
54
+ }
55
+ },
56
+
57
+ events : function () {
58
+ var self = this;
59
+
60
+ $(this.scope)
61
+ .off('.fndtn.reveal')
62
+ .on('click.fndtn.reveal', '[data-reveal-id]', function (e) {
63
+ e.preventDefault();
64
+
65
+ if (!self.locked) {
66
+ var element = $(this),
67
+ ajax = element.data('reveal-ajax');
68
+
69
+ self.locked = true;
70
+
71
+ if (typeof ajax === 'undefined') {
72
+ self.open.call(self, element);
73
+ } else {
74
+ var url = ajax === true ? element.attr('href') : ajax;
75
+
76
+ self.open.call(self, element, {url: url});
77
+ }
78
+ }
79
+ })
80
+ .on('click.fndtn.reveal', this.close_targets(), function (e) {
81
+ e.preventDefault();
82
+ if (!self.locked) {
83
+ var settings = $.extend({}, self.settings, self.data_options($('.reveal-modal.open')));
84
+ if ($(e.target)[0] === $('.' + settings.bgClass)[0] && !settings.closeOnBackgroundClick) {
85
+ return;
86
+ }
87
+
88
+ self.locked = true;
89
+ self.close.call(self, $(this).closest('.reveal-modal'));
90
+ }
91
+ })
92
+ .on('open.fndtn.reveal', '.reveal-modal', this.settings.open)
93
+ .on('opened.fndtn.reveal', '.reveal-modal', this.settings.opened)
94
+ .on('opened.fndtn.reveal', '.reveal-modal', this.open_video)
95
+ .on('close.fndtn.reveal', '.reveal-modal', this.settings.close)
96
+ .on('closed.fndtn.reveal', '.reveal-modal', this.settings.closed)
97
+ .on('closed.fndtn.reveal', '.reveal-modal', this.close_video);
98
+
99
+ $( 'body' ).bind( 'keyup.reveal', function ( event ) {
100
+ var open_modal = $('.reveal-modal.open'),
101
+ settings = $.extend({}, self.settings, self.data_options(open_modal));
102
+ if ( event.which === 27 && settings.closeOnEsc) { // 27 is the keycode for the Escape key
103
+ open_modal.foundation('reveal', 'close');
104
+ }
105
+ });
106
+
107
+ return true;
108
+ },
109
+
110
+ open : function (target, ajax_settings) {
111
+ if (target) {
112
+ if (typeof target.selector !== 'undefined') {
113
+ var modal = $('#' + target.data('reveal-id'));
114
+ } else {
115
+ var modal = $(this.scope);
116
+
117
+ ajax_settings = target;
118
+ }
119
+ } else {
120
+ var modal = $(this.scope);
121
+ }
122
+
123
+ if (!modal.hasClass('open')) {
124
+ var open_modal = $('.reveal-modal.open');
125
+
126
+ if (typeof modal.data('css-top') === 'undefined') {
127
+ modal.data('css-top', parseInt(modal.css('top'), 10))
128
+ .data('offset', this.cache_offset(modal));
129
+ }
130
+
131
+ modal.trigger('open');
132
+
133
+ if (open_modal.length < 1) {
134
+ this.toggle_bg(modal);
135
+ }
136
+
137
+ if (typeof ajax_settings === 'undefined' || !ajax_settings.url) {
138
+ this.hide(open_modal, this.settings.css.close);
139
+ this.show(modal, this.settings.css.open);
140
+ } else {
141
+ var self = this,
142
+ old_success = typeof ajax_settings.success !== 'undefined' ? ajax_settings.success : null;
143
+
144
+ $.extend(ajax_settings, {
145
+ success: function (data, textStatus, jqXHR) {
146
+ if ( $.isFunction(old_success) ) {
147
+ old_success(data, textStatus, jqXHR);
148
+ }
149
+
150
+ modal.html(data);
151
+ $(modal).foundation('section', 'reflow');
152
+
153
+ self.hide(open_modal, self.settings.css.close);
154
+ self.show(modal, self.settings.css.open);
155
+ }
156
+ });
157
+
158
+ $.ajax(ajax_settings);
159
+ }
160
+ }
161
+ },
162
+
163
+ close : function (modal) {
164
+
165
+ var modal = modal && modal.length ? modal : $(this.scope),
166
+ open_modals = $('.reveal-modal.open');
167
+
168
+ if (open_modals.length > 0) {
169
+ this.locked = true;
170
+ modal.trigger('close');
171
+ this.toggle_bg(modal);
172
+ this.hide(open_modals, this.settings.css.close);
173
+ }
174
+ },
175
+
176
+ close_targets : function () {
177
+ var base = '.' + this.settings.dismissModalClass;
178
+
179
+ if (this.settings.closeOnBackgroundClick) {
180
+ return base + ', .' + this.settings.bgClass;
181
+ }
182
+
183
+ return base;
184
+ },
185
+
186
+ toggle_bg : function (modal) {
187
+ if ($('.reveal-modal-bg').length === 0) {
188
+ this.settings.bg = $('<div />', {'class': this.settings.bgClass})
189
+ .appendTo('body');
190
+ }
191
+
192
+ if (this.settings.bg.filter(':visible').length > 0) {
193
+ this.hide(this.settings.bg);
194
+ } else {
195
+ this.show(this.settings.bg);
196
+ }
197
+ },
198
+
199
+ show : function (el, css) {
200
+ // is modal
201
+ if (css) {
202
+ if (/pop/i.test(this.settings.animation)) {
203
+ css.top = $(window).scrollTop() - el.data('offset') + 'px';
204
+ var end_css = {
205
+ top: $(window).scrollTop() + el.data('css-top') + 'px',
206
+ opacity: 1
207
+ };
208
+
209
+ return this.delay(function () {
210
+ return el
211
+ .css(css)
212
+ .animate(end_css, this.settings.animationSpeed, 'linear', function () {
213
+ this.locked = false;
214
+ el.trigger('opened');
215
+ }.bind(this))
216
+ .addClass('open');
217
+ }.bind(this), this.settings.animationSpeed / 2);
218
+ }
219
+
220
+ if (/fade/i.test(this.settings.animation)) {
221
+ var end_css = {opacity: 1};
222
+
223
+ return this.delay(function () {
224
+ return el
225
+ .css(css)
226
+ .animate(end_css, this.settings.animationSpeed, 'linear', function () {
227
+ this.locked = false;
228
+ el.trigger('opened');
229
+ }.bind(this))
230
+ .addClass('open');
231
+ }.bind(this), this.settings.animationSpeed / 2);
232
+ }
233
+
234
+ return el.css(css).show().css({opacity: 1}).addClass('open').trigger('opened');
235
+ }
236
+
237
+ // should we animate the background?
238
+ if (/fade/i.test(this.settings.animation)) {
239
+ return el.fadeIn(this.settings.animationSpeed / 2);
240
+ }
241
+
242
+ return el.show();
243
+ },
244
+
245
+ hide : function (el, css) {
246
+ // is modal
247
+ if (css) {
248
+ if (/pop/i.test(this.settings.animation)) {
249
+ var end_css = {
250
+ top: - $(window).scrollTop() - el.data('offset') + 'px',
251
+ opacity: 0
252
+ };
253
+
254
+ return this.delay(function () {
255
+ return el
256
+ .animate(end_css, this.settings.animationSpeed, 'linear', function () {
257
+ this.locked = false;
258
+ el.css(css).trigger('closed');
259
+ }.bind(this))
260
+ .removeClass('open');
261
+ }.bind(this), this.settings.animationSpeed / 2);
262
+ }
263
+
264
+ if (/fade/i.test(this.settings.animation)) {
265
+ var end_css = {opacity: 0};
266
+
267
+ return this.delay(function () {
268
+ return el
269
+ .animate(end_css, this.settings.animationSpeed, 'linear', function () {
270
+ this.locked = false;
271
+ el.css(css).trigger('closed');
272
+ }.bind(this))
273
+ .removeClass('open');
274
+ }.bind(this), this.settings.animationSpeed / 2);
275
+ }
276
+
277
+ return el.hide().css(css).removeClass('open').trigger('closed');
278
+ }
279
+
280
+ // should we animate the background?
281
+ if (/fade/i.test(this.settings.animation)) {
282
+ return el.fadeOut(this.settings.animationSpeed / 2);
283
+ }
284
+
285
+ return el.hide();
286
+ },
287
+
288
+ close_video : function (e) {
289
+ var video = $(this).find('.flex-video'),
290
+ iframe = video.find('iframe');
291
+
292
+ if (iframe.length > 0) {
293
+ iframe.attr('data-src', iframe[0].src);
294
+ iframe.attr('src', 'about:blank');
295
+ video.hide();
296
+ }
297
+ },
298
+
299
+ open_video : function (e) {
300
+ var video = $(this).find('.flex-video'),
301
+ iframe = video.find('iframe');
302
+
303
+ if (iframe.length > 0) {
304
+ var data_src = iframe.attr('data-src');
305
+ if (typeof data_src === 'string') {
306
+ iframe[0].src = iframe.attr('data-src');
307
+ } else {
308
+ var src = iframe[0].src;
309
+ iframe[0].src = undefined;
310
+ iframe[0].src = src;
311
+ }
312
+ video.show();
313
+ }
314
+ },
315
+
316
+ cache_offset : function (modal) {
317
+ var offset = modal.show().height() + parseInt(modal.css('top'), 10);
318
+
319
+ modal.hide();
320
+
321
+ return offset;
322
+ },
323
+
324
+ off : function () {
325
+ $(this.scope).off('.fndtn.reveal');
326
+ },
327
+
328
+ reflow : function () {}
329
+ };
330
+ }(Foundation.zj, this, this.document));