Allow different flash level simultaneously

This commit is contained in:
Jerome Lebleu 2013-12-19 02:08:42 +01:00
parent f93d116035
commit 5fffdda9a6
2 changed files with 5 additions and 7 deletions

View file

@ -19,7 +19,7 @@
<div class="clearfix"></div>
<br />
</div>
<div id="flash" class="alert" style="display: none">
<div id="flash" style="display: none">
</div>
<div id="slider-container">
<div id="slideBack" class="block" style="display: none;"></div>

View file

@ -47,14 +47,12 @@ app = Sammy('#main', function (sam) {
html = '';
for(lvl in flashs) {
flashs[lvl].forEach( function(msg) {
html += '<div class="'+ lvl +'">'+ msg +'</div>';
if (lvl == 'fail') { alertClass = 'alert-danger'; }
else { alertClass = 'alert-'+ lvl; }
html += '<div class="alert '+ alertClass +'">'+ msg +'</div>';
});
}
if (level == 'fail') { alertClass = 'alert-danger'; }
else if (level == 'success') { alertClass = 'alert-success'; }
else { alertClass = 'alert-info'; }
$('#flash').removeClass().addClass('alert '+ alertClass).html(html).fadeIn();
$('#flash').html(html).fadeIn();
},
// API connection helper