aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--js/panels/Components/ComponentsPanelBase.reel/ComponentsPanelBase.html11
-rw-r--r--js/panels/Components/ComponentsPanelBase.reel/ComponentsPanelBase.js29
-rw-r--r--user-document-templates/montage-application-cloud/main.reel/main.js14
3 files changed, 47 insertions, 7 deletions
diff --git a/js/panels/Components/ComponentsPanelBase.reel/ComponentsPanelBase.html b/js/panels/Components/ComponentsPanelBase.reel/ComponentsPanelBase.html
index df104ecc..1e040e35 100644
--- a/js/panels/Components/ComponentsPanelBase.reel/ComponentsPanelBase.html
+++ b/js/panels/Components/ComponentsPanelBase.reel/ComponentsPanelBase.html
@@ -11,6 +11,17 @@
11 11
12 <script type="text/montage-serialization"> 12 <script type="text/montage-serialization">
13 { 13 {
14 "componentController": {
15 "module": "montage/ui/controller/array-controller",
16 "name": "ArrayController",
17 "bindings": {
18 "content": {
19 "boundObject": {"@": "owner"},
20 "boundObjectPropertyPath": "components"
21 }
22 }
23 },
24
14 "owner": { 25 "owner": {
15 "module": "js/panels/Components/ComponentsPanelBase.reel", 26 "module": "js/panels/Components/ComponentsPanelBase.reel",
16 "name": "ComponentsPanelBase", 27 "name": "ComponentsPanelBase",
diff --git a/js/panels/Components/ComponentsPanelBase.reel/ComponentsPanelBase.js b/js/panels/Components/ComponentsPanelBase.reel/ComponentsPanelBase.js
index 58a798d8..9b5b755c 100644
--- a/js/panels/Components/ComponentsPanelBase.reel/ComponentsPanelBase.js
+++ b/js/panels/Components/ComponentsPanelBase.reel/ComponentsPanelBase.js
@@ -11,10 +11,25 @@ var Montage = require("montage/core/core").Montage,
11var treeControlModule = require("js/components/tree.reel"); 11var treeControlModule = require("js/components/tree.reel");
12 12
13var ComponentsPanelBase = exports.ComponentsPanelBase = Montage.create(Component, { 13var ComponentsPanelBase = exports.ComponentsPanelBase = Montage.create(Component, {
14 _hasFocus: { 14
15 enumerable: false, 15 components: {
16 value: false 16 value: null
17 },
18
19 didCreate: {
20 value: function() {
21 this._loadComponents();
22 }
23 },
24
25 _loadComponents: {
26 value: function() {
27 this.photos = [
28 {component: "Button", data: "montage/ui/button.reel/button.json"}
29 ];
30 }
17 }, 31 },
32
18 prepareForDraw: { 33 prepareForDraw: {
19 enumerable: false, 34 enumerable: false,
20 value: function() { 35 value: function() {
@@ -57,7 +72,7 @@ var ComponentsPanelBase = exports.ComponentsPanelBase = Montage.create(Component
57 componentEl.setAttribute("type", "button"); 72 componentEl.setAttribute("type", "button");
58 //componentEl.innerHTML = "Button"; 73 //componentEl.innerHTML = "Button";
59 74
60 componentInstance = this.application.ninja.currentDocument._window.addComponent(componentEl, {type: componentType, path: "montage/ui/button.reel", name: "Button"}); 75 componentInstance = this.application.ninja.currentDocument._window.addComponent(componentEl, {type: componentType, path: "montage/ui/button.reel", name: "Button"}, this.callback);
61 76
62 77
63 }else if(componentType == "Checkbox"){ 78 }else if(componentType == "Checkbox"){
@@ -140,5 +155,11 @@ var ComponentsPanelBase = exports.ComponentsPanelBase = Montage.create(Component
140 155
141 156
142 } 157 }
158 },
159
160 callback: {
161 value: function() {
162 console.log("the callback");
163 }
143 } 164 }
144}); \ No newline at end of file 165}); \ No newline at end of file
diff --git a/user-document-templates/montage-application-cloud/main.reel/main.js b/user-document-templates/montage-application-cloud/main.reel/main.js
index 415794d8..036d6c24 100644
--- a/user-document-templates/montage-application-cloud/main.reel/main.js
+++ b/user-document-templates/montage-application-cloud/main.reel/main.js
@@ -32,17 +32,24 @@ exports.Main = Montage.create(Component, {
32 }, 32 },
33 33
34 addComponentToUserDocument:{ 34 addComponentToUserDocument:{
35 value:function(containerElement, componentType){ 35 value:function(containerElement, componentType, callback){
36 var component = null; 36 var component = null;
37 switch(componentType.type){ 37 switch(componentType.type){
38 case "Button": 38 case "Button":
39 39
40 //var tmpFix = require("montage/ui/button.reel"); 40 //var tmpFix = ("montage/ui/button.reel");
41 //var str = "montage/ui/button.reel"; 41 //var str = "montage/ui/button.reel";
42 var stro = componentType.path; 42 var stro = componentType.path;
43 43
44 var button = require(stro); 44// var button = (stro);
45 45
46 var button = require.async(stro)
47 .then(function (button) {
48 callback();
49 })
50 .end();
51
52 /*
46 var buttonInstance = button[componentType.name]; 53 var buttonInstance = button[componentType.name];
47 54
48 buttonInstance.element = containerElement; 55 buttonInstance.element = containerElement;
@@ -52,6 +59,7 @@ exports.Main = Montage.create(Component, {
52 buttonInstance.label = "Button"; 59 buttonInstance.label = "Button";
53 60
54 return buttonInstance; 61 return buttonInstance;
62 */
55 break; 63 break;
56 case "Checkbox": 64 case "Checkbox":
57 component = Checkbox.create(); 65 component = Checkbox.create();