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
|
@@ -17243,28 +17243,8 @@ if (!CodeMirror.mimeModes.hasOwnProperty("text/css"))
|
|
|
17243
17243
|
})();
|
|
17244
17244
|
(function() {
|
|
17245
17245
|
|
|
17246
|
-
_.def("Luca.tools.
|
|
17247
|
-
name: "
|
|
17248
|
-
className: "luca-class-browser row",
|
|
17249
|
-
layout: ["span3", "span9"],
|
|
17250
|
-
components: ["class_browser_list", "class_browser_detail"],
|
|
17251
|
-
componentEvents: {
|
|
17252
|
-
"class_browser_list component:loaded": "loadSourceCode"
|
|
17253
|
-
},
|
|
17254
|
-
bottomToolbar: {
|
|
17255
|
-
buttons: [
|
|
17256
|
-
{
|
|
17257
|
-
label: "Add New",
|
|
17258
|
-
icon: "plus",
|
|
17259
|
-
color: "primary",
|
|
17260
|
-
white: true,
|
|
17261
|
-
align: 'right'
|
|
17262
|
-
}
|
|
17263
|
-
]
|
|
17264
|
-
},
|
|
17265
|
-
loadSourceCode: function(model, response) {
|
|
17266
|
-
return Luca("class_browser_detail").loadComponent(model);
|
|
17267
|
-
}
|
|
17246
|
+
_.def("Luca.tools.ApplicationInspector")["extends"]("Luca.core.Container")["with"]({
|
|
17247
|
+
name: "application_inspector"
|
|
17268
17248
|
});
|
|
17269
17249
|
|
|
17270
17250
|
}).call(this);
|
|
@@ -17654,6 +17634,7 @@ if (!CodeMirror.mimeModes.hasOwnProperty("text/css"))
|
|
|
17654
17634
|
|
|
17655
17635
|
_.def("Luca.tools.CoffeeEditor")["extends"]("Luca.tools.CodeMirrorField")["with"]({
|
|
17656
17636
|
name: "coffeescript_editor",
|
|
17637
|
+
autoCompile: true,
|
|
17657
17638
|
compileOptions: {
|
|
17658
17639
|
bare: true
|
|
17659
17640
|
},
|
|
@@ -17662,7 +17643,7 @@ if (!CodeMirror.mimeModes.hasOwnProperty("text/css"))
|
|
|
17662
17643
|
var editor;
|
|
17663
17644
|
this.options = options;
|
|
17664
17645
|
Luca.tools.CodeMirrorField.prototype.initialize.apply(this, arguments);
|
|
17665
|
-
_.bindAll(this, "editorChange");
|
|
17646
|
+
_.bindAll(this, "editorChange", "toggleSource");
|
|
17666
17647
|
editor = this;
|
|
17667
17648
|
this.state = new Luca.Model({
|
|
17668
17649
|
currentMode: "coffeescript",
|
|
@@ -17677,10 +17658,17 @@ if (!CodeMirror.mimeModes.hasOwnProperty("text/css"))
|
|
|
17677
17658
|
return model.set('javascript', compiled);
|
|
17678
17659
|
});
|
|
17679
17660
|
});
|
|
17680
|
-
|
|
17661
|
+
this.state.bind("change:javascript", function(model) {
|
|
17681
17662
|
var _ref;
|
|
17682
17663
|
return (_ref = editor.onJavascriptChange) != null ? _ref.call(editor, model.get('javascript')) : void 0;
|
|
17683
17664
|
});
|
|
17665
|
+
return this.state.bind("change:currentMode", function(model) {
|
|
17666
|
+
if (model.get('currentMode') === "javascript") {
|
|
17667
|
+
return editor.setValue(model.get('javascript'));
|
|
17668
|
+
} else {
|
|
17669
|
+
return editor.setValue(model.get('coffeescript'));
|
|
17670
|
+
}
|
|
17671
|
+
});
|
|
17684
17672
|
},
|
|
17685
17673
|
compile: function(code, callback) {
|
|
17686
17674
|
var compiled, response;
|
|
@@ -17702,17 +17690,33 @@ if (!CodeMirror.mimeModes.hasOwnProperty("text/css"))
|
|
|
17702
17690
|
};
|
|
17703
17691
|
}
|
|
17704
17692
|
},
|
|
17693
|
+
toggleMode: function() {
|
|
17694
|
+
if (this.currentMode() === "coffeescript") {
|
|
17695
|
+
return this.state.set('currentMode', 'javascript');
|
|
17696
|
+
} else if (this.currentMode() === "javascript") {
|
|
17697
|
+
return this.state.set('currentMode', 'coffeescript');
|
|
17698
|
+
}
|
|
17699
|
+
},
|
|
17705
17700
|
currentMode: function() {
|
|
17706
17701
|
return this.state.get("currentMode");
|
|
17707
17702
|
},
|
|
17708
|
-
|
|
17709
|
-
|
|
17710
|
-
|
|
17711
|
-
|
|
17703
|
+
getCoffeescript: function() {
|
|
17704
|
+
return this.state.get("coffeescript");
|
|
17705
|
+
},
|
|
17706
|
+
getJavascript: function(recompile) {
|
|
17707
|
+
var js, results;
|
|
17708
|
+
if (recompile == null) recompile = false;
|
|
17709
|
+
js = this.state.get("javascript");
|
|
17710
|
+
if (recompile === true || (js != null ? js.length : void 0) === 0) {
|
|
17711
|
+
results = this.compile(this.getCoffeescript());
|
|
17712
|
+
js = results != null ? results.compiled : void 0;
|
|
17713
|
+
}
|
|
17714
|
+
return js;
|
|
17712
17715
|
},
|
|
17713
17716
|
editorChange: function() {
|
|
17714
|
-
this.
|
|
17715
|
-
|
|
17717
|
+
if (this.autoCompile === true) {
|
|
17718
|
+
return this.state.set(this.currentMode(), this.getValue());
|
|
17719
|
+
}
|
|
17716
17720
|
}
|
|
17717
17721
|
});
|
|
17718
17722
|
|
|
@@ -17724,6 +17728,95 @@ if (!CodeMirror.mimeModes.hasOwnProperty("text/css"))
|
|
|
17724
17728
|
className: "collection-inspector"
|
|
17725
17729
|
});
|
|
17726
17730
|
|
|
17731
|
+
}).call(this);
|
|
17732
|
+
(function() {
|
|
17733
|
+
|
|
17734
|
+
_.def('Luca.app.Components')["extends"]('Luca.Collection')["with"]({
|
|
17735
|
+
cachedMethods: ["namespaces", "classes", "roots", "views", "collections", "models"],
|
|
17736
|
+
cache_key: "luca_components",
|
|
17737
|
+
name: "components",
|
|
17738
|
+
initialize: function() {
|
|
17739
|
+
this.model = Luca.app.Component;
|
|
17740
|
+
return Luca.Collection.prototype.initialize.apply(this, arguments);
|
|
17741
|
+
},
|
|
17742
|
+
url: function() {
|
|
17743
|
+
return "/luca/source-map.js";
|
|
17744
|
+
},
|
|
17745
|
+
collections: function() {
|
|
17746
|
+
return this.select(function(component) {
|
|
17747
|
+
return Luca.isCollectionPrototype(component.definition());
|
|
17748
|
+
});
|
|
17749
|
+
},
|
|
17750
|
+
modelClasses: function() {
|
|
17751
|
+
return this.select(function(component) {
|
|
17752
|
+
return Luca.isModelPrototype(component.definition());
|
|
17753
|
+
});
|
|
17754
|
+
},
|
|
17755
|
+
views: function() {
|
|
17756
|
+
return this.select(function(component) {
|
|
17757
|
+
return Luca.isViewPrototype(component.definition());
|
|
17758
|
+
});
|
|
17759
|
+
},
|
|
17760
|
+
classes: function() {
|
|
17761
|
+
return _.uniq(this.pluck("className"));
|
|
17762
|
+
},
|
|
17763
|
+
roots: function() {
|
|
17764
|
+
return _.uniq(this.invoke("root"));
|
|
17765
|
+
},
|
|
17766
|
+
namespaces: function() {
|
|
17767
|
+
return _.uniq(this.invoke("namespace"));
|
|
17768
|
+
},
|
|
17769
|
+
asTree: function() {
|
|
17770
|
+
var classes, namespaces, roots, tree;
|
|
17771
|
+
classes = this.classes();
|
|
17772
|
+
namespaces = this.namespaces();
|
|
17773
|
+
roots = this.roots();
|
|
17774
|
+
tree = _(roots).inject(function(memo, root) {
|
|
17775
|
+
var regexp;
|
|
17776
|
+
memo[root] || (memo[root] = {});
|
|
17777
|
+
regexp = new RegExp("^" + root);
|
|
17778
|
+
memo[root] = _(namespaces).select(function(namespace) {
|
|
17779
|
+
return regexp.exec(namespace) && _(namespaces).include(namespace) && namespace.split('.').length === 2;
|
|
17780
|
+
});
|
|
17781
|
+
return memo;
|
|
17782
|
+
}, {});
|
|
17783
|
+
return _(tree).inject(function(memo, namespaces, root) {
|
|
17784
|
+
memo[root] = {};
|
|
17785
|
+
_(namespaces).each(function(namespace) {
|
|
17786
|
+
return memo[root][namespace] = {};
|
|
17787
|
+
});
|
|
17788
|
+
return memo;
|
|
17789
|
+
}, {});
|
|
17790
|
+
}
|
|
17791
|
+
});
|
|
17792
|
+
|
|
17793
|
+
}).call(this);
|
|
17794
|
+
(function() {
|
|
17795
|
+
|
|
17796
|
+
_.def("Luca.app.Instances")["extends"]("Luca.Collection")["with"]({
|
|
17797
|
+
name: "instances",
|
|
17798
|
+
refresh: function(options) {
|
|
17799
|
+
var models;
|
|
17800
|
+
if (options == null) options = {};
|
|
17801
|
+
models = _(Luca.registry.instances()).map(function(instance) {
|
|
17802
|
+
return {
|
|
17803
|
+
cid: instance.cid,
|
|
17804
|
+
name: instance.name,
|
|
17805
|
+
ctype: instance.ctype,
|
|
17806
|
+
displayName: instance.displayName || instance.prototype.displayName,
|
|
17807
|
+
object: instance
|
|
17808
|
+
};
|
|
17809
|
+
});
|
|
17810
|
+
return this.reset(models, options);
|
|
17811
|
+
},
|
|
17812
|
+
initialize: function(initialModels, options) {
|
|
17813
|
+
if (initialModels == null) initialModels = [];
|
|
17814
|
+
this.options = options != null ? options : {};
|
|
17815
|
+
this.model = Luca.app.Instance;
|
|
17816
|
+
return Luca.Collection.prototype.initialize.apply(this, arguments);
|
|
17817
|
+
}
|
|
17818
|
+
});
|
|
17819
|
+
|
|
17727
17820
|
}).call(this);
|
|
17728
17821
|
(function() {
|
|
17729
17822
|
var ComponentPicker, bufferNames, compiledBuffers, defaults;
|
|
@@ -17791,9 +17884,23 @@ if (!CodeMirror.mimeModes.hasOwnProperty("text/css"))
|
|
|
17791
17884
|
});
|
|
17792
17885
|
|
|
17793
17886
|
_.def("Luca.tools.ComponentTester")["extends"]("Luca.core.Container")["with"]({
|
|
17887
|
+
id: "component_tester",
|
|
17794
17888
|
name: "component_tester",
|
|
17795
|
-
className: "span11",
|
|
17796
17889
|
autoEvaluateCode: true,
|
|
17890
|
+
currentSize: 1,
|
|
17891
|
+
sizes: [
|
|
17892
|
+
{
|
|
17893
|
+
icon: "resize-full",
|
|
17894
|
+
value: function() {
|
|
17895
|
+
return $(window).height() * 0.3;
|
|
17896
|
+
}
|
|
17897
|
+
}, {
|
|
17898
|
+
icon: "resize-small",
|
|
17899
|
+
value: function() {
|
|
17900
|
+
return $(window).height() * 0.6;
|
|
17901
|
+
}
|
|
17902
|
+
}
|
|
17903
|
+
],
|
|
17797
17904
|
components: [
|
|
17798
17905
|
{
|
|
17799
17906
|
ctype: 'card_view',
|
|
@@ -17811,11 +17918,6 @@ if (!CodeMirror.mimeModes.hasOwnProperty("text/css"))
|
|
|
17811
17918
|
name: "ctester_edit",
|
|
17812
17919
|
className: 'font-large fixed-height',
|
|
17813
17920
|
minHeight: '350px',
|
|
17814
|
-
styles: {
|
|
17815
|
-
"position": "absolute",
|
|
17816
|
-
"bottom": "0px",
|
|
17817
|
-
"width": "96%"
|
|
17818
|
-
},
|
|
17819
17921
|
currentBuffers: defaults,
|
|
17820
17922
|
compiledBuffers: ["component", "setup", "implementation"],
|
|
17821
17923
|
topToolbar: {
|
|
@@ -17947,11 +18049,6 @@ if (!CodeMirror.mimeModes.hasOwnProperty("text/css"))
|
|
|
17947
18049
|
afterRender: function() {
|
|
17948
18050
|
var changeHandler,
|
|
17949
18051
|
_this = this;
|
|
17950
|
-
this.getOutput().applyStyles({
|
|
17951
|
-
'min-height': '400px'
|
|
17952
|
-
});
|
|
17953
|
-
this.$('.toolbar-container').css('padding-right', '12px');
|
|
17954
|
-
this.$('.luca-ui-toolbar.toolbar-bottom').css('margin', '0px');
|
|
17955
18052
|
changeHandler = _.idleMedium(function() {
|
|
17956
18053
|
if (_this.autoEvaluateCode === true) return _this.applyTestRun();
|
|
17957
18054
|
}, 500);
|
|
@@ -18049,20 +18146,6 @@ if (!CodeMirror.mimeModes.hasOwnProperty("text/css"))
|
|
|
18049
18146
|
button.html(_.string.capitalize((newMode === "coffeescript" ? "View Javascript" : "View Coffeescript")));
|
|
18050
18147
|
return this.editBuffer(this.currentBufferName, newMode === "javascript");
|
|
18051
18148
|
},
|
|
18052
|
-
currentSize: 1,
|
|
18053
|
-
sizes: [
|
|
18054
|
-
{
|
|
18055
|
-
icon: "resize-full",
|
|
18056
|
-
value: function() {
|
|
18057
|
-
return $(window).height() * 0.3;
|
|
18058
|
-
}
|
|
18059
|
-
}, {
|
|
18060
|
-
icon: "resize-small",
|
|
18061
|
-
value: function() {
|
|
18062
|
-
return $(window).height() * 0.6;
|
|
18063
|
-
}
|
|
18064
|
-
}
|
|
18065
|
-
],
|
|
18066
18149
|
toggleSize: function(button) {
|
|
18067
18150
|
var iconHolder, index, newIcon, newSize;
|
|
18068
18151
|
index = this.currentSize++ % this.sizes.length;
|
|
@@ -18212,116 +18295,7 @@ if (!CodeMirror.mimeModes.hasOwnProperty("text/css"))
|
|
|
18212
18295
|
|
|
18213
18296
|
}).call(this);
|
|
18214
18297
|
(function() {
|
|
18215
|
-
|
|
18216
|
-
_.def("Luca.tools.ClassBrowserDetail")["extends"]('Luca.core.Container')["with"]({
|
|
18217
|
-
components: [
|
|
18218
|
-
{
|
|
18219
|
-
ctype: "code_editor"
|
|
18220
|
-
}
|
|
18221
|
-
],
|
|
18222
|
-
loadComponent: function(model) {
|
|
18223
|
-
this.components[0].compiled = void 0;
|
|
18224
|
-
return this.components[0].editor.setValue(model.get('source'));
|
|
18225
|
-
}
|
|
18226
|
-
});
|
|
18227
|
-
|
|
18228
|
-
}).call(this);
|
|
18229
|
-
(function() {
|
|
18230
|
-
|
|
18231
|
-
_.def("Luca.tools.ClassBrowserList")["extends"]("Luca.View")["with"]({
|
|
18232
|
-
tagName: "ul",
|
|
18233
|
-
className: "nav nav-list class-browser-list",
|
|
18234
|
-
autoBindEventHandlers: true,
|
|
18235
|
-
events: {
|
|
18236
|
-
"click li.namespace a": "namespaceClickHandler",
|
|
18237
|
-
"click li.className a": "classClickHandler"
|
|
18238
|
-
},
|
|
18239
|
-
initialize: function(options) {
|
|
18240
|
-
this.options = options != null ? options : {};
|
|
18241
|
-
return this.deferrable = this.collection = new Luca.collections.Components();
|
|
18242
|
-
},
|
|
18243
|
-
collapseAllNamespaceLists: function() {
|
|
18244
|
-
return this.$('ul.classList').collapse('hide');
|
|
18245
|
-
},
|
|
18246
|
-
namespaceClickHandler: function(e) {
|
|
18247
|
-
var classList, me, my;
|
|
18248
|
-
me = my = $(e.target);
|
|
18249
|
-
classList = my.siblings('.classList');
|
|
18250
|
-
return classList.collapse('toggle');
|
|
18251
|
-
},
|
|
18252
|
-
classClickHandler: function(e) {
|
|
18253
|
-
var className, list, me, model, my;
|
|
18254
|
-
e.preventDefault();
|
|
18255
|
-
me = my = $(e.currentTarget);
|
|
18256
|
-
className = my.data('component');
|
|
18257
|
-
list = this;
|
|
18258
|
-
model = this.collection.detect(function(component) {
|
|
18259
|
-
return component.get("className") === className;
|
|
18260
|
-
});
|
|
18261
|
-
if (model && !model.get("contents")) {
|
|
18262
|
-
return model.fetch({
|
|
18263
|
-
success: _.once(function(model, response) {
|
|
18264
|
-
return list.trigger("component:loaded", model, response);
|
|
18265
|
-
})
|
|
18266
|
-
});
|
|
18267
|
-
}
|
|
18268
|
-
},
|
|
18269
|
-
afterRender: function() {
|
|
18270
|
-
var _ref;
|
|
18271
|
-
this.collapseAllNamespaceLists();
|
|
18272
|
-
return (_ref = Luca.View.prototype.afterRender) != null ? _ref.apply(this, arguments) : void 0;
|
|
18273
|
-
},
|
|
18274
|
-
attach: _.once(Luca.View.prototype.$attach),
|
|
18275
|
-
render: function() {
|
|
18276
|
-
var data, tree;
|
|
18277
|
-
tree = this;
|
|
18278
|
-
data = this.collection.asTree();
|
|
18279
|
-
_(data).each(function(namespace, root) {
|
|
18280
|
-
var li, namespaceElements, namespaceList, target, ul;
|
|
18281
|
-
target = tree.make("a", {}, root);
|
|
18282
|
-
li = tree.make("li", {
|
|
18283
|
-
"class": "root"
|
|
18284
|
-
}, target);
|
|
18285
|
-
namespaceList = _(namespace).keys();
|
|
18286
|
-
namespaceElements = _(namespaceList).map(function(namespace) {
|
|
18287
|
-
var classElements, classId, classes, cul, nli, resolved;
|
|
18288
|
-
classId = namespace.toLowerCase().replace(/\./g, '-');
|
|
18289
|
-
target = tree.make("a", {}, namespace);
|
|
18290
|
-
nli = tree.make("li", {
|
|
18291
|
-
"class": "namespace " + classId
|
|
18292
|
-
}, target);
|
|
18293
|
-
resolved = Luca.util.resolve(namespace, window || global);
|
|
18294
|
-
classes = _(resolved).keys();
|
|
18295
|
-
classElements = _(classes).map(function(componentClass) {
|
|
18296
|
-
var fullName, link;
|
|
18297
|
-
fullName = "" + namespace + "." + componentClass;
|
|
18298
|
-
link = tree.make("a", {
|
|
18299
|
-
"data-component": fullName
|
|
18300
|
-
}, fullName);
|
|
18301
|
-
classId = fullName.toLowerCase().replace(/\./g, '-');
|
|
18302
|
-
return tree.make("li", {
|
|
18303
|
-
"class": "className " + classId
|
|
18304
|
-
}, link);
|
|
18305
|
-
});
|
|
18306
|
-
cul = tree.make("ul", {
|
|
18307
|
-
"class": "classList"
|
|
18308
|
-
}, classElements);
|
|
18309
|
-
$(nli).append(cul);
|
|
18310
|
-
return nli;
|
|
18311
|
-
});
|
|
18312
|
-
ul = tree.make("ul", {
|
|
18313
|
-
"class": "namespace"
|
|
18314
|
-
}, namespaceElements);
|
|
18315
|
-
$(li).append(ul);
|
|
18316
|
-
return tree.$append(li);
|
|
18317
|
-
});
|
|
18318
|
-
return this.attach();
|
|
18319
|
-
}
|
|
18320
|
-
});
|
|
18321
|
-
|
|
18322
|
-
}).call(this);
|
|
18323
|
-
(function() {
|
|
18324
|
-
var codeMirrorOptions;
|
|
18298
|
+
var codeMirrorOptions, _base;
|
|
18325
18299
|
|
|
18326
18300
|
codeMirrorOptions = {
|
|
18327
18301
|
readOnly: true,
|
|
@@ -18346,12 +18320,11 @@ if (!CodeMirror.mimeModes.hasOwnProperty("text/css"))
|
|
|
18346
18320
|
components: [
|
|
18347
18321
|
{
|
|
18348
18322
|
ctype: "code_mirror_field",
|
|
18323
|
+
additionalClassNames: "clearfix",
|
|
18349
18324
|
name: "code_output",
|
|
18350
18325
|
readOnly: true,
|
|
18351
18326
|
lineNumbers: false,
|
|
18352
18327
|
mode: "javascript",
|
|
18353
|
-
height: "621px",
|
|
18354
|
-
maxHeight: "621px",
|
|
18355
18328
|
lineWrapping: true,
|
|
18356
18329
|
gutter: false
|
|
18357
18330
|
}, {
|
|
@@ -18384,9 +18357,16 @@ if (!CodeMirror.mimeModes.hasOwnProperty("text/css"))
|
|
|
18384
18357
|
}
|
|
18385
18358
|
}
|
|
18386
18359
|
],
|
|
18360
|
+
afterRender: function() {
|
|
18361
|
+
this.$container().modal({
|
|
18362
|
+
backdrop: false
|
|
18363
|
+
});
|
|
18364
|
+
return this.$container.css;
|
|
18365
|
+
},
|
|
18387
18366
|
show: function(options) {
|
|
18388
18367
|
if (options == null) options = {};
|
|
18389
|
-
|
|
18368
|
+
this.$container().modal('show');
|
|
18369
|
+
return this;
|
|
18390
18370
|
},
|
|
18391
18371
|
getContext: function() {
|
|
18392
18372
|
return window;
|
|
@@ -18485,16 +18465,49 @@ if (!CodeMirror.mimeModes.hasOwnProperty("text/css"))
|
|
|
18485
18465
|
}
|
|
18486
18466
|
});
|
|
18487
18467
|
|
|
18468
|
+
(_base = Luca.util).launchers || (_base.launchers = {});
|
|
18469
|
+
|
|
18470
|
+
Luca.util.launchers.developmentConsole = function(name) {
|
|
18471
|
+
var _this = this;
|
|
18472
|
+
if (name == null) name = "luca-development-console";
|
|
18473
|
+
this._lucaDevConsole = Luca(name, function() {
|
|
18474
|
+
var console;
|
|
18475
|
+
_this.$el.append(Backbone.View.prototype.make("div", {
|
|
18476
|
+
id: "" + name + "-wrapper",
|
|
18477
|
+
"class": "modal fade"
|
|
18478
|
+
}));
|
|
18479
|
+
console = new Luca.tools.DevelopmentConsole({
|
|
18480
|
+
name: name,
|
|
18481
|
+
container: "#" + name + "-wrapper"
|
|
18482
|
+
});
|
|
18483
|
+
return console.render();
|
|
18484
|
+
});
|
|
18485
|
+
return this._lucaDevConsole.show();
|
|
18486
|
+
};
|
|
18487
|
+
|
|
18488
18488
|
}).call(this);
|
|
18489
18489
|
(function() {
|
|
18490
18490
|
|
|
18491
|
-
_.def("Luca.
|
|
18492
|
-
url: function() {
|
|
18493
|
-
return "/components?component=" + (this.get('className'));
|
|
18494
|
-
},
|
|
18491
|
+
_.def("Luca.app.Component")["extends"]("Luca.Model")["with"]({
|
|
18495
18492
|
root: function() {
|
|
18496
18493
|
return this.get("className").split('.')[0];
|
|
18497
18494
|
},
|
|
18495
|
+
className: function() {
|
|
18496
|
+
return this.get("className");
|
|
18497
|
+
},
|
|
18498
|
+
instances: function() {
|
|
18499
|
+
return Luca.registry.findInstancesByClassName(this.className());
|
|
18500
|
+
},
|
|
18501
|
+
definitionPrototype: function() {
|
|
18502
|
+
var _ref;
|
|
18503
|
+
return (_ref = this.definition()) != null ? _ref.prototype : void 0;
|
|
18504
|
+
},
|
|
18505
|
+
parentClasses: function() {
|
|
18506
|
+
return Luca.parentClasses(this.className());
|
|
18507
|
+
},
|
|
18508
|
+
definition: function() {
|
|
18509
|
+
return Luca.util.resolve(this.className());
|
|
18510
|
+
},
|
|
18498
18511
|
namespace: function() {
|
|
18499
18512
|
var parts;
|
|
18500
18513
|
if (this.get("className") == null) return "";
|
|
@@ -18504,56 +18517,15 @@ if (!CodeMirror.mimeModes.hasOwnProperty("text/css"))
|
|
|
18504
18517
|
}
|
|
18505
18518
|
});
|
|
18506
18519
|
|
|
18507
|
-
_.def('Luca.collections.Components')["extends"]('Luca.Collection')["with"]({
|
|
18508
|
-
model: Luca.models.Component,
|
|
18509
|
-
cachedMethods: ["namespaces", "classes", "roots"],
|
|
18510
|
-
cache_key: "luca_components",
|
|
18511
|
-
name: "components",
|
|
18512
|
-
url: function() {
|
|
18513
|
-
return "/luca/components";
|
|
18514
|
-
},
|
|
18515
|
-
initialize: function(models, options) {
|
|
18516
|
-
Luca.Collection.cache(this.cache_key, Luca.registry.classes());
|
|
18517
|
-
return Luca.Collection.prototype.initialize.apply(this, arguments);
|
|
18518
|
-
},
|
|
18519
|
-
classes: function() {
|
|
18520
|
-
return _.uniq(this.pluck("className"));
|
|
18521
|
-
},
|
|
18522
|
-
roots: function() {
|
|
18523
|
-
return _.uniq(this.invoke("root"));
|
|
18524
|
-
},
|
|
18525
|
-
namespaces: function() {
|
|
18526
|
-
return _.uniq(this.invoke("namespace"));
|
|
18527
|
-
},
|
|
18528
|
-
asTree: function() {
|
|
18529
|
-
var classes, namespaces, roots, tree;
|
|
18530
|
-
classes = this.classes();
|
|
18531
|
-
namespaces = this.namespaces();
|
|
18532
|
-
roots = this.roots();
|
|
18533
|
-
tree = _(roots).inject(function(memo, root) {
|
|
18534
|
-
var regexp;
|
|
18535
|
-
memo[root] || (memo[root] = {});
|
|
18536
|
-
regexp = new RegExp("^" + root);
|
|
18537
|
-
memo[root] = _(namespaces).select(function(namespace) {
|
|
18538
|
-
return regexp.exec(namespace) && _(namespaces).include(namespace) && namespace.split('.').length === 2;
|
|
18539
|
-
});
|
|
18540
|
-
return memo;
|
|
18541
|
-
}, {});
|
|
18542
|
-
return _(tree).inject(function(memo, namespaces, root) {
|
|
18543
|
-
memo[root] = {};
|
|
18544
|
-
_(namespaces).each(function(namespace) {
|
|
18545
|
-
return memo[root][namespace] = {};
|
|
18546
|
-
});
|
|
18547
|
-
return memo;
|
|
18548
|
-
}, {});
|
|
18549
|
-
}
|
|
18550
|
-
});
|
|
18551
|
-
|
|
18552
18520
|
}).call(this);
|
|
18553
18521
|
(function() {
|
|
18554
|
-
|
|
18555
|
-
Luca.
|
|
18522
|
+
|
|
18523
|
+
_.def("Luca.app.Instance")["extends"]("Luca.Model")["with"]({
|
|
18524
|
+
version: 1
|
|
18525
|
+
});
|
|
18526
|
+
|
|
18556
18527
|
}).call(this);
|
|
18528
|
+
(function() {Luca.templates || (Luca.templates = {}); Luca.templates["component_tester/help"] = function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments);};with(obj||{}){__p.push('<h1>Component Tester</h1>\n<p>This is a tool that enables you to build and test Luca components in an isolated sandbox environment. The editor is currently enabled with vim keybindings</p>\n<h3>Setup</h3>\n<p>This is where you setup any data requirements needed for the test to work. This is run every time before the implementation code is ran.</p>\n<h3>Teardown</h3>\n<p>This is where you clean up after the tests. This will be run every time after the implementation code is ran.</p>\n<h3>Definitions</h3>\n<p>This is where you define the component you will be testing. This is usually the code you will be shipping once you have completed testing.</p>\n<h3>Implementation</h3>\n<p>This is where you create an instance of the component and specify any of the necessary configuration settings. The component will be rendered into the output panel of the component tester.</p>\n');}return __p.join('');}; }).call(this);
|
|
18557
18529
|
(function() {
|
|
18558
18530
|
|
|
18559
18531
|
|