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

View file

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

View file

@ -36,7 +36,6 @@ $(document).ready(function () {
$("#hide-alert").click(function(ev) { $("#hide-alert").click(function(ev) {
$(this).closest("div.alert").addClass("alert-hidden"); $(this).closest("div.alert").addClass("alert-hidden");
$("#content-wrapper").addClass("alert-hidden"); $("#content-wrapper").addClass("alert-hidden");
$("#content-wrapper").removeClass("alert-shown");
ev.preventDefault(); ev.preventDefault();
ev.stopPropagation(); 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 // reset margins on small screens
@media (max-width: 1188px) { @media (max-width: 1188px) {
#nav-team-switch { #nav-team-switch {

View file

@ -59,14 +59,6 @@ table {
margin-right: 0.5em; margin-right: 0.5em;
} }
#content-wrapper {
margin-top: 50px;
&.alert-shown {
margin-top: 102px;
}
}
.center-block-narrow { .center-block-narrow {
max-width: 400px; max-width: 400px;
} }
@ -117,27 +109,6 @@ a {
background-color: inherit; 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 { .badge {
background-color: $color-theme-primary; background-color: $color-theme-primary;
font-size: 11px; font-size: 11px;

View file

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