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> <div class="clearfix"></div>
<br /> <br />
</div> </div>
<div id="flash" class="alert" style="display: none"> <div id="flash" style="display: none">
</div> </div>
<div id="slider-container"> <div id="slider-container">
<div id="slideBack" class="block" style="display: none;"></div> <div id="slideBack" class="block" style="display: none;"></div>

View file

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