Skip to content

Commit

Permalink
Site wide useable overlay loader spinner, instead of preview specifc …
Browse files Browse the repository at this point in the history
…effects. Plain css and js.
  • Loading branch information
dgcliff committed Feb 15, 2024
1 parent bbddb2c commit c03023a
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.5.0
2.5.1
27 changes: 27 additions & 0 deletions app/assets/stylesheets/cerberus.scss
Original file line number Diff line number Diff line change
Expand Up @@ -141,3 +141,30 @@ ol.breadcrumb {
.nav-tabs {
margin: 10px 0px 10px 0px;
}

.loading-state {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.3);
z-index: 9999;
display: flex;
justify-content: center;
align-items: center;
visibility: hidden;
}
.loading {
width: 100px;
height: 100px;
border-radius: 50%;
border: 10px solid #ddd;
border-top-color: $blue;
animation: loading 1s linear infinite;
}
@keyframes loading {
to {
transform: rotate(360deg);
}
}
2 changes: 1 addition & 1 deletion app/javascript/preview_controllers/preview_controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export default class extends Controller {
});

document.getElementById('validate_button').onclick = function(){
$("#content").css({visibility:"visible", opacity: 100}).animate({opacity: 0}, 500);
$(".loading-state").css({visibility:"visible", opacity: 0.0}).animate({opacity: 1.0}, 500);
};
}
}
3 changes: 3 additions & 0 deletions app/views/shared/_footer.html.haml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
.loading-state
.loading

%footer.footer.mt-auto.py-3
.container-lg
.row
Expand Down
4 changes: 3 additions & 1 deletion app/views/xml/validate.turbo_stream.haml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,7 @@
= @mods.html_safe

:javascript
$("#content").css({visibility:"visible", opacity: 0.0}).animate({opacity: 1.0}, 500);
$(".loading-state").animate({opacity: 0.0}, 500, function(){
$(".loading-state").css("visibility","hidden");
});
window.scrollTo(0,0);

0 comments on commit c03023a

Please sign in to comment.