Merge pull request #20978 from owncloud/fix-dont-show-unsaved-values-in-usermgmt

reset mailadress/displayname on blur
This commit is contained in:
Thomas Müller 2015-12-11 12:15:01 +01:00
commit 4f860b7e0a
1 changed files with 5 additions and 3 deletions

View File

@ -698,6 +698,8 @@ $(document).ready(function () {
} }
} }
); );
var displayName = $input.val();
$tr.data('displayname', displayName);
$input.blur(); $input.blur();
} else { } else {
$input.blur(); $input.blur();
@ -705,8 +707,7 @@ $(document).ready(function () {
} }
}) })
.blur(function () { .blur(function () {
var displayName = $input.val(); var displayName = $tr.data('displayname');
$tr.data('displayname', displayName);
$input.replaceWith('<span>' + escapeHTML(displayName) + '</span>'); $input.replaceWith('<span>' + escapeHTML(displayName) + '</span>');
$td.find('img').show(); $td.find('img').show();
}); });
@ -725,6 +726,7 @@ $(document).ready(function () {
.keypress(function (event) { .keypress(function (event) {
if (event.keyCode === 13) { if (event.keyCode === 13) {
if ($(this).val().length > 0) { if ($(this).val().length > 0) {
$tr.data('mailAddress', $input.val());
$input.blur(); $input.blur();
$.ajax({ $.ajax({
type: 'PUT', type: 'PUT',
@ -744,7 +746,7 @@ $(document).ready(function () {
} }
}) })
.blur(function () { .blur(function () {
var mailAddress = $input.val(); var mailAddress = $tr.data('mailAddress');
var $span = $('<span>').text(mailAddress); var $span = $('<span>').text(mailAddress);
$tr.data('mailAddress', mailAddress); $tr.data('mailAddress', mailAddress);
$input.replaceWith($span); $input.replaceWith($span);