From 75fe4f36a6768d688792bc1925cfa4bfa508ac3e Mon Sep 17 00:00:00 2001 From: Jose Antonio Marquez Date: Tue, 22 May 2012 18:02:01 -0700 Subject: Adding redirect from app folder in templates This doesn't resolve the issue of XHR requests made in Montage. --- js/document/views/design.js | 1 + 1 file changed, 1 insertion(+) (limited to 'js/document/views') diff --git a/js/document/views/design.js b/js/document/views/design.js index b3887fdf..6da1b2e4 100755 --- a/js/document/views/design.js +++ b/js/document/views/design.js @@ -105,6 +105,7 @@ exports.DesignDocumentView = Montage.create(BaseDocumentView, { // onTemplateLoad: { value: function (e) { + //console.log(this.iframe.contentWindow); this.application.ninja.documentController._hackRootFlag = true; //TODO: Add support to constructing URL with a base HREF var basetag = this.content.document.getElementsByTagName('base'); -- cgit v1.2.3 From f97590388467b5a3316f6f155162fc293915fddc Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Wed, 23 May 2012 16:09:22 -0700 Subject: Fixed scrolling and centering stage code. Also, moved liveNodeList into the design view and added an option to exclude styles and text nodes when retrieving the live nodes. Signed-off-by: Nivesh Rajbhandari --- js/document/views/design.js | 42 ++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 40 insertions(+), 2 deletions(-) (limited to 'js/document/views') diff --git a/js/document/views/design.js b/js/document/views/design.js index b3887fdf..427ef706 100755 --- a/js/document/views/design.js +++ b/js/document/views/design.js @@ -67,7 +67,43 @@ exports.DesignDocumentView = Montage.create(BaseDocumentView, { propertiesPanel: { value: null }, + //////////////////////////////////////////////////////////////////// + // + _liveNodeList: { + value: null + }, + + getLiveNodeList: { + value: function(useFilter) { + if(useFilter) { + var filteredNodes = [], + childNodes = Array.prototype.slice.call(this._liveNodeList, 0); + + childNodes.forEach(function(item) { + if( (item.nodeType === 1) && (item.nodeName !== "STYLE") && (item.nodeName !== "SCRIPT")) { + filteredNodes.push(item); + } + }); + return filteredNodes; + } else { + return this._liveNodeList; + } + } + }, + //////////////////////////////////////////////////////////////////// + // + + initialPaddingLeft: { + value: 0 + }, + + initialPaddingTop: { + value: 0 + }, + //////////////////////////////////////////////////////////////////// + // + // initialize: { value: function (parent) { @@ -190,8 +226,10 @@ exports.DesignDocumentView = Montage.create(BaseDocumentView, { //Calling standard method to finish opening document this.bodyContentLoaded(null); //TODO: Move this to be set via the controller - this.application.ninja.stage.documentOffsetLeft = parseInt((this.document.body.scrollWidth - this._template.size.width)/2); - this.application.ninja.stage.documentOffsetTop = parseInt((this.document.body.scrollHeight - this._template.size.height)/2); +// this.application.ninja.stage.documentOffsetLeft = parseInt((this.document.body.scrollWidth - this._template.size.width)/2); +// this.application.ninja.stage.documentOffsetTop = parseInt((this.document.body.scrollHeight - this._template.size.height)/2); +// this.initialPaddingLeft = parseInt((this.document.body.scrollWidth - this._template.size.width)/2); +// this.initialPaddingTop = parseInt((this.document.body.scrollHeight - this._template.size.height)/2); } }, //////////////////////////////////////////////////////////////////// -- cgit v1.2.3 From 5914c5b2209c4b8daac4249bb76cda5c9314c4e6 Mon Sep 17 00:00:00 2001 From: Jose Antonio Marquez Date: Thu, 24 May 2012 00:07:23 -0700 Subject: 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. --- js/document/views/design.js | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'js/document/views') diff --git a/js/document/views/design.js b/js/document/views/design.js index 6da1b2e4..a69b7a81 100755 --- a/js/document/views/design.js +++ b/js/document/views/design.js @@ -257,6 +257,14 @@ exports.DesignDocumentView = Montage.create(BaseDocumentView, { } else { //Else there is not data to parse } + //TODO: Verify appropiate location for this operation + if (this._template && this._template.type === 'banner') { + this.model.documentRoot = this.document.body.getElementsByTagName('ninja-content')[0]; + } else { + this.model.documentRoot = this.document.body; + } + //Initiliazing document model + document.application.njUtils.makeElementModel(this.model.documentRoot, "Body", "body"); //Makign callback if specified if (this._callback) this._callback(); } -- cgit v1.2.3 From 36c7e9a31e5197fee6824ffe746d715b24bcadcb Mon Sep 17 00:00:00 2001 From: Jose Antonio Marquez Date: Thu, 24 May 2012 00:25:14 -0700 Subject: Renaming variable as it will now be used This is no longer a temp fix, it might be a permanent boolean to open/close web-request API gates. --- js/document/views/base.js | 2 +- js/document/views/design.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'js/document/views') diff --git a/js/document/views/base.js b/js/document/views/base.js index db72cc60..d13dce1a 100755 --- a/js/document/views/base.js +++ b/js/document/views/base.js @@ -28,7 +28,7 @@ exports.BaseDocumentView = Montage.create(Component, { value: null }, //////////////////////////////////////////////////////////////////// - // + //TODO: This should be renamed to better illustrate it's a container (iframe for design, div for code view) iframe: { get: function() {return this._iframe;}, set: function(value) {this._iframe= value;} diff --git a/js/document/views/design.js b/js/document/views/design.js index a69b7a81..d1c75c01 100755 --- a/js/document/views/design.js +++ b/js/document/views/design.js @@ -87,7 +87,7 @@ exports.DesignDocumentView = Montage.create(BaseDocumentView, { render: { value: function (callback, template) { //TODO: Remove, this is a temp patch for webRequest API gate - this.application.ninja.documentController._hackRootFlag = false; + this.application.ninja.documentController.redirectRequests = false; //Storing callback for dispatch ready this._callback = callback; this._template = template; @@ -106,7 +106,7 @@ exports.DesignDocumentView = Montage.create(BaseDocumentView, { onTemplateLoad: { value: function (e) { //console.log(this.iframe.contentWindow); - this.application.ninja.documentController._hackRootFlag = true; + this.application.ninja.documentController.redirectRequests = true; //TODO: Add support to constructing URL with a base HREF var basetag = this.content.document.getElementsByTagName('base'); //Removing event -- cgit v1.2.3 From 1adc3b050728e393583f94eb2216db813d4a7293 Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Thu, 24 May 2012 11:20:42 -0700 Subject: Removed unused variables and methods in stage-deps, layout design, and snap-manager. Signed-off-by: Nivesh Rajbhandari --- js/document/views/design.js | 15 --------------- 1 file changed, 15 deletions(-) (limited to 'js/document/views') diff --git a/js/document/views/design.js b/js/document/views/design.js index 427ef706..4f5f8da9 100755 --- a/js/document/views/design.js +++ b/js/document/views/design.js @@ -94,16 +94,6 @@ exports.DesignDocumentView = Montage.create(BaseDocumentView, { //////////////////////////////////////////////////////////////////// // - initialPaddingLeft: { - value: 0 - }, - - initialPaddingTop: { - value: 0 - }, - //////////////////////////////////////////////////////////////////// - // - // initialize: { value: function (parent) { @@ -225,11 +215,6 @@ exports.DesignDocumentView = Montage.create(BaseDocumentView, { this._bodyFragment = null; //Calling standard method to finish opening document this.bodyContentLoaded(null); - //TODO: Move this to be set via the controller -// this.application.ninja.stage.documentOffsetLeft = parseInt((this.document.body.scrollWidth - this._template.size.width)/2); -// this.application.ninja.stage.documentOffsetTop = parseInt((this.document.body.scrollHeight - this._template.size.height)/2); -// this.initialPaddingLeft = parseInt((this.document.body.scrollWidth - this._template.size.width)/2); -// this.initialPaddingTop = parseInt((this.document.body.scrollHeight - this._template.size.height)/2); } }, //////////////////////////////////////////////////////////////////// -- cgit v1.2.3 From f801708f83aadfc688e69a244eb7cbaeca5d5e8d Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Thu, 24 May 2012 11:28:09 -0700 Subject: Getter for _liveNodeList should return a copy. Signed-off-by: Nivesh Rajbhandari --- js/document/views/design.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'js/document/views') diff --git a/js/document/views/design.js b/js/document/views/design.js index 4f5f8da9..13f89692 100755 --- a/js/document/views/design.js +++ b/js/document/views/design.js @@ -87,7 +87,7 @@ exports.DesignDocumentView = Montage.create(BaseDocumentView, { }); return filteredNodes; } else { - return this._liveNodeList; + return Array.prototype.slice.call(this._liveNodeList, 0); } } }, -- cgit v1.2.3 From a6db492176a85546047dae6d5ecb9cfc4325e043 Mon Sep 17 00:00:00 2001 From: Jose Antonio Marquez Date: Thu, 24 May 2012 11:44:35 -0700 Subject: Final clean up of render callback for design view --- js/document/views/design.js | 2 ++ 1 file changed, 2 insertions(+) (limited to 'js/document/views') diff --git a/js/document/views/design.js b/js/document/views/design.js index 06708957..d772aa86 100755 --- a/js/document/views/design.js +++ b/js/document/views/design.js @@ -286,6 +286,8 @@ exports.DesignDocumentView = Montage.create(BaseDocumentView, { } else { this.model.documentRoot = this.document.body; } + //Storing node list for reference (might need to store in the model) + this._liveNodeList = this.model.documentRoot.getElementsByTagName('*'); //Initiliazing document model document.application.njUtils.makeElementModel(this.model.documentRoot, "Body", "body"); //Makign callback if specified -- cgit v1.2.3