From adfcc5cd732acd700f99c8159540b0f4b14d1931 Mon Sep 17 00:00:00 2001 From: David Norton Date: Mon, 5 Jun 2006 13:08:16 +0000 Subject: [PATCH] Collection rename works (presently, using a somewhat awkward "rename collection" button) Scholar Toolbar split into two (you can't really see much difference) - one for collections, one for items. Scholar Toolbar moved above lists. --- chrome/chromeFiles/content/scholar/overlay.js | 24 ++++++--- .../chromeFiles/content/scholar/overlay.xul | 51 ++++++++++--------- .../skin/default/scholar/overlay.css | 7 +-- 3 files changed, 50 insertions(+), 32 deletions(-) diff --git a/chrome/chromeFiles/content/scholar/overlay.js b/chrome/chromeFiles/content/scholar/overlay.js index dfc8b795cf..6b70fcf82a 100644 --- a/chrome/chromeFiles/content/scholar/overlay.js +++ b/chrome/chromeFiles/content/scholar/overlay.js @@ -17,6 +17,7 @@ var ScholarPane = new function() this.itemSelected = itemSelected; this.deleteItemSelection = deleteItemSelection; this.deleteCollectionSelection = deleteCollectionSelection; + this.renameSelectedCollection = renameSelectedCollection; this.search = search; this.toggleView = toggleView; @@ -89,16 +90,16 @@ var ScholarPane = new function() if(foldersView.selection.count == 1 && foldersView.selection.currentIndex != -1) { - itemsView = new Scholar.ItemTreeView(foldersView._getItemAtRow(foldersView.selection.currentIndex)); + var collection = foldersView._getItemAtRow(foldersView.selection.currentIndex); + + itemsView = new Scholar.ItemTreeView(collection); document.getElementById('items-tree').view = itemsView; - } - else if(foldersView.selection.count == 0) - { - document.getElementById('items-tree').view = itemsView = null; + document.getElementById('tb-rename').disabled = collection.isLibrary(); } else { document.getElementById('items-tree').view = itemsView = null; + document.getElementById('tb-rename').disabled = true; } } @@ -135,10 +136,21 @@ var ScholarPane = new function() function deleteCollectionSelection() { - if(itemsView && foldersView.selection.count > 0 && confirm("Are you sure you want to delete the selected collections?")) + if(foldersView.selection.count > 0 && confirm("Are you sure you want to delete the selected collections?")) foldersView.deleteSelection(); } + function renameSelectedCollection() + { + if(foldersView.selection.count > 0) + { + collection = foldersView._getItemAtRow(foldersView.selection.currentIndex); + + var newName = prompt('Rename collection:',collection.getName()); + if(newName) + collection.ref.rename(newName); + } + } function search() { if(itemsView) diff --git a/chrome/chromeFiles/content/scholar/overlay.xul b/chrome/chromeFiles/content/scholar/overlay.xul index 9b8a8e6663..1d8241c9bb 100644 --- a/chrome/chromeFiles/content/scholar/overlay.xul +++ b/chrome/chromeFiles/content/scholar/overlay.xul @@ -40,13 +40,17 @@ - - + + + + + + + flex="1"> - - + + + + + + + + + + + + + + + flex="1"> - - - - - - - - - - - - - - + + + diff --git a/chrome/chromeFiles/skin/default/scholar/overlay.css b/chrome/chromeFiles/skin/default/scholar/overlay.css index 48c8282f24..6c38069912 100644 --- a/chrome/chromeFiles/skin/default/scholar/overlay.css +++ b/chrome/chromeFiles/skin/default/scholar/overlay.css @@ -22,18 +22,19 @@ tree #items-tree } -#scholar-toolbar +#scholar-pane toolbar { border-bottom: none; background: #f5f5f5; + height: 24px; } -#scholar-toolbar toolbarbutton +#scholar-pane toolbar toolbarbutton { } -#scholar-toolbar .toggler +#scholar-pane toolbar .toggler { margin: 4px; }