aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
Diffstat (limited to 'js')
-rwxr-xr-xjs/components/ui/color-chip.reel/color-chip.js13
-rwxr-xr-xjs/controllers/document-controller.js2
-rwxr-xr-xjs/controllers/elements/body-controller.js2
-rwxr-xr-xjs/document/views/design.js5
-rwxr-xr-xjs/ninja.reel/ninja.js2
-rwxr-xr-xjs/panels/properties.reel/properties.js25
6 files changed, 41 insertions, 8 deletions
diff --git a/js/components/ui/color-chip.reel/color-chip.js b/js/components/ui/color-chip.reel/color-chip.js
index 4e64b2e8..630dcd4b 100755
--- a/js/components/ui/color-chip.reel/color-chip.js
+++ b/js/components/ui/color-chip.reel/color-chip.js
@@ -33,6 +33,11 @@ var ColorChip = exports.ColorChip = Montage.create(Component, {
33 value: {r:0, g:0, b:0, a:1, css:'rgb(0,0,0)', mode:'rgb'} 33 value: {r:0, g:0, b:0, a:1, css:'rgb(0,0,0)', mode:'rgb'}
34 }, 34 },
35 35
36 chipBtn: {
37 serializable: true,
38 value: null
39 },
40
36 changeDelegate: { 41 changeDelegate: {
37 value: function(event) { 42 value: function(event) {
38 this.color = event._event.color; 43 this.color = event._event.color;
@@ -60,7 +65,7 @@ var ColorChip = exports.ColorChip = Montage.create(Component, {
60 this.icon.style.display = "none"; 65 this.icon.style.display = "none";
61 } 66 }
62 67
63 this.chipBtn.props = {side: 'right', align: 'top', wheel: true, palette: true, gradient: true, image: true, offset: this.offset}; 68 this.chipBtn.props = {side: 'right', align: 'top', wheel: true, palette: true, gradient: true, image: true, nocolor: true, offset: this.offset};
64 this.application.ninja.colorController.addButton(this.mode, this.chipBtn); 69 this.application.ninja.colorController.addButton(this.mode, this.chipBtn);
65 70
66 } 71 }
@@ -80,9 +85,13 @@ var ColorChip = exports.ColorChip = Montage.create(Component, {
80 b = colorObj.value.b; 85 b = colorObj.value.b;
81 a = colorObj.value.a; 86 a = colorObj.value.a;
82 css = colorObj.css; 87 css = colorObj.css;
88 this.chipBtn.color(mode, {wasSetByCode: true, type: 'change', color: {r: r, g: g, b: b}, css: css});
89 } else {
90 mode = "nocolor";
91 this.chipBtn.color(mode, null);
92
83 } 93 }
84 94
85 this.chipBtn.color(mode, {wasSetByCode: true, type: 'change', color: {r: r, g: g, b: b}, css: css});
86 this.chipBtn.addEventListener("change", this, false); 95 this.chipBtn.addEventListener("change", this, false);
87 } 96 }
88 } 97 }
diff --git a/js/controllers/document-controller.js b/js/controllers/document-controller.js
index f1523d87..7721d32d 100755
--- a/js/controllers/document-controller.js
+++ b/js/controllers/document-controller.js
@@ -489,6 +489,8 @@ var DocumentController = exports.DocumentController = Montage.create(Component,
489 if(currentDocument) { 489 if(currentDocument) {
490 currentDocument.serializeDocument(); 490 currentDocument.serializeDocument();
491 491
492 this.application.ninja.selectionController._selectionContainer = null;
493 currentDocument.model.views.design.propertiesPanel.clear();
492 currentDocument.model.views.design.hide(); 494 currentDocument.model.views.design.hide();
493 } 495 }
494 496
diff --git a/js/controllers/elements/body-controller.js b/js/controllers/elements/body-controller.js
index 5c23dcf7..7a3a66f5 100755
--- a/js/controllers/elements/body-controller.js
+++ b/js/controllers/elements/body-controller.js
@@ -30,7 +30,7 @@ exports.BodyController = Montage.create(ElementController, {
30 value: function(el, p) { 30 value: function(el, p) {
31 switch(p) { 31 switch(p) {
32 case "background" : 32 case "background" :
33 return this.application.ninja.colorController.getColorObjFromCss(this.application.ninja.stylesController.getElementStyle(el, "background-color", true, true)); 33 return this.application.ninja.colorController.getColorObjFromCss(this.application.ninja.stylesController.getElementStyle(el, "background-color", false, true));
34 case "border": 34 case "border":
35 return 0; 35 return 0;
36 case "height": 36 case "height":
diff --git a/js/document/views/design.js b/js/document/views/design.js
index 2ccb82d1..44f1a5e8 100755
--- a/js/document/views/design.js
+++ b/js/document/views/design.js
@@ -64,6 +64,11 @@ exports.DesignDocumentView = Montage.create(BaseDocumentView, {
64 }, 64 },
65 //////////////////////////////////////////////////////////////////// 65 ////////////////////////////////////////////////////////////////////
66 // 66 //
67 propertiesPanel: {
68 value: null
69 },
70 ////////////////////////////////////////////////////////////////////
71 //
67 initialize: { 72 initialize: {
68 value: function (parent) { 73 value: function (parent) {
69 //Creating iFrame for view 74 //Creating iFrame for view
diff --git a/js/ninja.reel/ninja.js b/js/ninja.reel/ninja.js
index 6d41cd53..80d1b406 100755
--- a/js/ninja.reel/ninja.js
+++ b/js/ninja.reel/ninja.js
@@ -280,7 +280,7 @@ exports.Ninja = Montage.create(Component, {
280 this.currentDocument = event.detail; 280 this.currentDocument = event.detail;
281 281
282 if(this.currentDocument.documentRoot) { 282 if(this.currentDocument.documentRoot) {
283 this.application.ninja.currentSelectedContainer = this.currentDocument.documentRoot; 283 this.currentSelectedContainer = this.currentDocument.documentRoot;
284 } else { 284 } else {
285 alert("The current document has not loaded yet"); 285 alert("The current document has not loaded yet");
286 return; 286 return;
diff --git a/js/panels/properties.reel/properties.js b/js/panels/properties.reel/properties.js
index 4d048472..eb362796 100755
--- a/js/panels/properties.reel/properties.js
+++ b/js/panels/properties.reel/properties.js
@@ -46,7 +46,7 @@ exports.Properties = Montage.create(Component, {
46 46
47 prepareForDraw: { 47 prepareForDraw: {
48 value : function() { 48 value : function() {
49 49 this.eventManager.addEventListener("openDocument", this, false);
50 this.eventManager.addEventListener("selectionChange", this, false); 50 this.eventManager.addEventListener("selectionChange", this, false);
51 51
52 // This will be a toggle option 52 // This will be a toggle option
@@ -54,8 +54,6 @@ exports.Properties = Montage.create(Component, {
54 this.eventManager.addEventListener( "elementChanging", this, false); 54 this.eventManager.addEventListener( "elementChanging", this, false);
55 } 55 }
56 56
57 this.eventManager.addEventListener("openDocument", this, false);
58
59 this.elementId.element.addEventListener("blur", this, false); 57 this.elementId.element.addEventListener("blur", this, false);
60 this.elementId.element.addEventListener("focus", this, false); 58 this.elementId.element.addEventListener("focus", this, false);
61 this.elementId.element.addEventListener("keyup", this, false); 59 this.elementId.element.addEventListener("keyup", this, false);
@@ -70,6 +68,9 @@ exports.Properties = Montage.create(Component, {
70 value: function() { 68 value: function() {
71 this.eventManager.addEventListener( "elementChange", this, false); 69 this.eventManager.addEventListener( "elementChange", this, false);
72 70
71 // Save a reference of the pi inside the document view to be able to clear
72 this.application.ninja.currentDocument.model.views.design.propertiesPanel = this;
73
73 // Display the default document root PI 74 // Display the default document root PI
74 this.displayElementProperties(this.application.ninja.currentDocument.documentRoot); 75 this.displayElementProperties(this.application.ninja.currentDocument.documentRoot);
75 } 76 }
@@ -165,6 +166,15 @@ exports.Properties = Montage.create(Component, {
165 } 166 }
166 }, 167 },
167 168
169 clear: {
170 value: function() {
171 this.elementName.value = "";
172 this.elementId.value = "";
173 this.elementClass.value = "";
174 this.customPi = null;
175 }
176 },
177
168 displayElementProperties: { 178 displayElementProperties: {
169 value: function (el) { 179 value: function (el) {
170 var customPI, currentValue, isRoot = this.application.ninja.selectionController.isDocument; 180 var customPI, currentValue, isRoot = this.application.ninja.selectionController.isDocument;
@@ -210,9 +220,16 @@ exports.Properties = Montage.create(Component, {
210 this.displayCustomProperties(el, el.elementModel.pi); 220 this.displayCustomProperties(el, el.elementModel.pi);
211 } 221 }
212 222
223 // Root element color chip
213 if(isRoot) { 224 if(isRoot) {
214 var backgroundChip = this.customSections[0].content.controls["background"]; 225 var backgroundChip = this.customSections[0].content.controls["background"];
215 if(backgroundChip) backgroundChip.color = ElementsMediator.getProperty(el, "background"); 226 var rootBackgroundColor = ElementsMediator.getProperty(el, "background");
227
228 if(rootBackgroundColor) {
229 backgroundChip.color = rootBackgroundColor;
230 } else {
231 backgroundChip.color = null;
232 }
216 } 233 }
217 234
218 var previousInput = this.application.ninja.colorController.colorModel.input; 235 var previousInput = this.application.ninja.colorController.colorModel.input;