Skip to content

Commit a476a09

Browse files
committed
Add a link to edit the current page on github
Appropriates the pencil svg from Ember API docs. Sends users to the `/edit/master` github page for the current markdown file in a new window.
1 parent 6dd7024 commit a476a09

File tree

9 files changed

+32
-8
lines changed

9 files changed

+32
-8
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import Ember from 'ember';
2+
3+
export default Ember.Component.extend({
4+
tagName: '',
5+
});
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<a
2+
class="edit-link right"
3+
title="Edit on Github"
4+
href="https://github.com/ember-fastboot/fastboot-website/edit/master/markdown/{{path}}.md"
5+
target="_blank"
6+
rel="noopener"
7+
>
8+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -256 1792 1792">
9+
<path d="M484.492 1270.237l91-91-235-235-91 91v107h128v128h107zm523-928q0-22-22-22-10 0-17 7l-542 542q-7 7-7 17 0 22 22 22 10 0 17-7l542-542q7-7 7-17zm-54-192l416 416-832 832h-416v-416zm683 96q0 53-37 90l-166 166-416-416 166-165q36-38 90-38 53 0 91 38l235 234q37 39 37 91z" fill="currentColor"></path>
10+
</svg>
11+
</a>

app/routes/application.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ import markdownFiles from 'ember-fr-markdown-file/markdownFiles';
44

55
export default Route.extend({
66
model() {
7-
return get(markdownFiles, 'intro');
8-
}
7+
return {markdown: get(markdownFiles, 'intro'), path: 'intro'};
8+
},
99
});

app/routes/page.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import markdownFiles from 'ember-fr-markdown-file/markdownFiles';
44

55
export default Route.extend({
66
model(params) {
7-
return get(markdownFiles, params.path.replace(/\//g, '.')) || null;
8-
}
7+
const path = params.path;
8+
return {markdown: get(markdownFiles, path.replace(/\//g, '.')) || null, path};
9+
},
910
});

app/styles/app.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
@import "components/main-hero";
99
@import "components/main-hero-terminal";
1010
@import "components/main-nav";
11+
@import "components/edit-link";
1112
@import "components/syntax";
1213

1314
:root {
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
.edit-link {
2+
width: 20px;
3+
text-decoration: none;
4+
border-bottom: none;
5+
}

app/templates/components/main-nav.hbs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{{fastboot-logo}}
2+
{{edit-link path=path}}
23
<ul class="list-reset">
34
<li class="inline-block mr1">{{link-to 'Intro' 'index'}}</li>
45
<li class="inline-block mr1">{{link-to 'Quickstart' 'page' 'quickstart'}}</li>

app/templates/index.hbs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{{main-hero}}
22

33
<div class="p1">
4-
{{main-nav}}
4+
{{main-nav path=model.path}}
55
<section class="max-width-3 mx-auto">
6-
{{md-text text=model html=true typographer=true linkify=true}}
6+
{{md-text text=model.markdown html=true typographer=true linkify=true}}
77
</section>
88
</div>

app/templates/page.hbs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<div class="p1">
2-
{{main-nav}}
3-
{{#liquid-bind model as |currentModel|}}
2+
{{main-nav path=model.path}}
3+
{{#liquid-bind model.markdown as |currentModel|}}
44
<section class="max-width-3 mx-auto">
55
{{#if currentModel}}
66
{{md-text text=currentModel html=true typographer=true linkify=true}}

0 commit comments

Comments
 (0)