From 48beced355a5d4ee959ed41e104b0a343411658c Mon Sep 17 00:00:00 2001 From: Jose Antonio Marquez Date: Fri, 18 May 2012 16:33:10 -0700 Subject: Clean up and adding TODOs --- js/document/document-html.js | 18 +++++++++++++----- js/document/models/base.js | 2 +- 2 files changed, 14 insertions(+), 6 deletions(-) (limited to 'js/document') diff --git a/js/document/document-html.js b/js/document/document-html.js index 983da966..ae5b73b6 100755 --- a/js/document/document-html.js +++ b/js/document/document-html.js @@ -125,9 +125,10 @@ exports.HtmlDocument = Montage.create(Component, { // closeDocument: { value: function (context, callback) { + //Closing document and getting outcome var closed = this.model.close(null); - - callback.call(context, this); + //Making callback if specified + if (callback) callback.call(context, this); } }, //////////////////////////////////////////////////////////////////// @@ -139,6 +140,7 @@ exports.HtmlDocument = Montage.create(Component, { //this.gridVerticalSpacing = this.application.ninja.stage.drawUtils.gridVerticalSpacing; // Serialize the current scroll position + //TODO: Move these properties to the design view class this.model.scrollLeft = this.application.ninja.stage._scrollLeft; this.model.scrollTop = this.application.ninja.stage._scrollTop; this.model.userContentLeft = this.application.ninja.stage._userContentLeft; @@ -146,6 +148,7 @@ exports.HtmlDocument = Montage.create(Component, { // Serialize the selection + //TODO: Move this property to the design view class this.model.selection = this.application.ninja.selectedElements.slice(0); this.draw3DGrid = this.application.ninja.appModel.show3dGrid; @@ -153,8 +156,10 @@ exports.HtmlDocument = Montage.create(Component, { // TODO: Save the montage undo queue // Pause the videos + //TODO: Move these to be handled on the show/hide methods in the view this.model.views.design.pauseVideos(); - + + //TODO: Move this to the document controller this.model.isActive = false; } }, @@ -167,18 +172,21 @@ exports.HtmlDocument = Montage.create(Component, { //this.application.ninja.stage.drawUtils.gridVerticalSpacing = this.gridVerticalSpacing; // Deserialize the current scroll position + //TODO: Move these properties to the design view class this.application.ninja.stage._scrollLeft = this.model.scrollLeft; this.application.ninja.stage._scrollTop = this.model.scrollTop; this.application.ninja.stage._userContentLeft = this.model.userContentLeft; this.application.ninja.stage._userContentTop = this.model.userContentTop; - + + //TODO: Move this property to the design view class this.application.ninja.selectedElements = this.model.selection.slice(0); this.application.ninja.appModel.show3dGrid = this.draw3DGrid; // Serialize the undo // TODO: Save the montage undo queue - + + //TODO: Move this to the document controller this.model.isActive = true; } } diff --git a/js/document/models/base.js b/js/document/models/base.js index c99e36c7..6d9d2e89 100755 --- a/js/document/models/base.js +++ b/js/document/models/base.js @@ -100,7 +100,7 @@ exports.BaseDocumentModel = Montage.create(Component, { } break; default: - if (this.template.type === 'banner' || this.template.type === 'animation') { + if (this.template && (this.template.type === 'banner' || this.template.type === 'animation')) { window.open('/js/document/templates/preview/banner.html?width='+this.template.size.width+'&height='+this.template.size.height+'&url='+this.url); } else { window.open(this.url); -- cgit v1.2.3