Skip to content

Commit

Permalink
Merge pull request #5 from ember-learn/fix-edit-icon
Browse files Browse the repository at this point in the history
fixing the edit icon for current version
  • Loading branch information
mansona committed Feb 13, 2019
2 parents cb69aa0 + 778d9a4 commit 2032bad
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
12 changes: 12 additions & 0 deletions app/components/guides-article.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,23 @@
import Component from '@ember/component';
import { inject as service } from '@ember/service';
import { computed } from '@ember/object';

export default Component.extend({
tagName: 'article',
classNames: 'chapter',
page: service(),
guidemaker: service(),
editVersion: computed('version', 'currentVersion', function() {
if(this.page.currentVersion === 'release') {
return '';
}

if(this.version === this.currentVersion) {
return 'release/'
}

return `${this.page.currentVersion}/`;
}),

didRender() {
let nodeList = this.$('pre:not(.no-line-numbers) > code');
Expand Down
2 changes: 1 addition & 1 deletion app/templates/components/guides-article.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
{{/unless}}

{{#if guidemaker.sourceRepo}}
<a href="{{guidemaker.sourceRepo}}/edit/master/guides/{{unless (eq page.currentVersion 'release') (concat page.currentVersion '/')}}{{model.id}}.md"
<a href="{{guidemaker.sourceRepo}}/edit/master/guides/{{editVersion}}{{model.id}}.md"
target="_blank" class="edit-page icon-pencil">Edit Page</a>
{{/if}}

Expand Down

0 comments on commit 2032bad

Please sign in to comment.