Skip to content

Commit a21b0a2

Browse files
committed
catch-all: Convert links to buttons
Using `javascript:...` hrefs does not work well with our CSP setup
1 parent 8393246 commit a21b0a2

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

app/controllers/catch-all.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,11 @@ import Controller from '@ember/controller';
22
import { action } from '@ember/object';
33

44
export default class CatchAllController extends Controller {
5-
@action reload(event) {
6-
event.preventDefault();
5+
@action reload() {
76
this.model.transition.retry();
87
}
8+
9+
@action back() {
10+
history.back();
11+
}
912
}

app/styles/catch-all.module.css

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,7 @@
1515
}
1616

1717
.link {
18+
composes: button-reset from '../styles/shared/buttons.module.css';
19+
composes: link from '../styles/application.module.css';
1820
font-weight: 500;
1921
}

app/templates/catch-all.hbs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
<h1 local-class="title" data-test-title>{{or @model.title "Page not found"}}</h1>
66

77
{{#if @model.tryAgain}}
8-
<a href="javascript:location.reload()" local-class="link" data-test-try-again {{on "click" this.reload}}>Try Again</a>
8+
<button type="button" local-class="link" data-test-try-again {{on "click" this.reload}}>Try Again</button>
99
{{else}}
10-
<a href="javascript:history.back()" local-class="link" data-test-go-back>Go Back</a>
10+
<button type="button" local-class="link" data-test-go-back {{on "click" this.back}}>Go Back</button>
1111
{{/if}}
1212
</div>
1313
</div>

0 commit comments

Comments
 (0)