From 3f9cbffd7986cc5f42720ba38ca82c6424ba8916 Mon Sep 17 00:00:00 2001 From: Jose Antonio Marquez Date: Mon, 4 Jun 2012 11:58:53 -0700 Subject: Adding lib copy blocking to preview This fixes an issue with launching preview before libraries were copied, hence, first time run would fail. Need to add a feedback screen for this process. --- js/document/models/base.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'js/document/models') diff --git a/js/document/models/base.js b/js/document/models/base.js index 76a5e62b..27f7d43f 100755 --- a/js/document/models/base.js +++ b/js/document/models/base.js @@ -103,7 +103,7 @@ exports.BaseDocumentModel = Montage.create(Component, { //Generating URL for document var url = this.application.ninja.coreIoApi.rootUrl + this.file.uri.split(this.application.ninja.coreIoApi.cloudData.root)[1]; //TODO: Add logic to prompt user to save (all) before preview - this.saveAll(function (result) { + this.saveAll(null,function (result) { //Currently only supporting current browser (Chrome, obviously) switch (this.browser) { case 'chrome': @@ -145,7 +145,7 @@ exports.BaseDocumentModel = Montage.create(Component, { //////////////////////////////////////////////////////////////////// // save: { - value: function (callback) { + value: function (callback, libCopyCallback) { // if (this.needsSave) { //Save @@ -165,7 +165,7 @@ exports.BaseDocumentModel = Montage.create(Component, { head: this.views.design.iframe.contentWindow.document.head, body: this.views.design.iframe.contentWindow.document.body, mjsTemplateCreator: this.views.design.iframe.contentWindow.mjsTemplateCreator - }, this.handleSaved.bind({callback: callback, model: this})); + }, this.handleSaved.bind({callback: callback, model: this}), libCopyCallback); } else { //TODO: Add logic to save code view data } @@ -174,7 +174,7 @@ exports.BaseDocumentModel = Montage.create(Component, { //////////////////////////////////////////////////////////////////// // saveAll: { - value: function (callback) { + value: function (callback, libCopyCallback) { // if (this.needsSave) { //Save @@ -194,7 +194,7 @@ exports.BaseDocumentModel = Montage.create(Component, { head: this.views.design.iframe.contentWindow.document.head, body: this.views.design.iframe.contentWindow.document.body, mjsTemplateCreator: this.views.design.iframe.contentWindow.mjsTemplateCreator - }, this.handleSaved.bind({callback: callback, model: this})); + }, this.handleSaved.bind({callback: callback, model: this}), libCopyCallback); } else { //TODO: Add logic to save code view data } -- cgit v1.2.3 From 1b8586c07951accbc3c0f3951966e4e258b0c5d9 Mon Sep 17 00:00:00 2001 From: Jose Antonio Marquez Date: Mon, 4 Jun 2012 15:34:57 -0700 Subject: Adding saving blocking screen This is for chrome preview, also fixed other preview bug with plain files not opening in preview. --- js/document/models/base.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'js/document/models') diff --git a/js/document/models/base.js b/js/document/models/base.js index 27f7d43f..0957145a 100755 --- a/js/document/models/base.js +++ b/js/document/models/base.js @@ -99,11 +99,20 @@ exports.BaseDocumentModel = Montage.create(Component, { //////////////////////////////////////////////////////////////////// //TODO: Add API to allow other browser support browserPreview: { - value: function (browser) { + value: function (browser, screen, context) { + //Making call to show feedback screen + if (screen) screen.show(context); //Generating URL for document var url = this.application.ninja.coreIoApi.rootUrl + this.file.uri.split(this.application.ninja.coreIoApi.cloudData.root)[1]; //TODO: Add logic to prompt user to save (all) before preview - this.saveAll(null,function (result) { + this.saveAll(null,function (success) { + //Making call to show feedback screen + if (screen) screen.hide(context); + //TODO: Add error handling logic + if (!success) { + console.log('Error!'); + return; + } //Currently only supporting current browser (Chrome, obviously) switch (this.browser) { case 'chrome': -- cgit v1.2.3