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

Add a link to edit the current page on github #89

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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 .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
lts/boron
5 changes: 5 additions & 0 deletions app/components/edit-link/component.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import Ember from 'ember';

export default Ember.Component.extend({
tagName: '',
});
11 changes: 11 additions & 0 deletions app/components/edit-link/template.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<a
class="edit-link right"
title="Edit on Github"
href="https://github.com/ember-fastboot/fastboot-website/edit/master/markdown/{{path}}.md"
target="_blank"
rel="noopener"
>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -256 1792 1792">
<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>
</svg>
</a>
4 changes: 2 additions & 2 deletions app/routes/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ import markdownFiles from 'ember-fr-markdown-file/markdownFiles';

export default Route.extend({
model() {
return get(markdownFiles, 'intro');
}
return {markdown: get(markdownFiles, 'intro'), path: 'intro'};
},
});
5 changes: 3 additions & 2 deletions app/routes/page.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import markdownFiles from 'ember-fr-markdown-file/markdownFiles';

export default Route.extend({
model(params) {
return get(markdownFiles, params.path.replace(/\//g, '.')) || null;
}
const path = params.path;
return {markdown: get(markdownFiles, path.replace(/\//g, '.')) || null, path};
},
});
1 change: 1 addition & 0 deletions app/styles/app.css
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
@import "components/main-hero";
@import "components/main-hero-terminal";
@import "components/main-nav";
@import "components/edit-link";
@import "components/syntax";

:root {
Expand Down
5 changes: 5 additions & 0 deletions app/styles/components/edit-link.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.edit-link {
width: 20px;
text-decoration: none;
border-bottom: none;
}
1 change: 1 addition & 0 deletions app/templates/components/main-nav.hbs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{{fastboot-logo}}
{{edit-link path=path}}
<ul class="list-reset">
<li class="inline-block mr1">{{link-to 'Intro' 'index'}}</li>
<li class="inline-block mr1">{{link-to 'Quickstart' 'page' 'quickstart'}}</li>
Expand Down
4 changes: 2 additions & 2 deletions app/templates/index.hbs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{{main-hero}}

<div class="p1">
{{main-nav}}
{{main-nav path=model.path}}
<section class="max-width-3 mx-auto">
{{md-text text=model html=true typographer=true linkify=true}}
{{md-text text=model.markdown html=true typographer=true linkify=true}}
</section>
</div>
4 changes: 2 additions & 2 deletions app/templates/page.hbs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div class="p1">
{{main-nav}}
{{#liquid-bind model as |currentModel|}}
{{main-nav path=model.path}}
{{#liquid-bind model.markdown as |currentModel|}}
<section class="max-width-3 mx-auto">
{{#if currentModel}}
{{md-text text=currentModel html=true typographer=true linkify=true}}
Expand Down