Merge pull request #394 from okriuchykhin/ok_SCI_853

Fix non removable error messages in samples [SCI-853]
This commit is contained in:
okriuchykhin 2017-01-10 11:00:01 +01:00 committed by GitHub
commit f8237e025a
3 changed files with 15 additions and 14 deletions

View file

@ -212,7 +212,9 @@ var HelperModule = (function(){
window.setTimeout(function () {
flash.fadeTo(500, 0).slideUp(500, function () {
$(this).remove();
$('#content-wrapper').removeClass('alert-shown');
if($('.alert').length <= 0) {
$('#content-wrapper').removeClass('alert-shown');
}
});
}, 5000);
}

View file

@ -506,13 +506,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,29 @@ function updateSamplesTypesandGroups() {
}
function sampleAlertMsg(message, type) {
var alertType, glyphSign;
if (type == 'success') {
var alertType;
var glyphSign;
$('#notifications').html('');
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();
}
/**