Commit 4118f1cd authored by Michal Čihař's avatar Michal Čihař

Initial Zen saving support

Signed-off-by: default avatarMichal Čihař <michal@cihar.com>
parent 11c37f98
......@@ -174,6 +174,27 @@ function load_table_sorting() {
});
}
function zen_editor(e) {
var $this = $(this);
var $row = $this.parents('tr');
var checksum = $row.find('[name=checksum]').val();
$row.addClass('translation-modified');
var form = $row.find('form');
$('#loading-' + checksum).show();
$('#messages-' + checksum).html('');
$.post(
form.attr('action'),
form.serialize(),
function (data) {
$('#loading-' + checksum).hide();
$('#messages-' + checksum).append(data);
$row.removeClass('translation-modified').addClass('translation-saved');
}
);
}
$(function () {
/* AJAX loading of tabs/pills */
$(document).on('show.bs.tab', '[data-toggle="tab"][data-href], [data-toggle="pill"][data-href]', function (e) {
......@@ -420,5 +441,14 @@ $(function () {
);
}
});
$(document).on('change', '.translation-editor', zen_editor);
$(document).on('change', '.fuzzy_checkbox', zen_editor);
$(window).on('beforeunload', function(){
if ($('.translation-modified').length > 0) {
return gettext('There are some unsaved changes, are you sure you want to leave?');
}
});
};
});
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