-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce two configuration attributes `back_to_site_link_text` and `back_to_site_link_path`. It is used to display the backlink to the original site.
- Loading branch information
Showing
10 changed files
with
69 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import Component from "@ember/component"; | ||
import { computed } from "@ember/object"; | ||
|
||
export default class BackToSiteLink extends Component { | ||
@computed("attrs.text", "attrs.path") | ||
get shouldDisplay() { | ||
return this.text && this.path; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{{#if this.shouldDisplay}} | ||
<div id="back-to-site-panel"> | ||
<a href={{@path}} rel="noopener noreferrer"> | ||
<FaIcon @icon="arrow-left" /> | ||
{{@text}} | ||
</a> | ||
</div> | ||
{{/if}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
client-app/tests/integration/components/back-to-site-link-test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { module, test } from "qunit"; | ||
import { setupRenderingTest } from "ember-qunit"; | ||
import { render } from "@ember/test-helpers"; | ||
import hbs from "htmlbars-inline-precompile"; | ||
|
||
module("Integration | Component | back-to-site-link", function (hooks) { | ||
setupRenderingTest(hooks); | ||
|
||
test("With path and text paremeter", async function (assert) { | ||
await render(hbs`<BackToSiteLink @path="/admin" @text="back to site"/>`); | ||
assert.dom("#back-to-site-panel a").exists("It shows back to site link"); | ||
}); | ||
|
||
test("Without required paremeters", async function (assert) { | ||
await render(hbs`<BackToSiteLink />`); | ||
assert | ||
.dom("#back-to-site-panel a") | ||
.doesNotExist("It does not show back link to site"); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters