X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=portal%2Fstatic%2Fjs%2Fmyslice-ui.js;h=1a3db498ca852281c0125100b64f386a21ceab85;hb=225a0f7799c43d63e04ec5639f14690bc941b5b2;hp=bd31f5be6c3b64bff2464eb0b6b5b33ceb4e29a7;hpb=280555f7f9ec076b52cc7925a2dbd3a3368cb495;p=unfold.git diff --git a/portal/static/js/myslice-ui.js b/portal/static/js/myslice-ui.js index bd31f5be..1a3db498 100644 --- a/portal/static/js/myslice-ui.js +++ b/portal/static/js/myslice-ui.js @@ -2,16 +2,30 @@ /* * Call it with level: success, info, warning, danger */ -function mysliceAlert(msg, level, timeout) { +function mysliceAlert(msg, level, timeout, id) { level = typeof level !== 'undefined' ? level : 'success'; timeout = typeof timeout !== 'undefined' ? timeout : false; + id = typeof id !== 'undefined' ? id : ''; + + // onelab.upmc.slice the dot is causing a pb in the jQuery selector, so replace it ! + id = id.replace(/\./g,''); + var el = $('#myslice-message'); - el.find('.message').text(msg); - el.addClass('alert-' + level); + el.append("
"); + var msg_div = $('#msg-'+level+'-'+id); + msg_div.addClass('alert alert-dismissable myslice-message'); + msg_div.append(""); + msg_div.append(""); + msg_div.append(""); + msg_div.find('.message').html(msg); + msg_div.addClass('alert-' + level); el.fadeIn('fast'); el.parent().fadeIn('fast'); if (timeout) { - setTimeout(function(){el.hide();},5000); + setTimeout(function(){ + el.hide(); + msg_div.remove(); + },5000); } }; /* Table initialisation */