From c87e538fdc337639bc4d54bb087dbf2b4f20297f Mon Sep 17 00:00:00 2001 From: Jose Antonio Marquez Date: Fri, 11 May 2012 14:41:20 -0700 Subject: Adding support for new templates This is supported for NEW and OPEN, SAVE is not supported yet by I/O. Saving works, but it will not be a banner template. --- .../new-file-options-navigator.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'js/io/ui/new-file-dialog') diff --git a/js/io/ui/new-file-dialog/new-file-options-navigator.reel/new-file-options-navigator.js b/js/io/ui/new-file-dialog/new-file-options-navigator.reel/new-file-options-navigator.js index 1a26c99c..ebe2df61 100644 --- a/js/io/ui/new-file-dialog/new-file-options-navigator.reel/new-file-options-navigator.js +++ b/js/io/ui/new-file-dialog/new-file-options-navigator.reel/new-file-options-navigator.js @@ -249,7 +249,8 @@ var NewFileOptionsNavigator = exports.NewFileOptionsNavigator = Montage.create(C handleOkButtonAction:{ value: function(evt){ - var selectedProjectTypeID = this.selectedProjectType.uri, + var templateData, + selectedProjectTypeID = this.selectedProjectType.uri, templateID = this.selectedTemplate.uri, projectName = this.newFileLocation.newFileName.value, projectDirectory = this.newFileLocation.fileInputField.newFileDirectory.value, @@ -264,7 +265,10 @@ var NewFileOptionsNavigator = exports.NewFileOptionsNavigator = Montage.create(C "projectDirectory="+projectDirectory+"\n"+ "projectWidth="+projectWidth+"\n"+ "projectHeight="+projectHeight; - + //////////////////////////////////////////////////////////////////// + //Template data must be passed during file creation (lots of confusion data here, should be cleaned up…) + templateData = {id: templateID, name: this.newFileModel.projectTypeData[selectedProjectTypeID].name, type: this.newFileModel.projectTypeData[selectedProjectTypeID].type}; + //////////////////////////////////////////////////////////////////// if(/[^/\\]$/g.test(projectDirectory)){ projectDirectory = projectDirectory + "/"; @@ -285,7 +289,8 @@ var NewFileOptionsNavigator = exports.NewFileOptionsNavigator = Montage.create(C if(!!this.newFileModel.callback){//inform document-controller if save successful this.newFileModel.callback({"fileTemplateUri":selectedProjectTypeID, "newFilePath":newFilePath, - "fileExtension":fileExtension});//document-controller api + "fileExtension":fileExtension, + "template":templateData});//document-controller api }else{ //send selection event var newFileSelectionEvent = document.createEvent("Events"); -- cgit v1.2.3 From fd54dabad7cbc27a0efb0957155c00d578912909 Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Wed, 16 May 2012 15:32:36 -0700 Subject: changing @change to propertyChangeListener Signed-off-by: Valerio Virgillito --- js/io/ui/new-file-dialog/new-file-location.reel/new-file-location.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'js/io/ui/new-file-dialog') diff --git a/js/io/ui/new-file-dialog/new-file-location.reel/new-file-location.js b/js/io/ui/new-file-dialog/new-file-location.reel/new-file-location.js index 3ac38d02..e8a699cc 100755 --- a/js/io/ui/new-file-dialog/new-file-location.reel/new-file-location.js +++ b/js/io/ui/new-file-dialog/new-file-location.reel/new-file-location.js @@ -22,7 +22,7 @@ var NewFileLocation = exports.NewFileLocation = Montage.create(Component, { value: function() { this.fileInputField.selectDirectory = true; - this.addEventListener("change@newFileName.value", this.newFileNameChange, false); + this.addPropertyChangeListener("newFileName.value", this.newFileNameChange, false); this.newFileName.element.addEventListener("keyup", this, false); this.newFileName.element.focus(); this.newFileName.element.select(); -- cgit v1.2.3