Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement 404 page #906

Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions app/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ AppRouter.map(function () {
this.route('module', { path: '/modules/:module' });
this.route('data-class', { path: '/data/classes/:class' });
this.route('data-module', { path: '/data/modules/:module' });
this.route('not-found', { path: '/*' });
});

/*
Expand Down
14 changes: 14 additions & 0 deletions app/routes/not-found.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import Route from '@ember/routing/route';
import { inject as service } from '@ember/service';

export default class NotFoundRoute extends Route {
@service fastboot;

beforeModel() {
if (!this.fastboot.isFastBoot) {
return;
}

this.fastboot.response.statusCode = 404;
}
}
29 changes: 29 additions & 0 deletions app/styles/app.css
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,18 @@ a.class-field-description--link:hover svg {
fill: var(--color-brand);
}

.whoops {
display: flex;
justify-content: center;
align-items: center;
padding: var(--spacing-6)
}

.whoops img {
width: 240px;
margin: var(--spacing-2);
}

@media (min-width: 845px) {
.es-header {
padding: 0 var(--spacing-4);
Expand All @@ -124,3 +136,20 @@ a.class-field-description--link:hover svg {
margin-top: var(--spacing-4);
}
}

@media (max-width: 450px) {
.whoops {
flex-direction: column;
padding: var(--spacing-3);
}

.whoops img {
width: 80%;
margin: var(--spacing-4);
}

.whoops__message {
margin: var(--spacing-2);
text-align: center;
}
}
7 changes: 7 additions & 0 deletions app/templates/not-found.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<article class="whoops">
<img src="/assets/images/stinky-fish.png" alt="tomster stinky fish"/>
<div class="whoops__message">
<h2>Ack! 404 friend, you're in the wrong place</h2>
<LinkTo @route='index'>Click here to go home</LinkTo>
</div>
</article>
Binary file added public/assets/images/stinky-fish.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 11 additions & 0 deletions tests/unit/routes/not-found-test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { module, test } from 'qunit';
import { setupTest } from 'ember-qunit';

module('Unit | Route | not-found', function (hooks) {
setupTest(hooks);

test('it exists', function (assert) {
let route = this.owner.lookup('route:not-found');
assert.ok(route);
});
});
MehulKChaudhari marked this conversation as resolved.
Show resolved Hide resolved
Loading