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. --- js/io/templates/descriptor.json | 59 ++++++++++++++++++++-- js/io/templates/files/banner.txt | 13 +++++ .../new-file-options-navigator.js | 11 ++-- 3 files changed, 76 insertions(+), 7 deletions(-) create mode 100755 js/io/templates/files/banner.txt (limited to 'js/io') diff --git a/js/io/templates/descriptor.json b/js/io/templates/descriptor.json index 21c4b58c..0b2b70e5 100644 --- a/js/io/templates/descriptor.json +++ b/js/io/templates/descriptor.json @@ -1,13 +1,21 @@ { "categories":{ - "children":["/"] + "children":["/basic", "/template"] }, - "/":{ + + "/basic":{ "name":"Blank File", - "uri":"/", + "uri":"/basic", "type":"directory", "children":["js/io/templates/files/html.txt", "js/io/templates/files/js.txt", "js/io/templates/files/css.txt", "js/io/templates/files/json.txt", "js/io/templates/files/php.txt", "js/io/templates/files/pl.txt", "js/io/templates/files/py.txt", "js/io/templates/files/rb.txt", "js/io/templates/files/xml.txt"] }, + "/template":{ + "name":"Template", + "uri":"/template", + "type":"directory", + "children":["js/io/templates/files/banner.txt"] + }, + "js/io/templates/files/html.txt":{ "name":"HTML", "uri":"js/io/templates/files/html.txt", @@ -75,6 +83,49 @@ "name": "Basic", "uri": "defaultTemplate", "type":"file" + }, + + "js/io/templates/files/banner.txt":{ + "name":"Banner", + "uri":"js/io/templates/files/banner.txt", + "type":"file", + "fileExtension":".html", + "children":["120x600", "160x600", "200x200", "250x250", "300x250", "336x280", "550x400"] + }, + + "120x600":{ + "name": "Skyscraper", + "uri": "120x600", + "type":"file" + }, + "160x600":{ + "name": "Wide Skyscraper", + "uri": "160x600", + "type":"file" + }, + "200x200":{ + "name": "Small Square", + "uri": "200x200", + "type":"file" + }, + "250x250":{ + "name": "Square", + "uri": "250x250", + "type":"file" + }, + "300x250":{ + "name": "Medium Rectangle", + "uri": "300x250", + "type":"file" + }, + "336x280":{ + "name": "Large Rectangle", + "uri": "336x280", + "type":"file" + }, + "550x400":{ + "name": "Animation Default", + "uri": "550x400", + "type":"file" } - } \ No newline at end of file diff --git a/js/io/templates/files/banner.txt b/js/io/templates/files/banner.txt new file mode 100755 index 00000000..fdafe4f6 --- /dev/null +++ b/js/io/templates/files/banner.txt @@ -0,0 +1,13 @@ + + +
+ + + + + + + +
\ No newline at end of file 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