From fa33eb72b20a20974e1b422014f09f360b44a265 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Mon, 18 Dec 2017 00:34:55 -0500 Subject: [PATCH] Fix some UI issues with storage settings - Enable/disable download mode drop-down for groups separately from user library - Fixing hiding of terms of service message when Zotero storage isn't selected --- .../zotero/preferences/preferences_sync.js | 28 ++++++------------- .../zotero/preferences/preferences_sync.xul | 20 ++++++++----- chrome/skin/default/zotero/preferences.css | 6 ++-- 3 files changed, 25 insertions(+), 29 deletions(-) diff --git a/chrome/content/zotero/preferences/preferences_sync.js b/chrome/content/zotero/preferences/preferences_sync.js index 0255d3245..3c7aad245 100644 --- a/chrome/content/zotero/preferences/preferences_sync.js +++ b/chrome/content/zotero/preferences/preferences_sync.js @@ -31,6 +31,7 @@ Components.utils.import("resource://zotero/config.js"); Zotero_Preferences.Sync = { init: Zotero.Promise.coroutine(function* () { this.updateStorageSettingsUI(); + this.updateStorageSettingsGroupsUI(); var username = Zotero.Users.getCurrentUsername() || Zotero.Prefs.get('sync.server.username') || " "; var apiKey = yield Zotero.Sync.Data.Local.getAPIKey(); @@ -368,30 +369,19 @@ Zotero_Preferences.Sync = { sep.hidden = true; } - var menulists = document.querySelectorAll('#storage-settings menulist.storage-mode'); - for (let menulist of menulists) { - menulist.disabled = !enabled; - } - + document.getElementById('storage-user-download-mode').disabled = !enabled; this.updateStorageTerms(); window.sizeToContent(); }), - updateStorageSettingsGroups: function (enabled) { - var storageSettings = document.getElementById('storage-settings'); - var menulists = storageSettings.getElementsByTagName('menulist'); - for (let menulist of menulists) { - if (menulist.className == 'storage-groups') { - menulist.disabled = !enabled; - } - } - - var self = this; - setTimeout(function () { - self.updateStorageTerms(); - }, 1) + updateStorageSettingsGroupsUI: function () { + setTimeout(() => { + var enabled = document.getElementById('pref-storage-groups-enabled').value; + document.getElementById('storage-groups-download-mode').disabled = !enabled; + this.updateStorageTerms(); + }); }, @@ -400,7 +390,7 @@ Zotero_Preferences.Sync = { var libraryEnabled = document.getElementById('pref-storage-enabled').value; var storageProtocol = document.getElementById('pref-storage-protocol').value; - var groupsEnabled = document.getElementById('pref-group-storage-enabled').value; + var groupsEnabled = document.getElementById('pref-storage-groups-enabled').value; terms.hidden = !((libraryEnabled && storageProtocol == 'zotero') || groupsEnabled); }, diff --git a/chrome/content/zotero/preferences/preferences_sync.xul b/chrome/content/zotero/preferences/preferences_sync.xul index 1ab989cb9..8e961e137 100644 --- a/chrome/content/zotero/preferences/preferences_sync.xul +++ b/chrome/content/zotero/preferences/preferences_sync.xul @@ -40,7 +40,7 @@ - + @@ -233,7 +233,10 @@