luca 0.9.2 → 0.9.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +1 -0
- data/.rvmrc +1 -1
- data/CHANGELOG +46 -2
- data/Gemfile +1 -1
- data/Gemfile.lock +2 -2
- data/Guardfile +1 -1
- data/README.md +64 -27
- data/ROADMAP +17 -2
- data/Rakefile +49 -1
- data/app.rb +38 -2
- data/assets/javascripts/luca-ui-base.coffee +1 -20
- data/assets/javascripts/luca-ui-full.js +3 -0
- data/assets/javascripts/luca-ui.coffee +0 -5
- data/assets/javascripts/sandbox/application.coffee +24 -18
- data/assets/javascripts/sandbox/router.coffee +16 -6
- data/assets/javascripts/sandbox/templates/builder/component_list.luca +1 -0
- data/assets/javascripts/sandbox/templates/builder.luca +2 -0
- data/assets/javascripts/sandbox/templates/main.luca +4 -3
- data/assets/javascripts/sandbox/templates/sandbox/docs_index.luca +1 -0
- data/assets/javascripts/sandbox/templates/sandbox/navigation.luca +6 -1
- data/assets/javascripts/sandbox/templates/sandbox/readme.luca +30 -0
- data/assets/javascripts/sandbox/views/builder/builder_canvas.coffee +3 -0
- data/assets/javascripts/sandbox/views/builder/builder_editor.coffee +6 -0
- data/assets/javascripts/sandbox/views/builder/component_list.coffee +38 -0
- data/assets/javascripts/sandbox/views/builder/project_browser.coffee +14 -0
- data/assets/javascripts/sandbox/views/builder.coffee +133 -0
- data/assets/javascripts/sandbox/views/docs_controller.coffee +7 -0
- data/assets/javascripts/sandbox/views/inspector/instance_filter.coffee +18 -0
- data/assets/javascripts/sandbox/{collections/sample.coffee → views/inspector/instance_list.coffee} +0 -0
- data/assets/javascripts/sandbox/views/inspector.coffee +11 -0
- data/assets/javascripts/sandbox.coffee +2 -0
- data/assets/stylesheets/luca-ui-full.css +3 -0
- data/assets/stylesheets/sandbox/builder.scss +79 -0
- data/assets/stylesheets/sandbox/sandbox.scss +2 -1
- data/docs/application.md +41 -0
- data/docs/collection.md +79 -0
- data/docs/collection_manager.md +76 -0
- data/docs/container_philosophy.md +122 -0
- data/docs/event_binding_helpers.md +164 -0
- data/docs/method_caching_and_computed_properties.md +77 -0
- data/docs/view.md +119 -0
- data/lib/luca/rails/version.rb +1 -1
- data/lib/luca/template.rb +9 -9
- data/site/assets/bootstrap.min.js +7 -0
- data/site/assets/luca-ui-bootstrap.css +19 -1
- data/site/assets/luca-ui-development-tools.css +10 -0
- data/site/assets/luca-ui-development-tools.min.js +15 -0
- data/site/assets/luca-ui-full.min.js +8 -0
- data/site/assets/luca-ui.min.js +4 -0
- data/site/assets/sandbox.css +52 -4
- data/site/assets/sandbox.js +368 -30
- data/site/docs/application.html +41 -0
- data/site/docs/caching.html +43 -0
- data/site/docs/collection.html +75 -0
- data/site/docs/collection_manager.html +71 -0
- data/site/docs/containers.html +118 -0
- data/site/docs/events.html +153 -0
- data/site/docs/view.html +128 -0
- data/site/img/glyphicons-halflings-white.png +0 -0
- data/site/img/glyphicons-halflings.png +0 -0
- data/site/source-map.js +1 -0
- data/spec/core/view_spec.coffee +5 -17
- data/spec/managers/collection_manager_spec.coffee +4 -7
- data/src/components/application.coffee +202 -77
- data/src/components/base_toolbar.coffee +1 -1
- data/src/components/collection_view.coffee +38 -10
- data/src/components/controller.coffee +24 -1
- data/src/components/fields/checkbox_field.coffee +9 -12
- data/src/components/fields/label_field.coffee +14 -0
- data/src/components/fields/select_field.coffee +2 -2
- data/src/components/fields/text_field.coffee +12 -7
- data/src/components/fields/type_ahead_field.coffee +1 -0
- data/src/components/form_view.coffee +44 -25
- data/src/components/page_controller.coffee +2 -0
- data/src/containers/card_view.coffee +4 -1
- data/src/containers/column_view.coffee +2 -1
- data/src/containers/modal_view.coffee +6 -2
- data/src/containers/page_view.coffee +2 -0
- data/src/containers/panel_toolbar.coffee +0 -5
- data/src/containers/viewport.coffee +28 -10
- data/src/core/collection.coffee +7 -1
- data/src/core/container.coffee +57 -30
- data/src/core/core.coffee +0 -186
- data/src/core/field.coffee +11 -3
- data/src/core/model.coffee +31 -16
- data/src/core/panel.coffee +6 -46
- data/src/core/registry.coffee +19 -2
- data/src/core/script_loader.coffee +32 -0
- data/src/core/view.coffee +112 -139
- data/src/define.coffee +110 -0
- data/src/framework.coffee +8 -2
- data/src/luca.coffee +22 -0
- data/src/managers/collection_manager.coffee +65 -31
- data/src/modules/load_mask.coffee +47 -0
- data/src/plugins/development_tool_helpers.coffee +21 -0
- data/src/plugins/events.coffee +54 -0
- data/src/stylesheets/components/viewport.scss +15 -0
- data/src/stylesheets/containers/container.scss +1 -4
- data/src/stylesheets/tools/component_tester.scss +18 -0
- data/src/templates/fields/select_field.luca +6 -5
- data/src/templates/fields/text_field.luca +10 -9
- data/src/tools/application_inspector.coffee +2 -0
- data/src/tools/coffee_script_editor.coffee +28 -6
- data/src/tools/collections/components.coffee +59 -0
- data/src/tools/collections/instances.coffee +15 -0
- data/src/tools/component_tester.coffee +12 -22
- data/src/tools/console.coffee +22 -4
- data/src/tools/models/components.coffee +16 -54
- data/src/tools/models/instance.coffee +2 -0
- data/src/{core/util.coffee → util.coffee} +10 -1
- data/vendor/assets/javascripts/luca-ui-base.js +132 -137
- data/vendor/assets/javascripts/luca-ui-development-tools.js +191 -219
- data/vendor/assets/javascripts/luca-ui-development-tools.min.js +2 -2
- data/vendor/assets/javascripts/luca-ui-full.js +4680 -0
- data/vendor/assets/javascripts/luca-ui-full.min.js +8 -0
- data/vendor/assets/javascripts/luca-ui-spec.js +291 -225
- data/vendor/assets/javascripts/luca-ui.js +1001 -724
- data/vendor/assets/javascripts/luca-ui.min.js +4 -4
- data/vendor/assets/stylesheets/luca-ui-bootstrap.css +19 -1
- data/vendor/assets/stylesheets/luca-ui-development-tools.css +10 -0
- data/vendor/assets/stylesheets/luca-ui-full.css +1334 -0
- data/vendor/assets/stylesheets/luca-ui-spec.css +19 -1
- data/vendor/assets/stylesheets/luca-ui.css +19 -1
- data/views/index.erb +2 -5
- metadata +58 -9
- data/lib/sprockets/luca_template.rb +0 -49
- data/src/tools/class_browser.coffee +0 -39
- data/src/tools/components/class_browser_detail.coffee +0 -10
- data/src/tools/components/class_browser_list.coffee +0 -74
|
@@ -1,63 +1,25 @@
|
|
|
1
|
-
_.def("Luca.
|
|
2
|
-
url: ()->
|
|
3
|
-
"/components?component=#{ @get('className') }"
|
|
4
|
-
|
|
1
|
+
_.def("Luca.app.Component").extends("Luca.Model").with
|
|
5
2
|
root: ()->
|
|
6
3
|
@get("className").split('.')[0]
|
|
7
4
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
parts = @get("className").split('.')
|
|
12
|
-
parts.pop()
|
|
13
|
-
parts.join "."
|
|
14
|
-
|
|
15
|
-
_.def('Luca.collections.Components').extends('Luca.Collection').with
|
|
16
|
-
model: Luca.models.Component
|
|
17
|
-
|
|
18
|
-
cachedMethods: [
|
|
19
|
-
"namespaces"
|
|
20
|
-
"classes"
|
|
21
|
-
"roots"
|
|
22
|
-
]
|
|
23
|
-
|
|
24
|
-
cache_key: "luca_components"
|
|
5
|
+
className: ()->
|
|
6
|
+
@get("className")
|
|
25
7
|
|
|
26
|
-
|
|
8
|
+
instances: ()->
|
|
9
|
+
Luca.registry.findInstancesByClassName @className()
|
|
27
10
|
|
|
28
|
-
|
|
29
|
-
|
|
11
|
+
definitionPrototype: ()->
|
|
12
|
+
@definition()?.prototype
|
|
30
13
|
|
|
31
|
-
|
|
32
|
-
Luca.
|
|
14
|
+
parentClasses: ()->
|
|
15
|
+
Luca.parentClasses( @className() )
|
|
33
16
|
|
|
34
|
-
|
|
17
|
+
definition: ()->
|
|
18
|
+
Luca.util.resolve @className()
|
|
35
19
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
roots: ()->
|
|
40
|
-
_.uniq( @invoke("root") )
|
|
41
|
-
|
|
42
|
-
namespaces: ()->
|
|
43
|
-
_.uniq( @invoke("namespace") )
|
|
44
|
-
|
|
45
|
-
asTree: ()->
|
|
46
|
-
classes = @classes()
|
|
47
|
-
namespaces = @namespaces()
|
|
48
|
-
roots = @roots()
|
|
49
|
-
|
|
50
|
-
tree = _( roots ).inject (memo,root)->
|
|
51
|
-
memo[ root ] ||= {}
|
|
52
|
-
regexp = new RegExp("^#{ root }")
|
|
53
|
-
memo[root] = _( namespaces ).select (namespace)->
|
|
54
|
-
regexp.exec(namespace) and _( namespaces ).include(namespace) and namespace.split('.').length is 2
|
|
55
|
-
memo
|
|
56
|
-
, {}
|
|
20
|
+
namespace: ()->
|
|
21
|
+
return "" unless @get("className")?
|
|
57
22
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
memo[root][namespace] = {}
|
|
62
|
-
memo
|
|
63
|
-
, {}
|
|
23
|
+
parts = @get("className").split('.')
|
|
24
|
+
parts.pop()
|
|
25
|
+
parts.join "."
|
|
@@ -83,6 +83,15 @@ Luca.util.loadScript = (url, callback) ->
|
|
|
83
83
|
|
|
84
84
|
Luca.util.make = Backbone.View::make
|
|
85
85
|
|
|
86
|
+
Luca.util.list = (list,options={},ordered)->
|
|
87
|
+
container = if ordered then "ol" else "ul"
|
|
88
|
+
container = Luca.util.make(container,options)
|
|
89
|
+
if _.isArray(list)
|
|
90
|
+
for item in list
|
|
91
|
+
$(container).append Luca.util.make("li",{},item)
|
|
92
|
+
|
|
93
|
+
container.outerHTML
|
|
94
|
+
|
|
86
95
|
# generates a badge element
|
|
87
96
|
# valid types are success, warning, important, info, inverse
|
|
88
97
|
Luca.util.label = (contents="", type, baseClass="label")->
|
|
@@ -95,4 +104,4 @@ Luca.util.label = (contents="", type, baseClass="label")->
|
|
|
95
104
|
Luca.util.badge = (contents="", type, baseClass="badge")->
|
|
96
105
|
cssClass = baseClass
|
|
97
106
|
cssClass += " #{ baseClass }-#{ type }" if type?
|
|
98
|
-
Luca.util.make("span",{class:cssClass},contents)
|
|
107
|
+
Luca.util.make("span",{class:cssClass},contents)
|
|
@@ -25,7 +25,8 @@
|
|
|
25
25
|
modules: {},
|
|
26
26
|
util: {},
|
|
27
27
|
fields: {},
|
|
28
|
-
registry: {}
|
|
28
|
+
registry: {},
|
|
29
|
+
options: {}
|
|
29
30
|
});
|
|
30
31
|
|
|
31
32
|
_.extend(Luca, Backbone.Events);
|
|
@@ -71,26 +72,32 @@
|
|
|
71
72
|
};
|
|
72
73
|
|
|
73
74
|
Luca.isBackboneModel = function(obj) {
|
|
75
|
+
if (_.isString(obj)) obj = Luca.util.resolve(obj);
|
|
74
76
|
return _.isFunction(obj != null ? obj.set : void 0) && _.isFunction(obj != null ? obj.get : void 0) && _.isObject(obj != null ? obj.attributes : void 0);
|
|
75
77
|
};
|
|
76
78
|
|
|
77
79
|
Luca.isBackboneView = function(obj) {
|
|
80
|
+
if (_.isString(obj)) obj = Luca.util.resolve(obj);
|
|
78
81
|
return _.isFunction(obj != null ? obj.render : void 0) && !_.isUndefined(obj != null ? obj.el : void 0);
|
|
79
82
|
};
|
|
80
83
|
|
|
81
84
|
Luca.isBackboneCollection = function(obj) {
|
|
85
|
+
if (_.isString(obj)) obj = Luca.util.resolve(obj);
|
|
82
86
|
return _.isFunction(obj != null ? obj.fetch : void 0) && _.isFunction(obj != null ? obj.reset : void 0);
|
|
83
87
|
};
|
|
84
88
|
|
|
85
89
|
Luca.isViewPrototype = function(obj) {
|
|
90
|
+
if (_.isString(obj)) obj = Luca.util.resolve(obj);
|
|
86
91
|
return (obj != null) && (obj.prototype != null) && (obj.prototype.make != null) && (obj.prototype.$ != null) && (obj.prototype.render != null);
|
|
87
92
|
};
|
|
88
93
|
|
|
89
94
|
Luca.isModelPrototype = function(obj) {
|
|
95
|
+
if (_.isString(obj)) obj = Luca.util.resolve(obj);
|
|
90
96
|
return (obj != null) && (typeof obj.prototype === "function" ? obj.prototype((obj.prototype.save != null) && (obj.prototype.changedAttributes != null)) : void 0);
|
|
91
97
|
};
|
|
92
98
|
|
|
93
99
|
Luca.isCollectionPrototype = function(obj) {
|
|
100
|
+
if (_.isString(obj)) obj = Luca.util.resolve(obj);
|
|
94
101
|
return (obj != null) && (obj.prototype != null) && !Luca.isModelPrototype(obj) && (obj.prototype.reset != null) && (obj.prototype.select != null) && (obj.prototype.reject != null);
|
|
95
102
|
};
|
|
96
103
|
|
|
@@ -219,6 +226,64 @@
|
|
|
219
226
|
|
|
220
227
|
_.mixin(UnderscoreExtensions);
|
|
221
228
|
|
|
229
|
+
}).call(this);
|
|
230
|
+
(function() {
|
|
231
|
+
var DeferredBindingProxy;
|
|
232
|
+
|
|
233
|
+
DeferredBindingProxy = (function() {
|
|
234
|
+
|
|
235
|
+
function DeferredBindingProxy(object, operation, wrapWithUnderscore) {
|
|
236
|
+
var fn,
|
|
237
|
+
_this = this;
|
|
238
|
+
this.object = object;
|
|
239
|
+
if (wrapWithUnderscore == null) wrapWithUnderscore = true;
|
|
240
|
+
if (_.isFunction(operation)) {
|
|
241
|
+
fn = operation;
|
|
242
|
+
} else if (_.isString(operation) && _.isFunction(this.object[operation])) {
|
|
243
|
+
fn = this.object[operation];
|
|
244
|
+
}
|
|
245
|
+
if (!_.isFunction(fn)) {
|
|
246
|
+
throw "Must pass a function or a string representing one";
|
|
247
|
+
}
|
|
248
|
+
if (wrapWithUnderscore === true) {
|
|
249
|
+
this.fn = function() {
|
|
250
|
+
return _.defer(fn);
|
|
251
|
+
};
|
|
252
|
+
} else {
|
|
253
|
+
this.fn = fn;
|
|
254
|
+
}
|
|
255
|
+
this;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
DeferredBindingProxy.prototype.until = function(watch, trigger) {
|
|
259
|
+
if ((watch != null) && !(trigger != null)) {
|
|
260
|
+
trigger = watch;
|
|
261
|
+
watch = this.object;
|
|
262
|
+
}
|
|
263
|
+
watch.once(trigger, this.fn);
|
|
264
|
+
return this.object;
|
|
265
|
+
};
|
|
266
|
+
|
|
267
|
+
return DeferredBindingProxy;
|
|
268
|
+
|
|
269
|
+
})();
|
|
270
|
+
|
|
271
|
+
Luca.Events = {
|
|
272
|
+
defer: function(operation, wrapWithUnderscore) {
|
|
273
|
+
if (wrapWithUnderscore == null) wrapWithUnderscore = true;
|
|
274
|
+
return new DeferredBindingProxy(this, operation, wrapWithUnderscore);
|
|
275
|
+
},
|
|
276
|
+
once: function(trigger, callback, context) {
|
|
277
|
+
var onceFn;
|
|
278
|
+
context || (context = this);
|
|
279
|
+
onceFn = function() {
|
|
280
|
+
callback.apply(context, arguments);
|
|
281
|
+
return this.unbind(trigger, onceFn);
|
|
282
|
+
};
|
|
283
|
+
return this.bind(trigger, onceFn);
|
|
284
|
+
}
|
|
285
|
+
};
|
|
286
|
+
|
|
222
287
|
}).call(this);
|
|
223
288
|
(function() {
|
|
224
289
|
var currentNamespace;
|
|
@@ -330,7 +395,7 @@
|
|
|
330
395
|
|
|
331
396
|
}).call(this);
|
|
332
397
|
(function() {
|
|
333
|
-
var
|
|
398
|
+
var DefineProxy;
|
|
334
399
|
|
|
335
400
|
Luca.define = function(componentName) {
|
|
336
401
|
return new DefineProxy(componentName);
|
|
@@ -379,7 +444,7 @@
|
|
|
379
444
|
};
|
|
380
445
|
|
|
381
446
|
DefineProxy.prototype["with"] = function(properties) {
|
|
382
|
-
var at, componentType;
|
|
447
|
+
var at, componentType, _base;
|
|
383
448
|
at = this.namespaced ? Luca.util.resolve(this.namespace, window || global) : window || global;
|
|
384
449
|
if (this.namespaced && !(at != null)) {
|
|
385
450
|
eval("(window||global)." + this.namespace + " = {}");
|
|
@@ -389,6 +454,8 @@
|
|
|
389
454
|
if (Luca.autoRegister === true) {
|
|
390
455
|
if (Luca.isViewPrototype(at[this.componentId])) componentType = "view";
|
|
391
456
|
if (Luca.isCollectionPrototype(at[this.componentId])) {
|
|
457
|
+
(_base = Luca.Collection).namespaces || (_base.namespaces = []);
|
|
458
|
+
Luca.Collection.namespaces.push(this.namespace);
|
|
392
459
|
componentType = "collection";
|
|
393
460
|
}
|
|
394
461
|
if (Luca.isModelPrototype(at[this.componentId])) componentType = "model";
|
|
@@ -424,107 +491,6 @@
|
|
|
424
491
|
def: Luca.define
|
|
425
492
|
});
|
|
426
493
|
|
|
427
|
-
DeferredBindingProxy = (function() {
|
|
428
|
-
|
|
429
|
-
function DeferredBindingProxy(object, operation, wrapWithUnderscore) {
|
|
430
|
-
var fn,
|
|
431
|
-
_this = this;
|
|
432
|
-
this.object = object;
|
|
433
|
-
if (wrapWithUnderscore == null) wrapWithUnderscore = true;
|
|
434
|
-
if (_.isFunction(operation)) {
|
|
435
|
-
fn = operation;
|
|
436
|
-
} else if (_.isString(operation) && _.isFunction(this.object[operation])) {
|
|
437
|
-
fn = this.object[operation];
|
|
438
|
-
}
|
|
439
|
-
if (!_.isFunction(fn)) {
|
|
440
|
-
throw "Must pass a function or a string representing one";
|
|
441
|
-
}
|
|
442
|
-
if (wrapWithUnderscore === true) {
|
|
443
|
-
this.fn = function() {
|
|
444
|
-
return _.defer(fn);
|
|
445
|
-
};
|
|
446
|
-
} else {
|
|
447
|
-
this.fn = fn;
|
|
448
|
-
}
|
|
449
|
-
this;
|
|
450
|
-
}
|
|
451
|
-
|
|
452
|
-
DeferredBindingProxy.prototype.until = function(watch, trigger) {
|
|
453
|
-
if ((watch != null) && !(trigger != null)) {
|
|
454
|
-
trigger = watch;
|
|
455
|
-
watch = this.object;
|
|
456
|
-
}
|
|
457
|
-
watch.once(trigger, this.fn);
|
|
458
|
-
return this.object;
|
|
459
|
-
};
|
|
460
|
-
|
|
461
|
-
return DeferredBindingProxy;
|
|
462
|
-
|
|
463
|
-
})();
|
|
464
|
-
|
|
465
|
-
Luca.Events = {
|
|
466
|
-
defer: function(operation, wrapWithUnderscore) {
|
|
467
|
-
if (wrapWithUnderscore == null) wrapWithUnderscore = true;
|
|
468
|
-
return new DeferredBindingProxy(this, operation, wrapWithUnderscore);
|
|
469
|
-
},
|
|
470
|
-
once: function(trigger, callback, context) {
|
|
471
|
-
var onceFn;
|
|
472
|
-
context || (context = this);
|
|
473
|
-
onceFn = function() {
|
|
474
|
-
callback.apply(context, arguments);
|
|
475
|
-
return this.unbind(trigger, onceFn);
|
|
476
|
-
};
|
|
477
|
-
return this.bind(trigger, onceFn);
|
|
478
|
-
}
|
|
479
|
-
};
|
|
480
|
-
|
|
481
|
-
Luca.ScriptLoader = (function() {
|
|
482
|
-
|
|
483
|
-
ScriptLoader.loaded = {};
|
|
484
|
-
|
|
485
|
-
function ScriptLoader(options) {
|
|
486
|
-
var ready;
|
|
487
|
-
if (options == null) options = {};
|
|
488
|
-
_.extend(this, Backbone.Events, Luca.Events);
|
|
489
|
-
this.autoStart = options.autoStart === true;
|
|
490
|
-
this.scripts = options.scripts;
|
|
491
|
-
ready = function() {
|
|
492
|
-
return this.trigger("ready");
|
|
493
|
-
};
|
|
494
|
-
this.ready = _.after(this.scripts.length, ready);
|
|
495
|
-
_.bindAll(this, "load", "ready");
|
|
496
|
-
this.defer("load").until(this, "start");
|
|
497
|
-
if (this.autoStart === true) this.trigger("start");
|
|
498
|
-
this.bind("ready", this.onReady);
|
|
499
|
-
}
|
|
500
|
-
|
|
501
|
-
ScriptLoader.prototype.applyPrefix = function(script) {
|
|
502
|
-
return script;
|
|
503
|
-
};
|
|
504
|
-
|
|
505
|
-
ScriptLoader.prototype.onReady = function() {
|
|
506
|
-
return console.log("All dependencies loaded");
|
|
507
|
-
};
|
|
508
|
-
|
|
509
|
-
ScriptLoader.prototype.start = function() {
|
|
510
|
-
return this.trigger("start");
|
|
511
|
-
};
|
|
512
|
-
|
|
513
|
-
ScriptLoader.prototype.load = function() {
|
|
514
|
-
var script, _i, _len, _ref, _results;
|
|
515
|
-
_ref = this.scripts;
|
|
516
|
-
_results = [];
|
|
517
|
-
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
|
518
|
-
script = _ref[_i];
|
|
519
|
-
_results.push(Luca.util.loadScript(this.applyPrefix(script), this.ready));
|
|
520
|
-
}
|
|
521
|
-
return _results;
|
|
522
|
-
};
|
|
523
|
-
|
|
524
|
-
return ScriptLoader;
|
|
525
|
-
|
|
526
|
-
})();
|
|
527
|
-
|
|
528
494
|
}).call(this);
|
|
529
495
|
(function() {
|
|
530
496
|
var component_cache, registry;
|
|
@@ -608,7 +574,7 @@
|
|
|
608
574
|
|
|
609
575
|
Luca.registry.classes = function(toString) {
|
|
610
576
|
if (toString == null) toString = false;
|
|
611
|
-
return _(registry.classes).map(function(className, ctype) {
|
|
577
|
+
return _(_.extend({}, registry.classes, registry.model_classes, registry.collection_classes)).map(function(className, ctype) {
|
|
612
578
|
if (toString) {
|
|
613
579
|
return className;
|
|
614
580
|
} else {
|
|
@@ -641,7 +607,9 @@
|
|
|
641
607
|
var customizeRender, originalExtend;
|
|
642
608
|
|
|
643
609
|
_.def("Luca.View")["extends"]("Backbone.View")["with"]({
|
|
610
|
+
include: ['Luca.Events'],
|
|
644
611
|
additionalClassNames: [],
|
|
612
|
+
hooks: ["after:initialize", "before:render", "after:render", "first:activation", "activation", "deactivation"],
|
|
645
613
|
debug: function() {
|
|
646
614
|
var message, _i, _len, _results;
|
|
647
615
|
if (!(this.debugMode || (window.LucaDebugMode != null))) return;
|
|
@@ -663,7 +631,6 @@
|
|
|
663
631
|
}
|
|
664
632
|
return Backbone.View.prototype.trigger.apply(this, arguments);
|
|
665
633
|
},
|
|
666
|
-
hooks: ["after:initialize", "before:render", "after:render", "first:activation", "activation", "deactivation"],
|
|
667
634
|
initialize: function(options) {
|
|
668
635
|
var additional, template, unique, _i, _len, _ref;
|
|
669
636
|
this.options = options != null ? options : {};
|
|
@@ -687,6 +654,7 @@
|
|
|
687
654
|
this.$el.addClass(additional);
|
|
688
655
|
}
|
|
689
656
|
}
|
|
657
|
+
if (this.wrapperClass != null) this.$wrap(this.wrapperClass);
|
|
690
658
|
this.trigger("after:initialize", this);
|
|
691
659
|
this.registerCollectionEvents();
|
|
692
660
|
return this.delegateEvents();
|
|
@@ -859,29 +827,35 @@
|
|
|
859
827
|
|
|
860
828
|
}).call(this);
|
|
861
829
|
(function() {
|
|
830
|
+
var setupComputedProperties;
|
|
831
|
+
|
|
832
|
+
setupComputedProperties = function() {
|
|
833
|
+
var attr, dependencies, _ref, _results,
|
|
834
|
+
_this = this;
|
|
835
|
+
if (_.isUndefined(this.computed)) return;
|
|
836
|
+
this._computed = {};
|
|
837
|
+
_ref = this.computed;
|
|
838
|
+
_results = [];
|
|
839
|
+
for (attr in _ref) {
|
|
840
|
+
dependencies = _ref[attr];
|
|
841
|
+
this.on("change:" + attr, function() {
|
|
842
|
+
return _this._computed[attr] = _this[attr].call(_this);
|
|
843
|
+
});
|
|
844
|
+
_results.push(_(dependencies).each(function(dep) {
|
|
845
|
+
_this.on("change:" + dep, function() {
|
|
846
|
+
return _this.trigger("change:" + attr);
|
|
847
|
+
});
|
|
848
|
+
if (_this.has(dep)) return _this.trigger("change:" + attr);
|
|
849
|
+
}));
|
|
850
|
+
}
|
|
851
|
+
return _results;
|
|
852
|
+
};
|
|
862
853
|
|
|
863
854
|
_.def('Luca.Model')["extends"]('Backbone.Model')["with"]({
|
|
855
|
+
include: ['Luca.Events'],
|
|
864
856
|
initialize: function() {
|
|
865
|
-
var attr, dependencies, _ref, _results,
|
|
866
|
-
_this = this;
|
|
867
857
|
Backbone.Model.prototype.initialize(this, arguments);
|
|
868
|
-
|
|
869
|
-
this._computed = {};
|
|
870
|
-
_ref = this.computed;
|
|
871
|
-
_results = [];
|
|
872
|
-
for (attr in _ref) {
|
|
873
|
-
dependencies = _ref[attr];
|
|
874
|
-
this.on("change:" + attr, function() {
|
|
875
|
-
return _this._computed[attr] = _this[attr].call(_this);
|
|
876
|
-
});
|
|
877
|
-
_results.push(_(dependencies).each(function(dep) {
|
|
878
|
-
_this.on("change:" + dep, function() {
|
|
879
|
-
return _this.trigger("change:" + attr);
|
|
880
|
-
});
|
|
881
|
-
if (_this.has(dep)) return _this.trigger("change:" + attr);
|
|
882
|
-
}));
|
|
883
|
-
}
|
|
884
|
-
return _results;
|
|
858
|
+
return setupComputedProperties.call(this);
|
|
885
859
|
},
|
|
886
860
|
get: function(attr) {
|
|
887
861
|
var _ref;
|
|
@@ -902,6 +876,7 @@
|
|
|
902
876
|
if (Backbone.QueryCollection != null) source = 'Backbone.QueryCollection';
|
|
903
877
|
|
|
904
878
|
_.def("Luca.Collection")["extends"](source)["with"]({
|
|
879
|
+
include: ['Luca.Events'],
|
|
905
880
|
cachedMethods: [],
|
|
906
881
|
remoteFilter: false,
|
|
907
882
|
initialize: function(models, options) {
|
|
@@ -1839,6 +1814,12 @@
|
|
|
1839
1814
|
}
|
|
1840
1815
|
});
|
|
1841
1816
|
},
|
|
1817
|
+
pluck: function(attribute) {
|
|
1818
|
+
return _(this.components).pluck(attribute);
|
|
1819
|
+
},
|
|
1820
|
+
invoke: function(method) {
|
|
1821
|
+
return _(this.components).invoke(method);
|
|
1822
|
+
},
|
|
1842
1823
|
select: function(attribute, value, deep) {
|
|
1843
1824
|
var components;
|
|
1844
1825
|
if (deep == null) deep = false;
|
|
@@ -1847,8 +1828,8 @@
|
|
|
1847
1828
|
matches = [];
|
|
1848
1829
|
test = component[attribute];
|
|
1849
1830
|
if (test === value) matches.push(component);
|
|
1850
|
-
if (deep === true
|
|
1851
|
-
matches.push(component.select(attribute, value, true));
|
|
1831
|
+
if (deep === true) {
|
|
1832
|
+
matches.push(typeof component.select === "function" ? component.select(attribute, value, true) : void 0);
|
|
1852
1833
|
}
|
|
1853
1834
|
return _.compact(matches);
|
|
1854
1835
|
});
|
|
@@ -2025,10 +2006,17 @@
|
|
|
2025
2006
|
};
|
|
2026
2007
|
|
|
2027
2008
|
CollectionManager.prototype.guessCollectionClass = function(key) {
|
|
2028
|
-
var classified, guess;
|
|
2009
|
+
var classified, guess, guesses, _ref;
|
|
2029
2010
|
classified = Luca.util.classify(key);
|
|
2030
2011
|
guess = (this.collectionNamespace || (window || global))[classified];
|
|
2031
2012
|
guess || (guess = (this.collectionNamespace || (window || global))["" + classified + "Collection"]);
|
|
2013
|
+
if (!(guess != null) && ((_ref = Luca.Collection.namespaces) != null ? _ref.length : void 0) > 0) {
|
|
2014
|
+
guesses = _(Luca.Collection.namespaces.reverse()).map(function(namespace) {
|
|
2015
|
+
return Luca.util.resolve("" + namespace + "." + classified) || Luca.util.resolve("" + namespace + "." + classified + "Collection");
|
|
2016
|
+
});
|
|
2017
|
+
guesses = _(guesses).compact();
|
|
2018
|
+
if (guesses.length > 0) guess = guesses[0];
|
|
2019
|
+
}
|
|
2032
2020
|
return guess;
|
|
2033
2021
|
};
|
|
2034
2022
|
|
|
@@ -2235,7 +2223,8 @@
|
|
|
2235
2223
|
return this.activeComponent().trigger("first:activation", this, this.activeComponent());
|
|
2236
2224
|
},
|
|
2237
2225
|
activate: function(index, silent, callback) {
|
|
2238
|
-
var current, previous, _ref, _ref2, _ref3, _ref4
|
|
2226
|
+
var current, previous, _ref, _ref2, _ref3, _ref4,
|
|
2227
|
+
_this = this;
|
|
2239
2228
|
if (silent == null) silent = false;
|
|
2240
2229
|
if (_.isFunction(silent)) {
|
|
2241
2230
|
silent = false;
|
|
@@ -2261,6 +2250,9 @@
|
|
|
2261
2250
|
_ref2.apply(previous, ["before:activation", this, previous, current]);
|
|
2262
2251
|
}
|
|
2263
2252
|
}
|
|
2253
|
+
_.defer(function() {
|
|
2254
|
+
return _this.$el.data(_this.activeAttribute || "active-card", current.name);
|
|
2255
|
+
});
|
|
2264
2256
|
}
|
|
2265
2257
|
this.componentElements().hide();
|
|
2266
2258
|
if (!current.previously_activated) {
|
|
@@ -2442,9 +2434,6 @@
|
|
|
2442
2434
|
return _(elements).each(function(element) {
|
|
2443
2435
|
return _this.$el.append(element);
|
|
2444
2436
|
});
|
|
2445
|
-
},
|
|
2446
|
-
afterRender: function() {
|
|
2447
|
-
return this._super("afterRender", this, arguments);
|
|
2448
2437
|
}
|
|
2449
2438
|
});
|
|
2450
2439
|
|
|
@@ -2577,7 +2566,7 @@
|
|
|
2577
2566
|
|
|
2578
2567
|
_.def('Luca.containers.Viewport').extend('Luca.containers.CardView')["with"]({
|
|
2579
2568
|
activeItem: 0,
|
|
2580
|
-
|
|
2569
|
+
additionalClassNames: 'luca-ui-viewport',
|
|
2581
2570
|
fullscreen: true,
|
|
2582
2571
|
fluid: false,
|
|
2583
2572
|
wrapperClass: 'row',
|
|
@@ -2585,8 +2574,9 @@
|
|
|
2585
2574
|
this.options = options != null ? options : {};
|
|
2586
2575
|
_.extend(this, this.options);
|
|
2587
2576
|
if (Luca.enableBootstrap === true) {
|
|
2588
|
-
if (this.fluid === true)
|
|
2589
|
-
|
|
2577
|
+
if (this.fluid === true) {
|
|
2578
|
+
this.wrapperClass = "row-fluid fluid-viewport-wrapper";
|
|
2579
|
+
}
|
|
2590
2580
|
}
|
|
2591
2581
|
Luca.core.Container.prototype.initialize.apply(this, arguments);
|
|
2592
2582
|
if (this.fullscreen) return $('html,body').addClass('luca-ui-fullscreen');
|
|
@@ -2604,8 +2594,8 @@
|
|
|
2604
2594
|
if ((_ref = Luca.containers.CardView.prototype.after) != null) {
|
|
2605
2595
|
_ref.apply(this, arguments);
|
|
2606
2596
|
}
|
|
2607
|
-
if (Luca.enableBootstrap === true) {
|
|
2608
|
-
return this.$el.children().wrap('<div class="
|
|
2597
|
+
if (Luca.enableBootstrap === true && this.containerClassName) {
|
|
2598
|
+
return this.$el.children().wrap('<div class="#{ containerClassName }" />');
|
|
2609
2599
|
}
|
|
2610
2600
|
},
|
|
2611
2601
|
renderTopNavigation: function() {
|
|
@@ -2631,4 +2621,9 @@
|
|
|
2631
2621
|
|
|
2632
2622
|
|
|
2633
2623
|
|
|
2624
|
+
}).call(this);
|
|
2625
|
+
(function() {
|
|
2626
|
+
|
|
2627
|
+
|
|
2628
|
+
|
|
2634
2629
|
}).call(this);
|