diff options
author | Jose Antonio Marquez | 2012-05-24 00:07:23 -0700 |
---|---|---|
committer | Jose Antonio Marquez | 2012-05-24 00:07:23 -0700 |
commit | 5914c5b2209c4b8daac4249bb76cda5c9314c4e6 (patch) | |
tree | f0910e57f64d1638f00bf7f6449d479fb377bfac /js | |
parent | 16decc5726eafbb25675c61be6df85a378ac1fac (diff) | |
download | ninja-5914c5b2209c4b8daac4249bb76cda5c9314c4e6.tar.gz |
Cleaning up referencing to 'documentRoot' and '_document'
Moved to reference new model in DOM architecture rework. This should not affect anything, just moving the references, and also the setting to the render methods in the design view.
Diffstat (limited to 'js')
34 files changed, 160 insertions, 163 deletions
diff --git a/js/components/layout/bread-crumb.reel/bread-crumb.js b/js/components/layout/bread-crumb.reel/bread-crumb.js index d2a6b1e4..2db775eb 100755 --- a/js/components/layout/bread-crumb.reel/bread-crumb.js +++ b/js/components/layout/bread-crumb.reel/bread-crumb.js | |||
@@ -23,7 +23,7 @@ exports.Breadcrumb = Montage.create(Component, { | |||
23 | value: function(){ | 23 | value: function(){ |
24 | if(!this.application.ninja.documentController.activeDocument) { | 24 | if(!this.application.ninja.documentController.activeDocument) { |
25 | this.disabled = true; | 25 | this.disabled = true; |
26 | this.application.ninja.currentSelectedContainer = (this.application.ninja.currentDocument ? this.application.ninja.currentDocument.documentRoot : null); | 26 | this.application.ninja.currentSelectedContainer = (this.application.ninja.currentDocument ? this.application.ninja.currentDocument.model.documentRoot : null); |
27 | } | 27 | } |
28 | } | 28 | } |
29 | }, | 29 | }, |
@@ -65,7 +65,7 @@ exports.Breadcrumb = Montage.create(Component, { | |||
65 | 65 | ||
66 | parentNode = this.container; | 66 | parentNode = this.container; |
67 | 67 | ||
68 | while(parentNode !== this.application.ninja.currentDocument.documentRoot) { | 68 | while(parentNode !== this.application.ninja.currentDocument.model.documentRoot) { |
69 | this.containerElements.unshift({"node": parentNode, "nodeUuid":parentNode.uuid, "label": parentNode.nodeName}); | 69 | this.containerElements.unshift({"node": parentNode, "nodeUuid":parentNode.uuid, "label": parentNode.nodeName}); |
70 | parentNode = parentNode.parentNode; | 70 | parentNode = parentNode.parentNode; |
71 | } | 71 | } |
diff --git a/js/controllers/document-controller.js b/js/controllers/document-controller.js index 4edcff48..f84e4da5 100755 --- a/js/controllers/document-controller.js +++ b/js/controllers/document-controller.js | |||
@@ -475,7 +475,7 @@ var DocumentController = exports.DocumentController = Montage.create(Component, | |||
475 | this.activeDocument = doc; | 475 | this.activeDocument = doc; |
476 | 476 | ||
477 | // Initialize the documentRoot styles | 477 | // Initialize the documentRoot styles |
478 | this.initializeRootStyles(doc.documentRoot); | 478 | this.initializeRootStyles(doc.model.documentRoot); |
479 | // Flag to stop stylesheet dirty event | 479 | // Flag to stop stylesheet dirty event |
480 | this._hackInitialStyles = false; | 480 | this._hackInitialStyles = false; |
481 | 481 | ||
diff --git a/js/controllers/selection-controller.js b/js/controllers/selection-controller.js index 1092615a..7bef0db8 100755 --- a/js/controllers/selection-controller.js +++ b/js/controllers/selection-controller.js | |||
@@ -114,7 +114,7 @@ exports.SelectionController = Montage.create(Component, { | |||
114 | value: function(event) { | 114 | value: function(event) { |
115 | var selected = [], childNodes = [], self = this; | 115 | var selected = [], childNodes = [], self = this; |
116 | 116 | ||
117 | childNodes = this.application.ninja.currentDocument.documentRoot.childNodes; | 117 | childNodes = this.application.ninja.currentDocument.model.documentRoot.childNodes; |
118 | childNodes = Array.prototype.slice.call(childNodes, 0); | 118 | childNodes = Array.prototype.slice.call(childNodes, 0); |
119 | childNodes.forEach(function(item) { | 119 | childNodes.forEach(function(item) { |
120 | if(self.isNodeTraversable(item)) { | 120 | if(self.isNodeTraversable(item)) { |
@@ -256,10 +256,10 @@ exports.SelectionController = Montage.create(Component, { | |||
256 | 256 | ||
257 | for(var i=0, uuid; this.application.ninja.selectedElements[i];i++) { | 257 | for(var i=0, uuid; this.application.ninja.selectedElements[i];i++) { |
258 | // Check for multiple selection and excluding inner elements | 258 | // Check for multiple selection and excluding inner elements |
259 | if(item.parentNode && item.parentNode !== this.application.ninja.currentDocument.documentRoot) { | 259 | if(item.parentNode && item.parentNode !== this.application.ninja.currentDocument.model.documentRoot) { |
260 | var outerElement = item.parentNode; | 260 | var outerElement = item.parentNode; |
261 | 261 | ||
262 | while(outerElement.parentNode && outerElement.parentNode !== this.application.ninja.currentDocument.documentRoot) { | 262 | while(outerElement.parentNode && outerElement.parentNode !== this.application.ninja.currentDocument.model.documentRoot) { |
263 | outerElement = outerElement.parentNode; | 263 | outerElement = outerElement.parentNode; |
264 | } | 264 | } |
265 | 265 | ||
diff --git a/js/controllers/styles-controller.js b/js/controllers/styles-controller.js index dcbe0eaf..04e87ba7 100755 --- a/js/controllers/styles-controller.js +++ b/js/controllers/styles-controller.js | |||
@@ -99,7 +99,7 @@ var stylesController = exports.StylesController = Montage.create(Component, { | |||
99 | // Setter will handle null case | 99 | // Setter will handle null case |
100 | this.defaultStylesheet = this.getSheetFromElement(this.CONST.DEFAULT_SHEET_ID); | 100 | this.defaultStylesheet = this.getSheetFromElement(this.CONST.DEFAULT_SHEET_ID); |
101 | 101 | ||
102 | this.userStyleSheets = nj.toArray(document._document.styleSheets).filter(function(sheet) { | 102 | this.userStyleSheets = nj.toArray(document.model.views.design.document.styleSheets).filter(function(sheet) { |
103 | return sheet !== this._stageStylesheet; | 103 | return sheet !== this._stageStylesheet; |
104 | }, this); | 104 | }, this); |
105 | 105 | ||
@@ -132,7 +132,7 @@ var stylesController = exports.StylesController = Montage.create(Component, { | |||
132 | else if(this._activeDocument.model && this._activeDocument.model.views && this._activeDocument.model.views.design){ | 132 | else if(this._activeDocument.model && this._activeDocument.model.views && this._activeDocument.model.views.design){ |
133 | ///// Use the last stylesheet in the document as the default | 133 | ///// Use the last stylesheet in the document as the default |
134 | 134 | ||
135 | var sheets = this._activeDocument._document.styleSheets, | 135 | var sheets = this._activeDocument.model.views.design.document.styleSheets, |
136 | lastIndex = sheets.length-1; | 136 | lastIndex = sheets.length-1; |
137 | 137 | ||
138 | ///// If the only sheet is the stage stylesheet, this will be true | 138 | ///// If the only sheet is the stage stylesheet, this will be true |
@@ -887,7 +887,7 @@ var stylesController = exports.StylesController = Montage.create(Component, { | |||
887 | 887 | ||
888 | getAnimationRuleWithName : { | 888 | getAnimationRuleWithName : { |
889 | value: function(name, document) { | 889 | value: function(name, document) { |
890 | var doc = document || this._activeDocument._document, | 890 | var doc = document || this._activeDocument.model.views.design.document, |
891 | animRules = this.getDocumentAnimationRules(doc), | 891 | animRules = this.getDocumentAnimationRules(doc), |
892 | rule, i; | 892 | rule, i; |
893 | 893 | ||
@@ -909,7 +909,7 @@ var stylesController = exports.StylesController = Montage.create(Component, { | |||
909 | 909 | ||
910 | getDocumentAnimationRules : { | 910 | getDocumentAnimationRules : { |
911 | value: function(document) { | 911 | value: function(document) { |
912 | var sheets = (document) ? document.styleSheets : this._activeDocument._document.styleSheets, | 912 | var sheets = (document) ? document.styleSheets : this._activeDocument.model.views.design.document.styleSheets, |
913 | rules = []; | 913 | rules = []; |
914 | 914 | ||
915 | nj.toArray(sheets).forEach(function(sheet) { | 915 | nj.toArray(sheets).forEach(function(sheet) { |
@@ -1272,7 +1272,7 @@ var stylesController = exports.StylesController = Montage.create(Component, { | |||
1272 | 1272 | ||
1273 | createStylesheet : { | 1273 | createStylesheet : { |
1274 | value: function(id, document) { | 1274 | value: function(id, document) { |
1275 | var doc = document || this._activeDocument._document, | 1275 | var doc = document || this._activeDocument.model.views.design.document, |
1276 | sheetElement, sheet; | 1276 | sheetElement, sheet; |
1277 | 1277 | ||
1278 | sheetElement = nj.make('style', { | 1278 | sheetElement = nj.make('style', { |
@@ -1329,7 +1329,7 @@ var stylesController = exports.StylesController = Montage.create(Component, { | |||
1329 | 1329 | ||
1330 | getSheetFromElement : { | 1330 | getSheetFromElement : { |
1331 | value : function(element, context) { | 1331 | value : function(element, context) { |
1332 | var doc = context || this._activeDocument._document, | 1332 | var doc = context || this._activeDocument.model.views.design.document, |
1333 | el = (typeof element === 'string') ? nj.$(element, doc) : element; | 1333 | el = (typeof element === 'string') ? nj.$(element, doc) : element; |
1334 | 1334 | ||
1335 | if(el && el.sheet) { | 1335 | if(el && el.sheet) { |
@@ -1572,7 +1572,7 @@ var stylesController = exports.StylesController = Montage.create(Component, { | |||
1572 | getStyleTest : function() { | 1572 | getStyleTest : function() { |
1573 | var properties = ['background-position', 'width', 'height']; | 1573 | var properties = ['background-position', 'width', 'height']; |
1574 | 1574 | ||
1575 | var el = stylesController.activeDocument._document.getElementById('Div_1'); | 1575 | var el = stylesController.activeDocument.model.views.design.document.getElementById('Div_1'); |
1576 | 1576 | ||
1577 | properties.forEach(function(prop) { | 1577 | properties.forEach(function(prop) { |
1578 | console.log('Getting value for "' + prop + '": ' + stylesController.getElementStyle(el, prop, true)); | 1578 | console.log('Getting value for "' + prop + '": ' + stylesController.getElementStyle(el, prop, true)); |
@@ -1591,7 +1591,7 @@ var stylesController = exports.StylesController = Montage.create(Component, { | |||
1591 | }); | 1591 | }); |
1592 | }, | 1592 | }, |
1593 | getMatchingRulesTest : function() { | 1593 | getMatchingRulesTest : function() { |
1594 | var el = stylesController.activeDocument._document.getElementById('Div_1'), | 1594 | var el = stylesController.activeDocument.model.views.design.document.getElementById('Div_1'), |