Disable toolbar buttons in collections that cannot be edited

This commit is contained in:
Simon Kornblith 2011-10-02 23:28:38 +00:00
parent 24742691b8
commit 223bfe74db
2 changed files with 15 additions and 2 deletions

View file

@ -36,7 +36,7 @@
}
.zotero-tb-button[open="true"],
.zotero-tb-button:hover:active {
.zotero-tb-button:not([disabled="true"]):hover:active {
background: url("chrome://zotero/skin/mac/menubutton-end-pressed.png") right center no-repeat;
}
@ -69,7 +69,7 @@
}
.zotero-tb-button[open="true"] > .toolbarbutton-icon,
.zotero-tb-button:hover:active > .toolbarbutton-icon {
.zotero-tb-button:not([disabled="true"]):hover:active > .toolbarbutton-icon {
background: url("chrome://zotero/skin/mac/menubutton-start-pressed.png") left center no-repeat;
}

View file

@ -1062,6 +1062,19 @@ var ZoteroPane = new function()
itemgroup.setSearch('');
itemgroup.setTags(getTagSelection());
// Enable or disable toolbar icons as necessary
const disableIfNoEdit = ["cmd_zotero_newCollection", "zotero-tb-add",
"cmd_zotero_newItemFromCurrentPage", "zotero-tb-lookup", "cmd_zotero_newStandaloneNote",
"zotero-tb-note-add", "zotero-tb-attachment-add"];
for(var i=0; i<disableIfNoEdit.length; i++) {
var el = document.getElementById(disableIfNoEdit[i]);
if(itemgroup.editable) {
if(el.hasAttribute("disabled")) el.removeAttribute("disabled");
} else {
el.setAttribute("disabled", "true");
}
}
try {
Zotero.UnresponsiveScriptIndicator.disable();
this.itemsView = new Zotero.ItemTreeView(itemgroup);