From 646b269da2387582531258d14a3f2ff550617323 Mon Sep 17 00:00:00 2001 From: Jose Antonio Marquez Date: Tue, 14 Feb 2012 11:45:57 -0800 Subject: Cleaning up mediator --- js/mediators/io-mediator.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'js/mediators') diff --git a/js/mediators/io-mediator.js b/js/mediators/io-mediator.js index 95e775a0..599b7d84 100644 --- a/js/mediators/io-mediator.js +++ b/js/mediators/io-mediator.js @@ -155,9 +155,8 @@ exports.IoMediator = Montage.create(Component, { } // save = this.fio.saveFile({uri: file.document.uri, contents: contents}); - if(save.status === 204){ - callback(); - } + // + if (callback) callback(save); } }, //////////////////////////////////////////////////////////////////// @@ -170,6 +169,14 @@ exports.IoMediator = Montage.create(Component, { }, //////////////////////////////////////////////////////////////////// // + fileDelete: { + enumerable: false, + value: function (file, callback) { + // + } + }, + //////////////////////////////////////////////////////////////////// + // parseHtmlToNinjaTemplate: { enumerable: false, value: function (html) { -- cgit v1.2.3 From e327eccb93e2bc513fcbb7ab302783d6bce83884 Mon Sep 17 00:00:00 2001 From: Jose Antonio Marquez Date: Tue, 14 Feb 2012 22:30:51 -0800 Subject: Creating NinjaTemplate to HTML function This function will need to be cleaned up and possibly moved once the MVC structure is in-place for the document. --- js/mediators/io-mediator.js | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) (limited to 'js/mediators') diff --git a/js/mediators/io-mediator.js b/js/mediators/io-mediator.js index 599b7d84..2008e40f 100644 --- a/js/mediators/io-mediator.js +++ b/js/mediators/io-mediator.js @@ -142,12 +142,7 @@ exports.IoMediator = Montage.create(Component, { // switch (file.mode) { case 'html': - file.document.content.document.body.innerHTML = file.body; - file.document.content.document.head.innerHTML = file.head; - if (file.style) { - file.document.content.document.head.getElementsByTagName('style')[0].innerHTML = this.getCssFromRules(file.style.cssRules); - } - contents = file.document.content.document.documentElement.outerHTML; + contents = this.parseNinjaTemplateToHtml(file); break; default: contents = file.content; @@ -189,6 +184,21 @@ exports.IoMediator = Montage.create(Component, { } }, //////////////////////////////////////////////////////////////////// + //TODO: Expand to allow more templates + parseNinjaTemplateToHtml: { + enumerable: false, + value: function (template) { + // + template.document.content.document.body.innerHTML = template.body; + template.document.content.document.head.innerHTML = template.head; + //TODO: Remove temp fix for styles + if (template.style) { + template.document.content.document.head.getElementsByTagName('style')[0].innerHTML = this.getCssFromRules(template.style.cssRules); + } + return template.document.content.document.documentElement.outerHTML; + } + }, + //////////////////////////////////////////////////////////////////// //Method to return a string from CSS rules (to be saved to a file) getCssFromRules: { enumerable: false, -- cgit v1.2.3 From 075252ad893452df446566f01d0b26eeab08be3d Mon Sep 17 00:00:00 2001 From: Jose Antonio Marquez Date: Wed, 15 Feb 2012 23:07:00 -0800 Subject: Setting up webGL library copy on save --- js/mediators/io-mediator.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'js/mediators') diff --git a/js/mediators/io-mediator.js b/js/mediators/io-mediator.js index 2008e40f..e9958ec3 100644 --- a/js/mediators/io-mediator.js +++ b/js/mediators/io-mediator.js @@ -86,6 +86,7 @@ exports.IoMediator = Montage.create(Component, { case 204: //Creating and formatting result object for callbak result = read.file.details; + result.root = read.file.details.uri.replace(read.file.details.name, ""); //Checking for type of content to returns if (result.extension !== 'html' && result.extension !== 'htm') { //Simple string @@ -191,6 +192,17 @@ exports.IoMediator = Montage.create(Component, { // template.document.content.document.body.innerHTML = template.body; template.document.content.document.head.innerHTML = template.head; + // + if (template.webgl.length > 0) { + for (var i in this.application.ninja.coreIoApi.ninjaLibrary.libs) { + if (this.application.ninja.coreIoApi.ninjaLibrary.libs[i].name === 'Assets' || this.application.ninja.coreIoApi.ninjaLibrary.libs[i].name === 'RDGE') { + this.application.ninja.coreIoApi.ninjaLibrary.copyLibToCloud(template.document.root, (this.application.ninja.coreIoApi.ninjaLibrary.libs[i].name+this.application.ninja.coreIoApi.ninjaLibrary.libs[i].version).toLowerCase()); + } + } + + //this.application.ninja.coreIoApi.ninjaLibrary.copyLibToCloud(path, libname); + //console.log(this.application.ninja.coreIoApi.ninjaLibrary.libs); + } //TODO: Remove temp fix for styles if (template.style) { template.document.content.document.head.getElementsByTagName('style')[0].innerHTML = this.getCssFromRules(template.style.cssRules); -- cgit v1.2.3