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

View file

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