mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-12-17 14:19:05 +08:00
Merge pull request #394 from okriuchykhin/ok_SCI_853
Fix non removable error messages in samples [SCI-853]
This commit is contained in:
commit
f8237e025a
3 changed files with 15 additions and 14 deletions
|
|
@ -212,7 +212,9 @@ var HelperModule = (function(){
|
||||||
window.setTimeout(function () {
|
window.setTimeout(function () {
|
||||||
flash.fadeTo(500, 0).slideUp(500, function () {
|
flash.fadeTo(500, 0).slideUp(500, function () {
|
||||||
$(this).remove();
|
$(this).remove();
|
||||||
|
if($('.alert').length <= 0) {
|
||||||
$('#content-wrapper').removeClass('alert-shown');
|
$('#content-wrapper').removeClass('alert-shown');
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}, 5000);
|
}, 5000);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -506,13 +506,11 @@ function onClickSave() {
|
||||||
data: data,
|
data: data,
|
||||||
success: function (data) {
|
success: function (data) {
|
||||||
sampleAlertMsg(data.flash, "success");
|
sampleAlertMsg(data.flash, "success");
|
||||||
HelperModule.hideFlashMsg();
|
|
||||||
onClickCancel();
|
onClickCancel();
|
||||||
},
|
},
|
||||||
error: function (e, eData, status, xhr) {
|
error: function (e, eData, status, xhr) {
|
||||||
var data = e.responseJSON;
|
var data = e.responseJSON;
|
||||||
clearAllErrors();
|
clearAllErrors();
|
||||||
sampleAlertMsgHide();
|
|
||||||
|
|
||||||
if (e.status == 404) {
|
if (e.status == 404) {
|
||||||
sampleAlertMsg(I18n.t("samples.js.not_found_error"), "danger");
|
sampleAlertMsg(I18n.t("samples.js.not_found_error"), "danger");
|
||||||
|
|
|
||||||
|
|
@ -56,28 +56,29 @@ function updateSamplesTypesandGroups() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function sampleAlertMsg(message, type) {
|
function sampleAlertMsg(message, type) {
|
||||||
var alertType, glyphSign;
|
var alertType;
|
||||||
if (type == 'success') {
|
var glyphSign;
|
||||||
|
$('#notifications').html('');
|
||||||
|
if (type === 'success') {
|
||||||
alertType = ' alert-success ';
|
alertType = ' alert-success ';
|
||||||
glyphSign = ' glyphicon-ok-sign ';
|
glyphSign = ' glyphicon-ok-sign ';
|
||||||
} else if (type == 'danger') {
|
} else if (type === 'danger') {
|
||||||
alertType = ' alert-danger ';
|
alertType = ' alert-danger ';
|
||||||
glyphSign = ' glyphicon-exclamation-sign ';
|
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">' +
|
'<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 class="glyphicon' + glyphSign + '"></span>' +
|
||||||
'<span>' + message + '</span>' +
|
'<span>' + message + '</span>' +
|
||||||
'</div>' +
|
'</div>' +
|
||||||
'</div>';
|
'</div>';
|
||||||
$('#notifications').html(htmlSnippet);
|
$('#notifications').html(htmlSnippet);
|
||||||
$('#content-wrapper').addClass('alert-shown');
|
$('#content-wrapper').addClass('alert-shown');
|
||||||
}
|
HelperModule.hideFlashMsg();
|
||||||
|
|
||||||
function sampleAlertMsgHide() {
|
|
||||||
$('#notifications').html('<div></div>');
|
|
||||||
$('#content-wrapper').removeClass('alert-shown');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue