diff options
author | Vincent Petry <pvince81@owncloud.com> | 2016-06-23 18:42:11 +0200 |
---|---|---|
committer | Vincent Petry <pvince81@owncloud.com> | 2016-06-23 18:42:11 +0200 |
commit | 9092d7f5eac2cbdf24dad1d60c4bb98ca380c485 (patch) | |
tree | a2859846b0388dccc875c86e31aa978c9876c710 /settings/js/users | |
parent | cc2aec11af4df1cdc98f12036e59d7fbace19265 (diff) | |
download | nextcloud-server-9092d7f5eac2cbdf24dad1d60c4bb98ca380c485.tar.gz nextcloud-server-9092d7f5eac2cbdf24dad1d60c4bb98ca380c485.zip |
Fix "Other" value handling in quota dropdown in users page
Prevents "other" value to be deleted.
When appending custom value, put it above the "other" entry.
Diffstat (limited to 'settings/js/users')
-rw-r--r-- | settings/js/users/users.js | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/settings/js/users/users.js b/settings/js/users/users.js index e0fccbd9539..a4d88204861 100644 --- a/settings/js/users/users.js +++ b/settings/js/users/users.js @@ -138,10 +138,13 @@ var UserList = { .find('option').attr('selected', null) .first().attr('selected', 'selected'); } else { - if ($quotaSelect.find('option').filterAttr('value', user.quota).length > 0) { - $quotaSelect.find('option').filterAttr('value', user.quota).attr('selected', 'selected'); + var $options = $quotaSelect.find('option'); + var $foundOption = $options.filterAttr('value', user.quota); + if ($foundOption.length > 0) { + $foundOption.attr('selected', 'selected'); } else { - $quotaSelect.append('<option value="' + escapeHTML(user.quota) + '" selected="selected">' + escapeHTML(user.quota) + '</option>'); + // append before "Other" entry + $options.last().before('<option value="' + escapeHTML(user.quota) + '" selected="selected">' + escapeHTML(user.quota) + '</option>'); } } @@ -576,6 +579,9 @@ var UserList = { var $select = $(ev.target); var uid = UserList.getUID($select); var quota = $select.val(); + if (quota === 'other') { + return; + } UserList._updateQuota(uid, quota, function(returnedQuota){ if (quota !== returnedQuota) { $select.find(':selected').text(returnedQuota); |