add floating alert message

This commit is contained in:
zmagod 2018-03-13 16:33:48 +01:00
parent d8cf3b1f07
commit a6a25bbe08
6 changed files with 29 additions and 37 deletions

View file

@ -198,9 +198,6 @@ var HelperModule = (function(){
window.setTimeout(function () {
flash.fadeTo(500, 0).slideUp(500, function () {
$(this).remove();
if($('.alert').length <= 0) {
$('#content-wrapper').removeClass('alert-shown');
}
});
}, 5000);
}
@ -234,7 +231,6 @@ var HelperModule = (function(){
'</div>' +
'</div>';
$('#notifications').html(htmlSnippet);
$('#content-wrapper').addClass('alert-shown');
helpers.hideFlashMsg();
}

View file

@ -134,8 +134,7 @@
function notificationAlertClose() {
$('#notifications .alert').on('closed.bs.alert', function() {
$('#content-wrapper')
.addClass('alert-hidden')
.removeClass('alert-shown');
.addClass('alert-hidden');
});
}
}

View file

@ -36,7 +36,6 @@ $(document).ready(function () {
$("#hide-alert").click(function(ev) {
$(this).closest("div.alert").addClass("alert-hidden");
$("#content-wrapper").addClass("alert-hidden");
$("#content-wrapper").removeClass("alert-shown");
ev.preventDefault();
ev.stopPropagation();

View file

@ -367,6 +367,33 @@
}
}
// Alert
.alert {
border-radius: 0;
margin-bottom: 0;
opacity: .86;
width: 100%;
&.alert-hidden {
display: none;
}
a#hide-alert {
margin-left: 15px;
}
&.alert-floating {
position: fixed;
top: 50px;
z-index: 1000;
}
}
#content-wrapper {
margin-top: 50px;
}
// reset margins on small screens
@media (max-width: 1188px) {
#nav-team-switch {

View file

@ -59,14 +59,6 @@ table {
margin-right: 0.5em;
}
#content-wrapper {
margin-top: 50px;
&.alert-shown {
margin-top: 102px;
}
}
.center-block-narrow {
max-width: 400px;
}
@ -117,27 +109,6 @@ a {
background-color: inherit;
}
.alert {
border-radius: 0;
margin-bottom: 0;
opacity: 1;
width: 100%;
&.alert-hidden {
display: none;
}
a#hide-alert {
margin-left: 15px;
}
&.alert-floating {
position: fixed;
top: 50px;
z-index: 1000;
}
}
.badge {
background-color: $color-theme-primary;
font-size: 11px;

View file

@ -80,7 +80,7 @@
<% end %>
</div>
<div id="content-wrapper" class="<%= "alert-shown" if flash[:success] || flash[:error] || notice || alert %>">
<div id="content-wrapper">
<%= yield :content %>
</div>