aboutsummaryrefslogtreecommitdiff
path: root/user-document-templates
diff options
context:
space:
mode:
Diffstat (limited to 'user-document-templates')
-rw-r--r--user-document-templates/montage-application-cloud/main.reel/main.js141
1 files changed, 12 insertions, 129 deletions
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 2e331cdc..86871fd3 100644
--- a/user-document-templates/montage-application-cloud/main.reel/main.js
+++ b/user-document-templates/montage-application-cloud/main.reel/main.js
@@ -32,140 +32,23 @@ exports.Main = Montage.create(Component, {
32 }, 32 },
33 33
34 addComponentToUserDocument:{ 34 addComponentToUserDocument:{
35 value:function(containerElement, componentType, callback){ 35 value:function(element, data, callback){
36 var component = null;
37 switch(componentType.type){
38 case "Button":
39 36
40 var button = require.async(componentType.path) 37 var component;
41 .then(function (button) {
42 var buttonObj = button["Button"];
43 var btIns = buttonObj.create();
44 38
45 btIns.element = containerElement; 39 component = require.async(data.path)
46 btIns.deserializedFromTemplate(); 40 .then(function(component) {
41 var componentRequire = component[data.name];
42 var componentInstance = componentRequire.create();
47 43
48 btIns.needsDraw = true; 44 componentInstance.element = element;
49 btIns.label = "Button"; 45 componentInstance.deserializedFromTemplate();
50 callback(btIns, containerElement); 46 componentInstance.needsDraw = true;
51 })
52 .end();
53 47
54 break; 48 callback(componentInstance, element);
55 case "Textfield": 49 })
56 var tf = require.async(componentType.path) 50 .end();
57 .then(function (tf) {
58 var buttonObj = tf["Textfield"];
59 var btIns = buttonObj.create();
60 51
61 btIns.element = containerElement;
62 btIns.deserializedFromTemplate();
63
64 btIns.needsDraw = true;
65 btIns.value = "Button";
66 callback(btIns, containerElement);
67 })
68 .end();
69 break
70 case "Checkbox":
71 component = Checkbox.create();
72 component.element = containerElement;
73 component.needsDraw = true;
74 break;
75 case "Condition":
76 component = Condition.create();
77 component.element = containerElement;
78 component.needsDraw = true;
79 break;
80 case "DynamicText":
81 component = DynamicText.create();
82 component.element = containerElement;
83 component.value = "Label";
84 component.needsDraw = true;
85 break;
86 case "HotText":
87 component = HotText.create();
88 component.element = containerElement;
89 component.needsDraw = true;
90 break;
91 case "HotTextUnit":
92 component = HotTextUnit.create();
93 component.element = containerElement;
94 component.needsDraw = true;
95 break;
96 case "FlowController":
97 component = FlowController.create();
98 component.element = containerElement;
99 component.needsDraw = true;
100 break;
101 case "ImageContainer":
102 component = ImageContainer.create();
103 component.element = containerElement;
104 component.element.style.width = "285px";
105 component.element.style.height = "235px";
106 component.src = "placeholder.jpg";
107 component.needsDraw = true;
108 break;
109 case "Progress":
110 component = Progress.create();
111 component.element = containerElement;
112 component.loading = true;
113 component.needsDraw = true;
114 break;
115 case "Repetition":
116 component = Repetition.create();
117 component.element = containerElement;
118 component.needsDraw = true;
119 break;
120 case "Scrollview":
121 component = Scrollview.create();
122 component.element = containerElement;
123 component.element.style.width = "200px";
124 component.element.style.height = "200px";
125 var dummyContent = document.createElement("div");
126 dummyContent.innerHTML = "<img src='image3.jpg'/>";
127 component.element.appendChild(dummyContent);
128 component.needsDraw = true;
129 break;
130 case "Slider":
131 component = Slider.create();
132 component.element = containerElement;
133// component.value = 0;
134// component._minValue = 0;
135// component._maxValue = 100;
136 component.needsDraw = true;
137 break;
138 case "Slot":
139 component = Slot.create();
140 component.element = containerElement;
141 component.needsDraw = true;
142 break;
143 case "Substitution":
144 component = Substitution.create();
145 component.element = containerElement;
146 component.needsDraw = true;
147 break;
148 case "TextArea":
149 component = TextArea.create();
150 component.element = containerElement;
151 component.needsDraw = true;
152 break;
153 case "Toggle":
154 component = Toggle.create();
155 component.element = containerElement;
156 component.needsDraw = true;
157 break;
158 case "ToggleButton":
159 component = ToggleButton.create();
160 component.element = containerElement;
161 component.element.classList.add("text");
162 component.needsDraw = true;
163 break;
164 default:
165 console.log("Unrecognized component type");
166 }
167 //console.log(component);
168 return component;
169 } 52 }
170 } 53 }
171 54