diff options
author | Bjoern Schiessle <bjoern@schiessle.org> | 2017-04-26 20:23:56 +0200 |
---|---|---|
committer | Morris Jobke <hey@morrisjobke.de> | 2017-04-28 23:41:37 -0300 |
commit | ec452a8294d460c50bb28a68ce0662ac3f558349 (patch) | |
tree | 45f3ce2a04bd63232a8210f72949627ace1387aa /settings/js | |
parent | 9c0414bb47a2279ccad0d31902c6a2e54409b665 (diff) | |
download | nextcloud-server-ec452a8294d460c50bb28a68ce0662ac3f558349.tar.gz nextcloud-server-ec452a8294d460c50bb28a68ce0662ac3f558349.zip |
only show verify button if scope is public and the input field contain some value
Signed-off-by: Bjoern Schiessle <bjoern@schiessle.org>
Diffstat (limited to 'settings/js')
-rw-r--r-- | settings/js/federationsettingsview.js | 44 |
1 files changed, 34 insertions, 10 deletions
diff --git a/settings/js/federationsettingsview.js b/settings/js/federationsettingsview.js index 2b41f49b322..6ec5bd785a7 100644 --- a/settings/js/federationsettingsview.js +++ b/settings/js/federationsettingsview.js @@ -130,6 +130,25 @@ // TODO: user loading/success feedback this._config.save(); this._setFieldScopeIcon(field, scope); + this._updateVerifyButton(field, scope); + }, + + _updateVerifyButton: function(field, scope) { + // show verification button if the value is set and the scope is 'public' + if (field === 'twitter' || field === 'website'|| field === 'email') { + var verify = this.$('#' + field + 'form > .verify'); + var scope = this.$('#' + field + 'scope').val(); + var value = this.$('#' + field).val(); + + if (scope === 'public' && value !== '') { + verify.removeClass('hidden'); + return true; + } else { + verify.addClass('hidden'); + } + } + + return false; }, _showInputChangeSuccess: function(field) { @@ -139,16 +158,21 @@ $icon.fadeOut(300); }, 2000); - if (field === 'twitter' || field === 'webpage') - { - var verifyStatus = this.$('#' + field + 'form > .verify > #verify-' + field); - verifyStatus.attr('title', t('core', 'Verify')); - verifyStatus.attr('src', OC.imagePath('core', 'actions/verify.svg')); - verifyStatus.addClass('verify-action'); - } else if (field === 'email') { - var verifyStatus = this.$('#' + field + 'form > .verify > #verify-' + field); - verifyStatus.attr('title', t('core', 'Verifying …')); - verifyStatus.attr('src', OC.imagePath('core', 'actions/verifying.svg')); + var scope = this.$('#' + field + 'scope').val(); + var verifyAvailable = this._updateVerifyButton(field, scope); + + // change verification buttons from 'verify' to 'verifying...' on value change + if (verifyAvailable) { + if (field === 'twitter' || field === 'webpage') { + var verifyStatus = this.$('#' + field + 'form > .verify > #verify-' + field); + verifyStatus.attr('title', t('core', 'Verify')); + verifyStatus.attr('src', OC.imagePath('core', 'actions/verify.svg')); + verifyStatus.addClass('verify-action'); + } else if (field === 'email') { + var verifyStatus = this.$('#' + field + 'form > .verify > #verify-' + field); + verifyStatus.attr('title', t('core', 'Verifying …')); + verifyStatus.attr('src', OC.imagePath('core', 'actions/verifying.svg')); + } } }, |