pbw 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/MIT-LICENSE +1 -1
- data/Rakefile +7 -0
- data/app/controllers/pbw/application_controller.rb +9 -3
- data/app/controllers/pbw/areas_controller.rb +7 -0
- data/app/controllers/pbw/base_models_controller.rb +106 -0
- data/app/controllers/pbw/capabilities_controller.rb +7 -0
- data/app/controllers/pbw/constraints_controller.rb +7 -0
- data/app/controllers/pbw/item_containers_controller.rb +7 -0
- data/app/controllers/pbw/item_conversions_controller.rb +7 -0
- data/app/controllers/pbw/item_transfers_controller.rb +7 -0
- data/app/controllers/pbw/items_controller.rb +7 -0
- data/app/controllers/pbw/processes_controller.rb +7 -0
- data/app/controllers/pbw/roles_controller.rb +5 -2
- data/app/controllers/pbw/tokens_controller.rb +7 -0
- data/app/controllers/pbw/triggers_controller.rb +7 -0
- data/app/controllers/pbw/user_tokens_controller.rb +7 -0
- data/app/models/pbw/area.rb +17 -0
- data/app/models/pbw/capability.rb +5 -0
- data/app/models/pbw/constraint.rb +6 -0
- data/app/models/pbw/item.rb +15 -0
- data/app/models/pbw/item_container.rb +12 -0
- data/app/models/pbw/item_conversion.rb +9 -0
- data/app/models/pbw/item_transfer.rb +9 -0
- data/app/models/pbw/permission.rb +1 -0
- data/app/models/pbw/process.rb +10 -0
- data/app/models/pbw/role.rb +1 -0
- data/app/models/pbw/rule.rb +11 -0
- data/app/models/pbw/token.rb +16 -0
- data/app/models/pbw/trigger.rb +7 -0
- data/app/models/pbw/user.rb +7 -5
- data/app/models/pbw/user_token.rb +16 -0
- data/app/views/layouts/pbw/application.html.erb +41 -8
- data/config/initializers/devise.rb +80 -4
- data/config/locales/devise.en.yml +59 -0
- data/config/routes.rb +11 -0
- data/lib/generators/pbw/install/install_generator.rb +9 -1
- data/lib/generators/pbw/install/templates/application.html.erb +47 -0
- data/lib/pbw/engine.rb +33 -13
- data/lib/pbw/version.rb +1 -1
- data/public/Foundation-MIT-LICENSE.txt +20 -0
- data/public/config.rb +26 -0
- data/public/humans.txt +8 -0
- data/public/javascripts/foundation/foundation.alerts.js +52 -0
- data/public/javascripts/foundation/foundation.clearing.js +516 -0
- data/public/javascripts/foundation/foundation.cookie.js +74 -0
- data/public/javascripts/foundation/foundation.dropdown.js +178 -0
- data/public/javascripts/foundation/foundation.forms.js +525 -0
- data/public/javascripts/foundation/foundation.interchange.js +271 -0
- data/public/javascripts/foundation/foundation.joyride.js +844 -0
- data/public/javascripts/foundation/foundation.js +447 -0
- data/public/javascripts/foundation/foundation.magellan.js +134 -0
- data/public/javascripts/foundation/foundation.orbit.js +390 -0
- data/public/javascripts/foundation/foundation.placeholder.js +179 -0
- data/public/javascripts/foundation/foundation.reveal.js +330 -0
- data/public/javascripts/foundation/foundation.section.js +422 -0
- data/public/javascripts/foundation/foundation.tooltips.js +208 -0
- data/public/javascripts/foundation/foundation.topbar.js +303 -0
- data/public/javascripts/vendor/custom.modernizr.js +4 -0
- data/public/javascripts/vendor/jquery.js +9807 -0
- data/public/javascripts/vendor/zepto.js +2000 -0
- data/public/robots.txt +4 -0
- data/public/sass/_normalize.scss +402 -0
- data/public/sass/_settings.scss +1271 -0
- data/public/sass/app.scss +48 -0
- data/public/stylesheets/app.css +6686 -0
- metadata +82 -4
- data/app/assets/javascripts/pbw/application.js +0 -13
- data/app/assets/stylesheets/pbw/application.css +0 -13
@@ -0,0 +1,271 @@
|
|
1
|
+
/*jslint unparam: true, browser: true, indent: 2 */
|
2
|
+
|
3
|
+
;(function ($, window, document, undefined) {
|
4
|
+
'use strict';
|
5
|
+
|
6
|
+
Foundation.libs.interchange = {
|
7
|
+
name : 'interchange',
|
8
|
+
|
9
|
+
version : '4.2.2',
|
10
|
+
|
11
|
+
cache : {},
|
12
|
+
|
13
|
+
settings : {
|
14
|
+
load_attr : 'interchange',
|
15
|
+
|
16
|
+
named_queries : {
|
17
|
+
'default' : 'only screen and (min-width: 1px)',
|
18
|
+
small : 'only screen and (min-width: 768px)',
|
19
|
+
medium : 'only screen and (min-width: 1280px)',
|
20
|
+
large : 'only screen and (min-width: 1440px)',
|
21
|
+
landscape : 'only screen and (orientation: landscape)',
|
22
|
+
portrait : 'only screen and (orientation: portrait)',
|
23
|
+
retina : 'only screen and (-webkit-min-device-pixel-ratio: 2),' +
|
24
|
+
'only screen and (min--moz-device-pixel-ratio: 2),' +
|
25
|
+
'only screen and (-o-min-device-pixel-ratio: 2/1),' +
|
26
|
+
'only screen and (min-device-pixel-ratio: 2),' +
|
27
|
+
'only screen and (min-resolution: 192dpi),' +
|
28
|
+
'only screen and (min-resolution: 2dppx)'
|
29
|
+
},
|
30
|
+
|
31
|
+
directives : {
|
32
|
+
replace : function (el, path) {
|
33
|
+
if (/IMG/.test(el[0].nodeName)) {
|
34
|
+
var path_parts = path.split('/'),
|
35
|
+
path_file = path_parts[path_parts.length - 1],
|
36
|
+
orig_path = el[0].src;
|
37
|
+
|
38
|
+
if (new RegExp(path_file, 'i').test(el[0].src)) return;
|
39
|
+
|
40
|
+
el[0].src = path;
|
41
|
+
|
42
|
+
return el.trigger('replace', [el[0].src, orig_path]);
|
43
|
+
}
|
44
|
+
}
|
45
|
+
}
|
46
|
+
},
|
47
|
+
|
48
|
+
init : function (scope, method, options) {
|
49
|
+
Foundation.inherit(this, 'throttle');
|
50
|
+
|
51
|
+
if (typeof method === 'object') {
|
52
|
+
$.extend(true, this.settings, method);
|
53
|
+
}
|
54
|
+
|
55
|
+
this.events();
|
56
|
+
this.images();
|
57
|
+
|
58
|
+
if (typeof method !== 'string') {
|
59
|
+
return this.settings.init;
|
60
|
+
} else {
|
61
|
+
return this[method].call(this, options);
|
62
|
+
}
|
63
|
+
},
|
64
|
+
|
65
|
+
events : function () {
|
66
|
+
var self = this;
|
67
|
+
|
68
|
+
$(window).on('resize.fndtn.interchange', self.throttle(function () {
|
69
|
+
self.resize.call(self);
|
70
|
+
}, 50));
|
71
|
+
},
|
72
|
+
|
73
|
+
resize : function () {
|
74
|
+
var cache = this.cache;
|
75
|
+
|
76
|
+
for (var uuid in cache) {
|
77
|
+
if (cache.hasOwnProperty(uuid)) {
|
78
|
+
var passed = this.results(uuid, cache[uuid]);
|
79
|
+
|
80
|
+
if (passed) {
|
81
|
+
this.settings.directives[passed
|
82
|
+
.scenario[1]](passed.el, passed.scenario[0]);
|
83
|
+
}
|
84
|
+
}
|
85
|
+
}
|
86
|
+
|
87
|
+
},
|
88
|
+
|
89
|
+
results : function (uuid, scenarios) {
|
90
|
+
var count = scenarios.length,
|
91
|
+
results_arr = [];
|
92
|
+
|
93
|
+
if (count > 0) {
|
94
|
+
var el = $('[data-uuid="' + uuid + '"]');
|
95
|
+
|
96
|
+
for (var i = count - 1; i >= 0; i--) {
|
97
|
+
var rule = scenarios[i][2];
|
98
|
+
if (this.settings.named_queries.hasOwnProperty(rule)) {
|
99
|
+
var mq = matchMedia(this.settings.named_queries[rule]);
|
100
|
+
} else {
|
101
|
+
var mq = matchMedia(scenarios[i][2]);
|
102
|
+
}
|
103
|
+
if (mq.matches) {
|
104
|
+
return {el: el, scenario: scenarios[i]};
|
105
|
+
}
|
106
|
+
}
|
107
|
+
}
|
108
|
+
|
109
|
+
return false;
|
110
|
+
},
|
111
|
+
|
112
|
+
images : function (force_update) {
|
113
|
+
if (typeof this.cached_images === 'undefined' || force_update) {
|
114
|
+
return this.update_images();
|
115
|
+
}
|
116
|
+
|
117
|
+
return this.cached_images;
|
118
|
+
},
|
119
|
+
|
120
|
+
update_images : function () {
|
121
|
+
var images = document.getElementsByTagName('img'),
|
122
|
+
count = images.length,
|
123
|
+
data_attr = 'data-' + this.settings.load_attr;
|
124
|
+
|
125
|
+
this.cached_images = [];
|
126
|
+
|
127
|
+
for (var i = count - 1; i >= 0; i--) {
|
128
|
+
this.loaded($(images[i]), (i === 0), function (image, last) {
|
129
|
+
if (image) {
|
130
|
+
var str = image.getAttribute(data_attr) || '';
|
131
|
+
|
132
|
+
if (str.length > 0) {
|
133
|
+
this.cached_images.push(image);
|
134
|
+
}
|
135
|
+
}
|
136
|
+
|
137
|
+
if (last) this.enhance();
|
138
|
+
|
139
|
+
}.bind(this));
|
140
|
+
}
|
141
|
+
|
142
|
+
return 'deferred';
|
143
|
+
},
|
144
|
+
|
145
|
+
// based on jquery.imageready.js
|
146
|
+
// @weblinc, @jsantell, (c) 2012
|
147
|
+
|
148
|
+
loaded : function (image, last, callback) {
|
149
|
+
function loaded () {
|
150
|
+
callback(image[0], last);
|
151
|
+
}
|
152
|
+
|
153
|
+
function bindLoad () {
|
154
|
+
this.one('load', loaded);
|
155
|
+
|
156
|
+
if (/MSIE (\d+\.\d+);/.test(navigator.userAgent)) {
|
157
|
+
var src = this.attr( 'src' ),
|
158
|
+
param = src.match( /\?/ ) ? '&' : '?';
|
159
|
+
|
160
|
+
param += 'random=' + (new Date()).getTime();
|
161
|
+
this.attr('src', src + param);
|
162
|
+
}
|
163
|
+
}
|
164
|
+
|
165
|
+
if (!image.attr('src')) {
|
166
|
+
loaded();
|
167
|
+
return;
|
168
|
+
}
|
169
|
+
|
170
|
+
if (image[0].complete || image[0].readyState === 4) {
|
171
|
+
loaded();
|
172
|
+
} else {
|
173
|
+
bindLoad.call(image);
|
174
|
+
}
|
175
|
+
},
|
176
|
+
|
177
|
+
enhance : function () {
|
178
|
+
var count = this.images().length;
|
179
|
+
|
180
|
+
for (var i = count - 1; i >= 0; i--) {
|
181
|
+
this._object($(this.images()[i]));
|
182
|
+
}
|
183
|
+
|
184
|
+
return $(window).trigger('resize');
|
185
|
+
},
|
186
|
+
|
187
|
+
parse_params : function (path, directive, mq) {
|
188
|
+
return [this.trim(path), this.convert_directive(directive), this.trim(mq)];
|
189
|
+
},
|
190
|
+
|
191
|
+
convert_directive : function (directive) {
|
192
|
+
var trimmed = this.trim(directive);
|
193
|
+
|
194
|
+
if (trimmed.length > 0) {
|
195
|
+
return trimmed;
|
196
|
+
}
|
197
|
+
|
198
|
+
return 'replace';
|
199
|
+
},
|
200
|
+
|
201
|
+
_object : function(el) {
|
202
|
+
var raw_arr = this.parse_data_attr(el),
|
203
|
+
scenarios = [], count = raw_arr.length;
|
204
|
+
|
205
|
+
if (count > 0) {
|
206
|
+
for (var i = count - 1; i >= 0; i--) {
|
207
|
+
var split = raw_arr[i].split(/\((.*?)(\))$/);
|
208
|
+
|
209
|
+
if (split.length > 1) {
|
210
|
+
var cached_split = split[0].split(','),
|
211
|
+
params = this.parse_params(cached_split[0],
|
212
|
+
cached_split[1], split[1]);
|
213
|
+
|
214
|
+
scenarios.push(params);
|
215
|
+
}
|
216
|
+
}
|
217
|
+
}
|
218
|
+
|
219
|
+
return this.store(el, scenarios);
|
220
|
+
},
|
221
|
+
|
222
|
+
uuid : function (separator) {
|
223
|
+
var delim = separator || "-";
|
224
|
+
|
225
|
+
function S4() {
|
226
|
+
return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1);
|
227
|
+
}
|
228
|
+
|
229
|
+
return (S4() + S4() + delim + S4() + delim + S4()
|
230
|
+
+ delim + S4() + delim + S4() + S4() + S4());
|
231
|
+
},
|
232
|
+
|
233
|
+
store : function (el, scenarios) {
|
234
|
+
var uuid = this.uuid(),
|
235
|
+
current_uuid = el.data('uuid');
|
236
|
+
|
237
|
+
if (current_uuid) return this.cache[current_uuid];
|
238
|
+
|
239
|
+
el.attr('data-uuid', uuid);
|
240
|
+
|
241
|
+
return this.cache[uuid] = scenarios;
|
242
|
+
},
|
243
|
+
|
244
|
+
trim : function(str) {
|
245
|
+
if (typeof str === 'string') {
|
246
|
+
return $.trim(str);
|
247
|
+
}
|
248
|
+
|
249
|
+
return str;
|
250
|
+
},
|
251
|
+
|
252
|
+
parse_data_attr : function (el) {
|
253
|
+
var raw = el.data(this.settings.load_attr).split(/\[(.*?)\]/),
|
254
|
+
count = raw.length, output = [];
|
255
|
+
|
256
|
+
for (var i = count - 1; i >= 0; i--) {
|
257
|
+
if (raw[i].replace(/[\W\d]+/, '').length > 4) {
|
258
|
+
output.push(raw[i]);
|
259
|
+
}
|
260
|
+
}
|
261
|
+
|
262
|
+
return output;
|
263
|
+
},
|
264
|
+
|
265
|
+
reflow : function () {
|
266
|
+
this.images(true);
|
267
|
+
}
|
268
|
+
|
269
|
+
};
|
270
|
+
|
271
|
+
}(Foundation.zj, this, this.document));
|