Tags selector fixup:

- "Display All" => "Display all tags"
- "No tags to display" message when no matching tags
- "# tags selected" in bottom left
- Dropped "Deselect Visible"
- Added vertical pipe on bottom line
- "Deselect All" => "Deselect all"
This commit is contained in:
Dan Stillman 2007-01-03 21:59:43 +00:00
parent f23d9a4aeb
commit 68e082a2fb
4 changed files with 105 additions and 38 deletions

View File

@ -151,6 +151,7 @@
} }
Zotero.debug('Refreshing tags selector'); Zotero.debug('Refreshing tags selector');
var empty = true;
var tagsToggleBox = this.id('tags-toggle'); var tagsToggleBox = this.id('tags-toggle');
if (fetch || this._dirty) { if (fetch || this._dirty) {
@ -201,6 +202,7 @@
//Zotero.debug(2); //Zotero.debug(2);
labels[i].setAttribute('inScope', true); labels[i].setAttribute('inScope', true);
labels[i].setAttribute('hidden', false); labels[i].setAttribute('hidden', false);
empty = false;
} }
else { else {
//Zotero.debug(3); //Zotero.debug(3);
@ -220,8 +222,38 @@
} }
labels[i].setAttribute('hidden', false); labels[i].setAttribute('hidden', false);
empty = false;
} }
} }
this.updateNumSelected();
this.id('tags-toggle').setAttribute('collapsed', empty);
this.id('no-tags-box').setAttribute('collapsed', !empty);
]]>
</body>
</method>
<method name="updateNumSelected">
<body>
<![CDATA[
var count = 0;
for (var i in this.selection) {
count++;
}
switch (count) {
case 0:
var mod = 'none';
break;
case 1:
var mod = 'singular';
break;
default:
var mod = 'plural';
}
this.id('num-selected').value = Zotero.getString('pane.tagSelector.numSelected.' + mod, [count]);
]]> ]]>
</body> </body>
</method> </method>
@ -252,6 +284,7 @@
</method> </method>
<!-- Not currently used -->
<method name="selectVisible"> <method name="selectVisible">
<body> <body>
<![CDATA[ <![CDATA[
@ -270,6 +303,7 @@
</method> </method>
<!-- Not currently used -->
<method name="clearVisible"> <method name="clearVisible">
<body> <body>
<![CDATA[ <![CDATA[
@ -278,7 +312,7 @@
var labels = tagsToggleBox.getElementsByTagName('label'); var labels = tagsToggleBox.getElementsByTagName('label');
for (var i=0; i<labels.length; i++){ for (var i=0; i<labels.length; i++){
labels[i].setAttribute('selected', 'false'); labels[i].setAttribute('selected', 'false');
this.selection[labels[i].value] = false; delete this.selection[labels[i].value];
} }
// Bubbles up to command // Bubbles up to command
@ -335,7 +369,7 @@
// Deselect // Deselect
if (label.getAttribute('selected')=='true'){ if (label.getAttribute('selected')=='true'){
this.selection[label.value] = false; delete this.selection[label.value];
label.setAttribute('selected', 'false'); label.setAttribute('selected', 'false');
} }
// Select // Select
@ -345,6 +379,8 @@
} }
this.doCommand(); this.doCommand();
this.updateNumSelected();
]]> ]]>
</body> </body>
</method> </method>
@ -462,29 +498,56 @@
<xul:menuitem label="&zotero.tagSelector.deleteTag;" class="menuitem-non-iconic" oncommand="this.parentNode.parentNode.parentNode.delete(document.popupNode.getAttribute('tagID')); event.stopPropagation()"/> <xul:menuitem label="&zotero.tagSelector.deleteTag;" class="menuitem-non-iconic" oncommand="this.parentNode.parentNode.parentNode.delete(document.popupNode.getAttribute('tagID')); event.stopPropagation()"/>
</xul:menupopup> </xul:menupopup>
<xul:vbox id="tags-toggle" flex="1"/> <xul:vbox id="no-tags-box" align="center" pack="center" flex="1">
<xul:checkbox label="&zotero.tagSelector.displayAll;" <xul:label value="&zotero.tagSelector.noTagsToDisplay;"/>
oncommand="this.parentNode.parentNode.filterToScope = !this.checked; event.stopPropagation();"> </xul:vbox>
</xul:checkbox>
<xul:hbox> <xul:vbox id="tags-toggle" flex="1"/>
<xul:label value="&zotero.tagSelector.filter;"/>
<xul:textbox id="tags-search" flex="1" type="timed" timeout="250" dir="reverse" <xul:hbox>
oncommand="this.parentNode.parentNode.parentNode.handleKeyPress(); event.stopPropagation()" <xul:hbox pack="start">
onkeypress="if (event.keyCode == event.DOM_VK_ESCAPE) { this.parentNode.parentNode.parentNode.handleKeyPress(true); }"> <xul:checkbox label="&zotero.tagSelector.displayAll;"
<xul:toolbarbutton id="search-cancel" oncommand="this.parentNode.parentNode.parentNode.parentNode.filterToScope = !this.checked; event.stopPropagation();">
oncommand="this.parentNode.focus(); this.parentNode.parentNode.parentNode.parentNode.handleKeyPress(true)" hidden="true"/> </xul:checkbox>
</xul:textbox>
</xul:hbox> </xul:hbox>
<!--
<xul:hbox> <xul:hbox>
<!-- <xul:radiogroup orient="horizontal">
Disabled until there's an ANY search mode <xul:radio label="any"/>
<xul:toolbarbutton label="&zotero.tagSelector.selectVisible;" class="zotero-clicky" <xul:radio label="all"/>
oncommand="this.parentNode.parentNode.parentNode.selectVisible()"/>--> </xul:radiogroup>
<xul:toolbarbutton label="&zotero.tagSelector.clearVisible;" class="zotero-clicky"
oncommand="this.parentNode.parentNode.parentNode.clearVisible()"/>
<xul:toolbarbutton label="&zotero.tagSelector.clearAll;" class="zotero-clicky"
oncommand="this.parentNode.parentNode.parentNode.clearAll();"/>
</xul:hbox> </xul:hbox>
-->
</xul:hbox>
<xul:hbox>
<xul:label value="&zotero.tagSelector.filter;"/>
<xul:textbox id="tags-search" flex="1" type="timed" timeout="250" dir="reverse"
oncommand="this.parentNode.parentNode.parentNode.handleKeyPress(); event.stopPropagation()"
onkeypress="if (event.keyCode == event.DOM_VK_ESCAPE) { this.parentNode.parentNode.parentNode.handleKeyPress(true); }">
<xul:toolbarbutton id="search-cancel"
oncommand="this.parentNode.focus(); this.parentNode.parentNode.parentNode.parentNode.handleKeyPress(true)" hidden="true"/>
</xul:textbox>
</xul:hbox>
<xul:hbox>
<xul:hbox pack="center">
<xul:label id="num-selected"/>
</xul:hbox>
<!--
Disabled (at least) until there's an ANY search mode
<xul:toolbarbutton label="&zotero.tagSelector.selectVisible;"
oncommand="this.parentNode.parentNode.parentNode.parentNode.selectVisible()"/>
<xul:button label="&zotero.tagSelector.clearVisible;"
oncommand="this.parentNode.parentNode.parentNode.parentNode.clearVisible()"/> -->
<xul:toolbarseparator/>
<xul:hbox pack="center">
<xul:button label="&zotero.tagSelector.clearAll;"
oncommand="this.parentNode.parentNode.parentNode.parentNode.clearAll();"/>
</xul:hbox>
</xul:hbox>
</xul:groupbox> </xul:groupbox>
</content> </content>
</binding> </binding>

View File

@ -55,11 +55,12 @@
<!ENTITY zotero.toolbar.attachment.weblink "Save Link to Current Page"> <!ENTITY zotero.toolbar.attachment.weblink "Save Link to Current Page">
<!ENTITY zotero.toolbar.attachment.snapshot "Take Snapshot of Current Page"> <!ENTITY zotero.toolbar.attachment.snapshot "Take Snapshot of Current Page">
<!ENTITY zotero.tagSelector.noTagsToDisplay "No tags to display">
<!ENTITY zotero.tagSelector.filter "Filter:"> <!ENTITY zotero.tagSelector.filter "Filter:">
<!ENTITY zotero.tagSelector.displayAll "Display All"> <!ENTITY zotero.tagSelector.displayAll "Display all tags">
<!ENTITY zotero.tagSelector.selectVisible "Select Visible"> <!ENTITY zotero.tagSelector.selectVisible "Select visible">
<!ENTITY zotero.tagSelector.clearVisible "Deselect Visible"> <!ENTITY zotero.tagSelector.clearVisible "Deselect visible">
<!ENTITY zotero.tagSelector.clearAll "Deselect All"> <!ENTITY zotero.tagSelector.clearAll "Deselect all">
<!ENTITY zotero.tagSelector.renameTag "Rename Tag..."> <!ENTITY zotero.tagSelector.renameTag "Rename Tag...">
<!ENTITY zotero.tagSelector.deleteTag "Delete Tag..."> <!ENTITY zotero.tagSelector.deleteTag "Delete Tag...">

View File

@ -21,6 +21,9 @@ pane.tagSelector.rename.title = Please enter a new name for this tag.
pane.tagSelector.rename.message = The tag will be changed in all associated items. pane.tagSelector.rename.message = The tag will be changed in all associated items.
pane.tagSelector.delete.title = Are you sure you want to delete this tag? pane.tagSelector.delete.title = Are you sure you want to delete this tag?
pane.tagSelector.delete.message = The tag will be removed from all items. pane.tagSelector.delete.message = The tag will be removed from all items.
pane.tagSelector.numSelected.none = 0 tags selected
pane.tagSelector.numSelected.singular = %S tag selected
pane.tagSelector.numSelected.plural = %S tags selected
pane.items.delete = Are you sure you want to delete the selected item? pane.items.delete = Are you sure you want to delete the selected item?
pane.items.delete.multiple = Are you sure you want to delete the selected items? pane.items.delete.multiple = Are you sure you want to delete the selected items?

View File

@ -1,9 +1,3 @@
/* Don't focus filter textbox if pane isn't open */
zoterotagselector[collapsed=true] tags-search
{
-moz-user-focus: ignore;
}
groupbox groupbox
{ {
overflow: auto; overflow: auto;
@ -21,20 +15,20 @@ checkbox
margin: .75em 0 .4em; margin: .75em 0 .4em;
} }
label #tags-toggle label
{ {
margin-right: .2em; margin-right: .2em;
padding: .15em .25em; padding: .15em .25em;
-moz-user-focus: ignore; -moz-user-focus: ignore;
} }
label[selected="true"] #tags-toggle label[selected="true"]
{ {
background: #a9c6f0 !important; background: #a9c6f0 !important;
} }
/* Visible out-of-scope tags should be grey */ /* Visible out-of-scope tags should be grey */
label[inScope="false"] #tags-toggle label[inScope="false"]
{ {
color: #666 !important; color: #666 !important;
} }
@ -46,15 +40,15 @@ label.zotero-clicky[inScope="false"]:active
background: inherit !important; background: inherit !important;
} }
label[draggedOver="true"] #tags-toggle label[draggedOver="true"]
{ {
color: white !important; color: white !important;
background: #666; background: #666;
} }
hbox groupbox > hbox
{ {
-moz-box-align: baseline; -moz-box-align: center;
-moz-box-pack: center; -moz-box-pack: center;
} }
@ -66,6 +60,12 @@ hbox
list-style-image: url('chrome://zotero/skin/search-cancel.png'); list-style-image: url('chrome://zotero/skin/search-cancel.png');
} }
groupbox > hbox > hbox
{
-moz-box-flex: 1;
-moz-box-align: center;
}
/* Bottom buttons */ /* Bottom buttons */
toolbarbutton.zotero-clicky toolbarbutton.zotero-clicky
{ {