Fix hiding of error messages in the samples datatable [SCI-853]

This commit is contained in:
Oleksii Kriuchykhin 2017-01-09 13:34:23 +01:00
parent 1b56e9d07c
commit 0fd7688427
2 changed files with 11 additions and 13 deletions

View file

@ -501,13 +501,11 @@ function onClickSave() {
data: data,
success: function (data) {
sampleAlertMsg(data.flash, "success");
HelperModule.hideFlashMsg();
onClickCancel();
},
error: function (e, eData, status, xhr) {
var data = e.responseJSON;
clearAllErrors();
sampleAlertMsgHide();
if (e.status == 404) {
sampleAlertMsg(I18n.t("samples.js.not_found_error"), "danger");

View file

@ -56,28 +56,28 @@ function updateSamplesTypesandGroups() {
}
function sampleAlertMsg(message, type) {
var alertType, glyphSign;
if (type == 'success') {
var alertType;
var glyphSign;
if (type === 'success') {
alertType = ' alert-success ';
glyphSign = ' glyphicon-ok-sign ';
} else if (type == 'danger') {
} else if (type === 'danger') {
alertType = ' alert-danger ';
glyphSign = ' glyphicon-exclamation-sign ';
}
var htmlSnippet = '<div class="alert' + alertType + 'alert-dismissable alert-floating">' +
var htmlSnippet = '<div class="alert alert' + alertType +
'alert-dismissable alert-floating">' +
'<div class="container">' +
'<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>' +
'<button type="button" class="close" ' +
'data-dismiss="alert" aria-label="Close">' +
'<span aria-hidden="true">×</span></button>' +
'<span class="glyphicon' + glyphSign + '"></span>' +
'<span>'+ message +'</span>' +
'<span>' + message + '</span>' +
'</div>' +
'</div>';
$('#notifications').html(htmlSnippet);
$('#content-wrapper').addClass('alert-shown');
}
function sampleAlertMsgHide() {
$('#notifications').html('<div></div>');
$('#content-wrapper').removeClass('alert-shown');
HelperModule.hideFlashMsg();
}
/**