Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoas Schilling <nickvergessen@owncloud.com>2016-01-26 14:59:58 +0300
committerJoas Schilling <nickvergessen@owncloud.com>2016-01-26 14:59:58 +0300
commit751e99512a379a6e0cfb3d6b35f897a36a49f251 (patch)
tree7faf85d63a65db946d9ad3cda386a5431297d736 /settings
parent3da78c8f1c9355a726f289e834fa237366c3df20 (diff)
Hide the delete button, until we know its a custom avatar
Diffstat (limited to 'settings')
-rw-r--r--settings/js/personal.js17
-rw-r--r--settings/templates/personal.php2
2 files changed, 9 insertions, 10 deletions
diff --git a/settings/js/personal.js b/settings/js/personal.js
index 3e1a0d7497b..65bc88d2098 100644
--- a/settings/js/personal.js
+++ b/settings/js/personal.js
@@ -100,7 +100,7 @@ function updateAvatar (hidedefault) {
$displaydiv.css({'background-color': ''});
$displaydiv.avatar(OC.currentUser, 145, true);
- $('#removeavatar').show();
+ $('#removeavatar').removeClass('hidden').addClass('inlineblock');
}
function showAvatarCropper () {
@@ -303,7 +303,7 @@ $(document).ready(function () {
url: OC.generateUrl('/avatar/'),
success: function () {
updateAvatar(true);
- $('#removeavatar').hide();
+ $('#removeavatar').addClass('hidden').removeClass('inlineblock');
}
});
});
@@ -327,15 +327,14 @@ $(document).ready(function () {
]
});
- // does the user have a custom avatar? if he does hide #removeavatar
- // needs to be this complicated because we can't check yet if an avatar has been loaded, because it's async
- var url = OC.generateUrl(
+ // does the user have a custom avatar? if he does show #removeavatar
+ $.get(OC.generateUrl(
'/avatar/{user}/{size}',
{user: OC.currentUser, size: 1}
- );
- $.get(url, function (result) {
- if (typeof(result) === 'object') {
- $('#removeavatar').hide();
+ ), function (result) {
+ if (typeof(result) === 'string') {
+ // Show the delete button when the avatar is custom
+ $('#removeavatar').removeClass('hidden').addClass('inlineblock');
}
});
diff --git a/settings/templates/personal.php b/settings/templates/personal.php
index 5bae01742b6..65b8b81aa90 100644
--- a/settings/templates/personal.php
+++ b/settings/templates/personal.php
@@ -41,7 +41,7 @@
<?php if ($_['avatarChangeSupported']): ?>
<label for="uploadavatar" class="inlineblock button icon-upload svg" id="uploadavatarbutton" title="<?php p($l->t('Upload new')); ?>"></label>
<div class="inlineblock button icon-folder svg" id="selectavatar" title="<?php p($l->t('Select from Files')); ?>"></div>
- <div class="inlineblock button icon-delete svg" id="removeavatar" title="<?php p($l->t('Remove image')); ?>"></div>
+ <div class="hidden button icon-delete svg" id="removeavatar" title="<?php p($l->t('Remove image')); ?>"></div>
<input type="file" name="files[]" id="uploadavatar" class="hiddenuploadfield">
<p><em><?php p($l->t('png or jpg, max. 20 MB')); ?></em></p>
<?php else: ?>