From 50a40c4e21b9a4d53d6d1fb739d838c0319ab09b Mon Sep 17 00:00:00 2001 From: Ananya Sen Date: Mon, 13 Feb 2012 19:55:46 -0800 Subject: new file dialog - preselect default template Signed-off-by: Ananya Sen --- .../new-file-options-navigator.js | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'js/io') 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 848e0cb8..f5ab0027 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 @@ -88,6 +88,9 @@ var NewFileOptionsNavigator = exports.NewFileOptionsNavigator = Montage.create(C var templates = this.newFileModel.prepareContents(this.newFileModel.defaultProjectType); this.templateList = iconsListModule.IconsList.create(); this.templateList.iconsViewDataObject = templates; + if(templates.length >0){ + this.templateList.selected = templates[0].uri; + } this.templateList.element = this.templateIcons; this.templateList.needsDraw = true; @@ -161,9 +164,15 @@ var NewFileOptionsNavigator = exports.NewFileOptionsNavigator = Montage.create(C var templates = this.newFileModel.prepareContents(evt.uri); if(this.templatesContainer.querySelectorAll(".list").length > 0){ this.templateList.iconsViewDataObject = templates; + if(templates.length >0){ + this.templateList.selected = templates[0].uri; + } }else{ this.templateList = iconsListModule.IconsList.create(); this.templateList.iconsViewDataObject = templates; + if(templates.length >0){ + this.templateList.selected = templates[0].uri; + } this.templateList.element = this.templateIcons; this.templateList.needsDraw = true; } -- cgit v1.2.3