Skip to content

Commit

Permalink
Fix some UI issues with storage settings
Browse files Browse the repository at this point in the history
- 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
  • Loading branch information
dstillman committed Dec 18, 2017
1 parent 7d98f04 commit fa33eb7
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 29 deletions.
28 changes: 9 additions & 19 deletions chrome/content/zotero/preferences/preferences_sync.js
Expand Up @@ -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();
Expand Down Expand Up @@ -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();
});
},


Expand All @@ -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);
},
Expand Down
20 changes: 13 additions & 7 deletions chrome/content/zotero/preferences/preferences_sync.xul
Expand Up @@ -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>
Expand Down Expand Up @@ -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"/>
Expand All @@ -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"/>
Expand All @@ -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>
Expand Down
6 changes: 3 additions & 3 deletions chrome/skin/default/zotero/preferences.css
Expand Up @@ -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;
}
Expand Down

0 comments on commit fa33eb7

Please sign in to comment.