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.
This commit is contained in:
parent
c4d2e77b27
commit
adfcc5cd73
3 changed files with 50 additions and 32 deletions
|
@ -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)
|
||||
|
|
|
@ -40,13 +40,17 @@
|
|||
</window>
|
||||
|
||||
<vbox id="appcontent">
|
||||
<vbox id="scholar-pane" position="1" persist="height collapsed">
|
||||
<hbox flex="1">
|
||||
<hbox id="scholar-pane" position="1" persist="height collapsed">
|
||||
<vbox persist="width" flex="1">
|
||||
<toolbar>
|
||||
<toolbarbutton label="&menuitem.newCollection.label;" command="cmd_scholar_newCollection"/>
|
||||
<toolbarbutton id="tb-rename" label="Rename Collection" oncommand="ScholarPane.renameSelectedCollection();" disabled="true"/>
|
||||
</toolbar>
|
||||
<tree id="folders-tree" hidecolumnpicker="true"
|
||||
onselect="ScholarPane.folderSelected();" seltype="single"
|
||||
ondragover="nsDragAndDrop.dragOver(event,ScholarCollectionsDragObserver)" ondragdrop="nsDragAndDrop.drop(event,ScholarCollectionsDragObserver)"
|
||||
onkeypress="if(event.keyCode == event.DOM_VK_BACK_SPACE || event.keyCode == event.DOM_VK_DELETE){ ScholarPane.deleteCollectionSelection(); return false; }"
|
||||
persist="width" flex="1">
|
||||
flex="1">
|
||||
<treecols>
|
||||
<treecol
|
||||
id="name_column"
|
||||
|
@ -55,14 +59,29 @@
|
|||
primary="true"/>
|
||||
</treecols>
|
||||
<treechildren/>
|
||||
</tree>
|
||||
<splitter id="scholar-tree-splitter" resizebefore="closest" resizeafter="closest"/>
|
||||
</tree>
|
||||
</vbox>
|
||||
<splitter id="scholar-tree-splitter" resizebefore="closest" resizeafter="closest"/>
|
||||
<vbox persist="width" flex="5">
|
||||
<toolbar align="center">
|
||||
<toolbarbutton id="tb-add" label="&menuitem.newItem.label;" type="menu">
|
||||
<menupopup>
|
||||
</menupopup>
|
||||
</toolbarbutton>
|
||||
<spacer flex="1"/>
|
||||
<toolbarbutton class="scholar-toggler" id="tb-metadata" label="Metadata" checked="true" oncommand="ScholarPane.toggleView('metadata')"/>
|
||||
<toolbarbutton class="scholar-toggler" id="tb-notes" label="Notes" checked="true" oncommand="ScholarPane.toggleView('notes')"/>
|
||||
<spacer flex="1"/>
|
||||
<label value="Search:" control="tb-search"/>
|
||||
<textbox id="tb-search" type="timed" timeout="500" command="cmd_scholar_search"/>
|
||||
<toolbarbutton class="tabs-closebutton" oncommand="ScholarPane.toggleDisplay()"/>
|
||||
</toolbar>
|
||||
<tree
|
||||
id="items-tree"
|
||||
enableColumnDrag="true" onkeypress="if(event.keyCode == event.DOM_VK_BACK_SPACE || event.keyCode == event.DOM_VK_DELETE){ ScholarPane.deleteItemSelection(); return false; }"
|
||||
onselect="ScholarPane.itemSelected();"
|
||||
ondraggesture="if (event.target.localName == 'treechildren') nsDragAndDrop.startDrag(event,ScholarItemsDragObserver);"
|
||||
persist="width" flex="5">
|
||||
flex="1">
|
||||
<treecols>
|
||||
<treecol
|
||||
id="title"
|
||||
|
@ -97,23 +116,9 @@
|
|||
|
||||
<treechildren/>
|
||||
</tree>
|
||||
</hbox>
|
||||
<toolbar id="scholar-toolbar" align="center">
|
||||
<toolbarbutton label="&menuitem.newCollection.label;" command="cmd_scholar_newCollection"/>
|
||||
<toolbarbutton id="tb-add" label="&menuitem.newItem.label;" type="menu">
|
||||
<menupopup>
|
||||
</menupopup>
|
||||
</toolbarbutton>
|
||||
<spacer flex="1"/>
|
||||
<!-- <toolbarbutton class="scholar-toggler" id="tb-view" label="View" checked="true" oncommand="ScholarPane.toggleView('view')"/> -->
|
||||
<toolbarbutton class="scholar-toggler" id="tb-metadata" label="Metadata" checked="true" oncommand="ScholarPane.toggleView('metadata')"/>
|
||||
<toolbarbutton class="scholar-toggler" id="tb-notes" label="Notes" checked="true" oncommand="ScholarPane.toggleView('notes')"/>
|
||||
<spacer flex="1"/>
|
||||
<label value="Search:" control="tb-search"/>
|
||||
<textbox id="tb-search" type="timed" timeout="500" command="cmd_scholar_search"/>
|
||||
<toolbarbutton class="tabs-closebutton" oncommand="ScholarPane.toggleDisplay()"/>
|
||||
</toolbar>
|
||||
</vbox>
|
||||
|
||||
</vbox>
|
||||
</hbox>
|
||||
<splitter id="scholar-splitter" resizebefore="closest" resizeafter="closest" position="2" persist="collapsed"/>
|
||||
</vbox>
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue