-
{{category.title}}{{#if category.public}} -
{{t "interests.index.list.public"}}{{/if}}
+
{{category.title}}
+ {{#if category.public}}
+ -
+
+ {{t "interests.index.list.public"}}
+
+ {{/if}}
{{#if category.description}}
-
{{category.description}}
+
+ {{category.description}}
+
{{/if}}
@@ -70,9 +74,22 @@
{{#each category.interests as |interest|}}
{{#unless interest.isNew}}
- -
- {{interest.title}}
-
{{interest.description}}
+ -
+
+ {{interest.title}}
+
+
+ {{interest.description}}
+
{{/unless}}
{{/each}}
@@ -85,4 +102,4 @@
{{else}}
{{t "interests.index.list.empty"}}
{{/if}}
-
+
\ No newline at end of file
diff --git a/ember/app/ui/interests/route.js b/ember/app/ui/interests/route.js
index 917c7882c..96d798e15 100644
--- a/ember/app/ui/interests/route.js
+++ b/ember/app/ui/interests/route.js
@@ -3,10 +3,11 @@ import { inject as service } from "@ember/service";
export default class InterestsRoute extends Route {
@service can;
+ @service router;
beforeModel() {
if (this.can.cannot("list interest")) {
- return this.transitionTo("notfound");
+ return this.router.transitionTo("notfound");
}
}
}
diff --git a/ember/mirage/factories/interest-category.js b/ember/mirage/factories/interest-category.js
index 9c833a2ab..23401faf9 100644
--- a/ember/mirage/factories/interest-category.js
+++ b/ember/mirage/factories/interest-category.js
@@ -7,7 +7,6 @@ export default Factory.extend({
archived: () => faker.datatype.boolean(),
afterCreate(category, server) {
- const children = Math.floor(Math.random() * 5 + 0.5);
- server.createList("interest", children, { category });
+ server.createList("interest", 3, { category });
},
});
diff --git a/ember/tests/acceptance/identities-test.js b/ember/tests/acceptance/identities-test.js
index 4cc412f12..97ef7c7fa 100644
--- a/ember/tests/acceptance/identities-test.js
+++ b/ember/tests/acceptance/identities-test.js
@@ -38,7 +38,7 @@ module("Acceptance | identities", function (hooks) {
await click(".uk-button-danger");
- assert.dom(".uk-modal-body").includesText("applications");
+ assert.dom(".uk-modal-body").includesText("0 Gesuche");
await click(".uk-modal-footer .uk-button-primary");
diff --git a/ember/tests/acceptance/interest-test.js b/ember/tests/acceptance/interest-test.js
new file mode 100644
index 000000000..0e9215536
--- /dev/null
+++ b/ember/tests/acceptance/interest-test.js
@@ -0,0 +1,90 @@
+import { visit, fillIn, click, waitFor, currentURL } from "@ember/test-helpers";
+import { setupMirage } from "ember-cli-mirage/test-support";
+import { setupIntl } from "ember-intl/test-support";
+import { setupApplicationTest } from "ember-qunit";
+import { authenticateSession } from "ember-simple-auth/test-support";
+import { module, test } from "qunit";
+
+module("Acceptance | interest", function (hooks) {
+ setupApplicationTest(hooks);
+ setupMirage(hooks);
+ setupIntl(hooks);
+
+ hooks.beforeEach(async function () {
+ this.category = this.server.create("interest-category");
+
+ await authenticateSession({
+ access_token: "123qweasdyxc",
+ userinfo: { mysagw_groups: ["sagw"] },
+ });
+
+ await visit("/interests");
+ });
+
+ test("can list", async function (assert) {
+ assert.dom("[data-test-category]").exists({ count: 1 });
+ assert.dom("[data-test-interest]").exists({ count: 3 });
+ });
+
+ test("can add new category", async function (assert) {
+ await click("[data-test-category-add]");
+
+ assert.strictEqual(currentURL(), "/interests/add");
+
+ // create new category
+ await fillIn("[data-test-input-title]", "Apple");
+ await fillIn("[data-test-input-description]", "Pear");
+ await click("[data-test-input-public]");
+
+ await click("[data-test-save]");
+
+ assert.ok(currentURL().includes("/edit/"));
+
+ await click("[data-test-interest-add]");
+
+ // create new interest
+ await fillIn("[data-test-new-interest-title]", "Melon");
+ await fillIn("[data-test-new-interest-description]", "Pumpkin");
+ await click("[data-test-new-interest-save]");
+
+ await click("[data-test-save-back]");
+
+ assert.dom("[data-test-category]").exists({ count: 2 });
+
+ assert
+ .dom('[data-test-category="Apple"] [data-test-category-title]')
+ .hasText("Apple");
+ assert
+ .dom('[data-test-category="Apple"] [data-test-category-description]')
+ .hasText("Pear");
+ assert
+ .dom('[data-test-category="Apple"] [data-test-category-public]')
+ .exists({ count: 1 });
+
+ assert
+ .dom('[data-test-category="Apple"] [data-test-interest]')
+ .exists({ count: 1 });
+ assert
+ .dom('[data-test-category="Apple"] [data-test-interest-title]')
+ .hasText("Melon");
+ assert
+ .dom('[data-test-category="Apple"] [data-test-interest-description]')
+ .hasText("Pumpkin");
+ });
+
+ test("can delete category", async function (assert) {
+ await click("[data-test-category-delete]");
+
+ await waitFor(".uk-modal.uk-open");
+
+ await click(".uk-modal button.uk-button-primary");
+
+ assert.dom("[data-test-category]").doesNotExist();
+ });
+
+ test("interest is linked", async function (assert) {
+ await click(`[data-test-interest]:first-child [data-test-interest-title]`);
+
+ assert.ok(currentURL().includes("/identities?searchTerm=%22"));
+ });
+});
diff --git a/ember/translations/components/identity-interests/de.yaml b/ember/translations/components/identity-interests/de.yaml
index 4151df67a..879b2fddd 100755
--- a/ember/translations/components/identity-interests/de.yaml
+++ b/ember/translations/components/identity-interests/de.yaml
@@ -2,6 +2,7 @@ components:
identity-interests:
title: "Interessen"
add: "Interesse hinzufügen"
+ disclaimer: "Mit dem Speichern erkläre ich mich einverstanden, von der SAGW Informationen oder Publikationen zu den von mir angegebenen Interessen zu erhalten und bestätige, dass ich die
Hinweise zum Datenschutz gelesen habe und sie akzeptiere."
list:
delete: "Interesse löschen"
diff --git a/ember/translations/components/identity-interests/en.yaml b/ember/translations/components/identity-interests/en.yaml
index 0b52e36cc..e9137f53e 100644
--- a/ember/translations/components/identity-interests/en.yaml
+++ b/ember/translations/components/identity-interests/en.yaml
@@ -2,6 +2,7 @@ components:
identity-interests:
title: "Interests"
add: "Add interest"
+ disclaimer: "By saving, I agree to receive information or publications from the SAHS on the interests I have indicated and confirm that I have read and accept the
information on data protection."
list:
delete: "Delete interest"
diff --git a/ember/translations/components/identity-interests/fr.yaml b/ember/translations/components/identity-interests/fr.yaml
index dd88fea31..4b8bf17a4 100755
--- a/ember/translations/components/identity-interests/fr.yaml
+++ b/ember/translations/components/identity-interests/fr.yaml
@@ -2,6 +2,7 @@ components:
identity-interests:
title: "Intérêts"
add: "Ajouter un intérêt"
+ disclaimer: "En enregistrant, je donne mon accord pour recevoir de l’ASSH des informations ou des publications en lien avec les intérêts que j’ai indiqués et je confirme avoir lu et accepté les indications relatives à la
protection des données."
list:
delete: "Supprimer un intérêt"