-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(custom-buttons): configurable custom buttons (#350)
* feat(custom-buttons): configurable custom buttons * fix(emeis-options): make use of intl translation keys optional * feat(emeis-options): allow multiple custom buttons per view Co-authored-by: Christian Zosel <[email protected]>
- Loading branch information
1 parent
4af09c0
commit 8ffdb31
Showing
13 changed files
with
180 additions
and
37 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
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
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,10 @@ | ||
import Helper from "@ember/component/helper"; | ||
import { inject as service } from "@ember/service"; | ||
|
||
export default class OptionalTranslate extends Helper { | ||
@service intl; | ||
|
||
compute([string]) { | ||
return this.intl.exists(string) ? this.intl.t(string) : string; | ||
} | ||
} |
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 |
---|---|---|
|
@@ -139,4 +139,5 @@ | |
checked={{@model.isActive}} | ||
/> | ||
</EditForm::Element> | ||
|
||
</EditForm> |
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 @@ | ||
export { default } from "ember-emeis/helpers/optional-translate"; |
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,21 @@ | ||
import { render } from "@ember/test-helpers"; | ||
import { hbs } from "ember-cli-htmlbars"; | ||
import { setupIntl } from "ember-intl/test-support"; | ||
import { setupRenderingTest } from "ember-qunit"; | ||
import { module, test } from "qunit"; | ||
|
||
module("Integration | Helper | optional-translate", function (hooks) { | ||
setupRenderingTest(hooks); | ||
setupIntl(hooks, { foo: "translation of foo" }); | ||
|
||
test("it translates if the translation exists", async function (assert) { | ||
await render(hbs`{{optional-translate "foo"}}`); | ||
|
||
assert.dom(this.element).hasText("translation of foo"); | ||
}); | ||
test("it falls back to the translation key otherwise", async function (assert) { | ||
await render(hbs`{{optional-translate "baz"}}`); | ||
|
||
assert.dom(this.element).hasText("baz"); | ||
}); | ||
}); |
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