mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-09-09 06:35:37 +08:00
Implement flash message hiding through module pattern [SCI-816]
This commit is contained in:
parent
ee5e0ad455
commit
e156dbc987
2 changed files with 11 additions and 14 deletions
|
@ -193,9 +193,11 @@ function notificationAlertClose(){
|
||||||
.removeClass("alert-shown");
|
.removeClass("alert-shown");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
(function(){
|
var HelperModule = (function(){
|
||||||
|
|
||||||
function tree_link_truncation() {
|
var helpers = {};
|
||||||
|
|
||||||
|
helpers.treeLinkTruncation = function() {
|
||||||
$('.tree-link a').each( function(){
|
$('.tree-link a').each( function(){
|
||||||
truncateLongString( $(this), <%= Constants::NAME_TRUNCATION_LENGTH %>);
|
truncateLongString( $(this), <%= Constants::NAME_TRUNCATION_LENGTH %>);
|
||||||
});
|
});
|
||||||
|
@ -204,21 +206,22 @@ function notificationAlertClose(){
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function hide_flash_msg() {
|
helpers.hideFlashMsg = function() {
|
||||||
var flash = $('.alert');
|
var flash = $('.alert');
|
||||||
if (flash.length > 0) {
|
if (flash.length > 0) {
|
||||||
window.setTimeout(function () {
|
window.setTimeout(function () {
|
||||||
flash.fadeTo(500, 0).slideUp(500, function () {
|
flash.fadeTo(500, 0).slideUp(500, function () {
|
||||||
$(this).remove();
|
$(this).remove();
|
||||||
$('#content-wrapper')
|
$('#content-wrapper').removeClass('alert-shown');
|
||||||
.css('marginTop', '50px');
|
|
||||||
});
|
});
|
||||||
}, 5000);
|
}, 5000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$( document ).ready(function() {
|
$( document ).ready(function() {
|
||||||
tree_link_truncation();
|
helpers.treeLinkTruncation();
|
||||||
hide_flash_msg();
|
helpers.hideFlashMsg();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
return helpers;
|
||||||
})();
|
})();
|
||||||
|
|
|
@ -487,13 +487,7 @@ function onClickSave() {
|
||||||
data: data,
|
data: data,
|
||||||
success: function (data) {
|
success: function (data) {
|
||||||
sampleAlertMsg(data.flash, "success");
|
sampleAlertMsg(data.flash, "success");
|
||||||
var flash = $('.alert');
|
HelperModule.hideFlashMsg();
|
||||||
window.setTimeout(function () {
|
|
||||||
flash.fadeTo(500, 0).slideUp(500, function () {
|
|
||||||
$(this).remove();
|
|
||||||
$('#content-wrapper').removeClass('alert-shown');
|
|
||||||
});
|
|
||||||
}, 5000);
|
|
||||||
onClickCancel();
|
onClickCancel();
|
||||||
},
|
},
|
||||||
error: function (e, eData, status, xhr) {
|
error: function (e, eData, status, xhr) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue