commit 223bfe74dba6a2acd9515cc2df1eeba9fcc38fc8
parent 24742691b87574871f53370410ff2a24f2bc48bc
Author: Simon Kornblith <simon@simonster.com>
Date: Sun, 2 Oct 2011 23:28:38 +0000
Disable toolbar buttons in collections that cannot be edited
Diffstat:
2 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/chrome/content/zotero-platform/mac/overlay.css b/chrome/content/zotero-platform/mac/overlay.css
@@ -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;
}
diff --git a/chrome/content/zotero/zoteroPane.js b/chrome/content/zotero/zoteroPane.js
@@ -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);