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
This commit is contained in:
Dan Stillman 2017-12-18 00:34:55 -05:00
parent 7d98f04bd8
commit fa33eb72b2
3 changed files with 25 additions and 29 deletions

View file

@ -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);
},

View file

@ -40,7 +40,7 @@
<preference id="pref-storage-username" name="extensions.zotero.sync.storage.username" type="string"/>
<preference id="pref-storage-downloadMode-personal" name="extensions.zotero.sync.storage.downloadMode.personal" type="string"/>
<preference id="pref-storage-downloadMode-groups" name="extensions.zotero.sync.storage.downloadMode.groups" type="string"/>
<preference id="pref-group-storage-enabled" name="extensions.zotero.sync.storage.groups.enabled" type="bool"/>
<preference id="pref-storage-groups-enabled" name="extensions.zotero.sync.storage.groups.enabled" type="bool"/>
</preferences>
<tabbox>
@ -233,7 +233,10 @@
<hbox class="storage-settings-download-options" align="center">
<label value="&zotero.preferences.sync.fileSyncing.download;"/>
<menulist class="storage-mode" preference="pref-storage-downloadMode-personal" style="margin-left: 0">
<menulist id="storage-user-download-mode"
class="storage-mode"
preference="pref-storage-downloadMode-personal"
style="margin-left: 0">
<menupopup>
<menuitem label="&zotero.preferences.sync.fileSyncing.download.onDemand;" value="on-demand"/>
<menuitem label="&zotero.preferences.sync.fileSyncing.download.atSyncTime;" value="on-sync"/>
@ -245,12 +248,15 @@
<!-- Group Libraries -->
<checkbox label="&zotero.preferences.sync.fileSyncing.groups;"
preference="pref-group-storage-enabled"
oncommand="Zotero_Preferences.Sync.updateStorageSettingsGroups(this.checked)"/>
preference="pref-storage-groups-enabled"
oncommand="Zotero_Preferences.Sync.updateStorageSettingsGroupsUI()"/>
<hbox class="storage-settings-download-options" align="center">
<label value="&zotero.preferences.sync.fileSyncing.download;"/>
<menulist class="storage-mode" preference="pref-storage-downloadMode-groups" style="margin-left: 0">
<menulist id="storage-groups-download-mode"
class="storage-mode"
preference="pref-storage-downloadMode-groups"
style="margin-left: 0">
<menupopup>
<menuitem label="&zotero.preferences.sync.fileSyncing.download.onDemand;" value="on-demand"/>
<menuitem label="&zotero.preferences.sync.fileSyncing.download.atSyncTime;" value="on-sync"/>
@ -260,8 +266,8 @@
<separator class="thin"/>
<vbox>
<hbox id="storage-terms" style="margin-top: .4em; display: block" align="center">
<vbox id="storage-terms">
<hbox style="margin-top: .4em; display: block" align="center">
<label>&zotero.preferences.sync.fileSyncing.tos1;</label>
<label class="zotero-text-link" href="https://www.zotero.org/support/terms/terms_of_service" value="&zotero.preferences.sync.fileSyncing.tos2;"/>
<label>&zotero.preferences.period;</label>

View file

@ -156,18 +156,18 @@ grid row hbox:first-child
min-width: 8em;
}
#storage-terms > label
#storage-terms label
{
margin-left: 0;
font-size: .9em;
}
#storage-terms > label:first-child
#storage-terms label:first-child
{
margin-right: .25em;
}
#storage-terms > label[class=zotero-text-link]
#storage-terms label[class=zotero-text-link]
{
margin-right: 0;
}