only show verify button if scope is public and the input field contain some value

Signed-off-by: Bjoern Schiessle <bjoern@schiessle.org>
This commit is contained in:
Bjoern Schiessle 2017-04-26 20:23:56 +02:00 committed by Morris Jobke
parent 9c0414bb47
commit ec452a8294
No known key found for this signature in database
GPG Key ID: 9CE5ED29E7FCD38A
1 changed files with 34 additions and 10 deletions

View File

@ -130,6 +130,25 @@
// TODO: user loading/success feedback // TODO: user loading/success feedback
this._config.save(); this._config.save();
this._setFieldScopeIcon(field, scope); 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) { _showInputChangeSuccess: function(field) {
@ -139,16 +158,21 @@
$icon.fadeOut(300); $icon.fadeOut(300);
}, 2000); }, 2000);
if (field === 'twitter' || field === 'webpage') var scope = this.$('#' + field + 'scope').val();
{ var verifyAvailable = this._updateVerifyButton(field, scope);
var verifyStatus = this.$('#' + field + 'form > .verify > #verify-' + field);
verifyStatus.attr('title', t('core', 'Verify')); // change verification buttons from 'verify' to 'verifying...' on value change
verifyStatus.attr('src', OC.imagePath('core', 'actions/verify.svg')); if (verifyAvailable) {
verifyStatus.addClass('verify-action'); if (field === 'twitter' || field === 'webpage') {
} else if (field === 'email') { var verifyStatus = this.$('#' + field + 'form > .verify > #verify-' + field);
var verifyStatus = this.$('#' + field + 'form > .verify > #verify-' + field); verifyStatus.attr('title', t('core', 'Verify'));
verifyStatus.attr('title', t('core', 'Verifying …')); verifyStatus.attr('src', OC.imagePath('core', 'actions/verify.svg'));
verifyStatus.attr('src', OC.imagePath('core', 'actions/verifying.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'));
}
} }
}, },