Skip to content
This repository has been archived by the owner on May 13, 2024. It is now read-only.

Commit

Permalink
fix: protected route events
Browse files Browse the repository at this point in the history
* handle finished and loading events correctly
* make loader visible via z-index 9999
  • Loading branch information
derrabauke committed Dec 8, 2022
1 parent 5290ceb commit 522854a
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 10 deletions.
15 changes: 12 additions & 3 deletions app/protected/route.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,15 +88,24 @@ export default class ProtectedRoute extends Route {
loading(transition) {
//eslint-disable-next-line ember/no-controller-access-in-routes
const controller = this.controllerFor("protected");

if (controller) {
controller.set("loading", true);
controller.loading = true;

if (transition) {
transition.promise.finally(function () {
controller.loading = false;
controller.send("finished");
});
}
}
}

@action
finished() {
//eslint-disable-next-line ember/no-controller-access-in-routes
const controller = this.controllerFor("protected");

if (controller) {
controller.loading = false;
}
}
}
7 changes: 7 additions & 0 deletions app/protected/template.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,10 @@
{{outlet}}
</div>
</main>

<WelcomeModal
@visible={{this.visible}}
@on-never={{this.neverTour}}
@on-later={{this.laterTour}}
@on-start={{this.startTour}}
/>
28 changes: 21 additions & 7 deletions app/styles/loader.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@
top: 0;
right: 0;
left: 0;
z-index: 9999;
overflow: hidden;
background-color: #ddd;
}
.loader:before{
.loader:before {
display: block;
position: absolute;
content: "";
Expand All @@ -20,10 +21,23 @@
}

@keyframes loading {
from { left: -200px; width: 30%; }
50% { width: 30%; }
70% { width: 70%; }
80% { left: 50%; }
95% { left: 120%; }
to { left: 100%; }
from {
left: -200px;
width: 30%;
}
50% {
width: 30%;
}
70% {
width: 70%;
}
80% {
left: 50%;
}
95% {
left: 120%;
}
to {
left: 100%;
}
}

0 comments on commit 522854a

Please sign in to comment.