From a6948e635389768fc316f1fb86df2524b482b47c Mon Sep 17 00:00:00 2001 From: Ananya Sen Date: Mon, 13 Feb 2012 18:48:18 -0800 Subject: added logical drive selection to file picker Signed-off-by: Ananya Sen --- .../ui/FilePicker/pickerNavigator.reel/pickerNavigator.js | 13 +++++++++++++ js/controllers/document-controller.js | 4 ++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/js/components/ui/FilePicker/pickerNavigator.reel/pickerNavigator.js b/js/components/ui/FilePicker/pickerNavigator.reel/pickerNavigator.js index ff9c7073..6b0d92f7 100644 --- a/js/components/ui/FilePicker/pickerNavigator.reel/pickerNavigator.js +++ b/js/components/ui/FilePicker/pickerNavigator.reel/pickerNavigator.js @@ -149,6 +149,12 @@ var PickerNavigator = exports.PickerNavigator = Montage.create(Component, { leftNav.appendChild(newDiv); if(dirObj.uri === this.pickerModel.currentRoot){ newDiv.classList.add("highlighted"); + //enable ok for logical drive selections, when in directory selection mode + if(this.pickerModel.inFileMode === false){ + this.okButton.removeAttribute("disabled"); + //put into selectedItems..currently single selection is supported + this.selectedItems = [dirObj.uri]; + } } newDiv.addEventListener("click", function(evt){that.handleTopLevelDirectoryClicks(evt, dirObj);}, false); @@ -571,6 +577,13 @@ var PickerNavigator = exports.PickerNavigator = Montage.create(Component, { if(!evt.target.classList.contains("highlighted")){ evt.target.classList.add("highlighted"); } + + //enable ok for logical drive selections, when in directory selection mode + if(this.pickerModel.inFileMode === false){ + this.okButton.removeAttribute("disabled"); + //put into selectedItems..currently single selection is supported + this.selectedItems = [dirObj.uri]; + } } }, diff --git a/js/controllers/document-controller.js b/js/controllers/document-controller.js index b066a9c2..21445214 100755 --- a/js/controllers/document-controller.js +++ b/js/controllers/document-controller.js @@ -251,7 +251,7 @@ DocumentController = exports.DocumentController = Montage.create(Component, { var closeDocumentIndex = this._findIndexByUUID(id); this._documents.splice(this._findIndexByUUID(id), 1); - if(this.activeDocument.uuid === id && this._documents.length > 0) { + if(this.activeDocument.uuid === id && this._documents.length > 0) {//closing the active document tab var nextDocumentIndex = -1 ; if((this._documents.length > 0) && (closeDocumentIndex === 0)){ nextDocumentIndex = 1; @@ -259,7 +259,7 @@ DocumentController = exports.DocumentController = Montage.create(Component, { nextDocumentIndex = closeDocumentIndex - 1; } this.application.ninja.stage.stageView.switchDocument(this._documents[nextDocumentIndex]); - }else{ + }else if(this._documents.length === 0){ //if there are no documents to switch to then just show the iframeContainer document.getElementById("iframeContainer").style.display="block"; } -- cgit v1.2.3 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 --- js/components/ui/icon-list-basic/icon.reel/icon.js | 14 ++++++++++++++ .../ui/icon-list-basic/iconsList.reel/iconsList.html | 5 +++++ .../ui/icon-list-basic/iconsList.reel/iconsList.js | 8 +++++++- .../new-file-options-navigator.js | 9 +++++++++ 4 files changed, 35 insertions(+), 1 deletion(-) diff --git a/js/components/ui/icon-list-basic/icon.reel/icon.js b/js/components/ui/icon-list-basic/icon.reel/icon.js index d934e7f1..b0279207 100755 --- a/js/components/ui/icon-list-basic/icon.reel/icon.js +++ b/js/components/ui/icon-list-basic/icon.reel/icon.js @@ -22,6 +22,13 @@ var Icon = exports.Icon = Montage.create(Component, { this.needsDraw = true; } }, + + selectedUri:{ + writable:true, + enumerable:true, + value:null + }, + metadata:{ enumerable:true, writable:true, @@ -83,6 +90,13 @@ var Icon = exports.Icon = Montage.create(Component, { if(this.icondata.creationDate){this.metadata = this.metadata + "
" + "Creation date: "+ this.formatTimestamp(this.icondata.creationDate);} if(this.icondata.modifiedDate){this.metadata = this.metadata + "
" + "Modified date: "+ this.formatTimestamp(this.icondata.modifiedDate);} + //show default selection + if(this.icondata.uri === this.selectedUri){ + var selectedItemEvent = document.createEvent("Events"); + selectedItemEvent.initEvent("selectedItem", false, false); + selectedItemEvent.uri = this.icondata.uri; + this.element.dispatchEvent(selectedItemEvent); + } } }, diff --git a/js/components/ui/icon-list-basic/iconsList.reel/iconsList.html b/js/components/ui/icon-list-basic/iconsList.reel/iconsList.html index 50a1d61d..0bb79873 100755 --- a/js/components/ui/icon-list-basic/iconsList.reel/iconsList.html +++ b/js/components/ui/icon-list-basic/iconsList.reel/iconsList.html @@ -21,6 +21,11 @@ "boundObject": {"@": "repetition1"}, "boundObjectPropertyPath": "objectAtCurrentIteration", "oneway": true + }, + "selectedUri": { + "boundObject": {"@": "owner"}, + "boundObjectPropertyPath": "selected", + "oneway": true } } }, diff --git a/js/components/ui/icon-list-basic/iconsList.reel/iconsList.js b/js/components/ui/icon-list-basic/iconsList.reel/iconsList.js index 56eb57c3..d36aa40f 100755 --- a/js/components/ui/icon-list-basic/iconsList.reel/iconsList.js +++ b/js/components/ui/icon-list-basic/iconsList.reel/iconsList.js @@ -15,11 +15,17 @@ var IconsList = exports.IconsList = Montage.create(Component, { }, iconsViewDataObject:{ - writable:true, + writable:true, enumerable:true, value:[] }, + selected:{ + writable:true, + enumerable:true, + value:null + }, + willDraw: { enumerable: false, value: function() { 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