Commit a7802a74 authored by Michal Čihař's avatar Michal Čihař

Better handling of zen saving

- hide response icon when loading
- do not show empty tooltip
Signed-off-by: default avatarMichal Čihař <michal@cihar.com>
parent 4da9d3ea
...@@ -182,14 +182,15 @@ function zen_editor(e) { ...@@ -182,14 +182,15 @@ function zen_editor(e) {
$row.addClass('translation-modified'); $row.addClass('translation-modified');
var form = $row.find('form'); var form = $row.find('form');
$('#loading-' + checksum).show(); var statusdiv = $('#status-' + checksum).hide();
var loadingdiv = $('#loading-' + checksum).show();
$.post( $.post(
form.attr('action'), form.attr('action'),
form.serialize(), form.serialize(),
function (data) { function (data) {
var messages = $('<div>' + data + '</div>'); var messages = $('<div>' + data + '</div>');
var statusdiv = $('#status-' + checksum); loadingdiv.hide();
$('#loading-' + checksum).hide(); statusdiv.show();
if (messages.find('.alert-danger').length > 0) { if (messages.find('.alert-danger').length > 0) {
statusdiv.attr('class', 'glyphicon-remove-sign text-danger'); statusdiv.attr('class', 'glyphicon-remove-sign text-danger');
} else if (messages.find('.alert-warning').length > 0) { } else if (messages.find('.alert-warning').length > 0) {
...@@ -199,10 +200,13 @@ function zen_editor(e) { ...@@ -199,10 +200,13 @@ function zen_editor(e) {
} else { } else {
statusdiv.attr('class', 'glyphicon-ok-sign text-success'); statusdiv.attr('class', 'glyphicon-ok-sign text-success');
} }
statusdiv.addClass('glyphicon').tooltip({ statusdiv.addClass('glyphicon').tooltip('destroy');
if (data.trim() !== '') {
statusdiv.tooltip({
'html': true, 'html': true,
'title': data 'title': data
}); });
};
$row.removeClass('translation-modified').addClass('translation-saved'); $row.removeClass('translation-modified').addClass('translation-saved');
} }
); );
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment