From 29970fef5e4d627b9b7b4750ab2cd80778de523b Mon Sep 17 00:00:00 2001 From: Daniel Grams Date: Thu, 2 Sep 2021 11:31:23 +0200 Subject: [PATCH] Seitenladezeiten optimieren #288 --- .github/workflows/cypress.yml | 5 +- .github/workflows/test.yml | 2 +- cypress/integration/admin.js | 35 ++ cypress/integration/admin_unit.js | 44 ++ cypress/integration/admin_unit_member.js | 41 ++ .../admin_unit_member_invitation.js | 49 +++ cypress/integration/admin_unit_relation.js | 68 +++ cypress/integration/event.js | 30 ++ cypress/integration/event_date.js | 19 + cypress/integration/event_place.js | 47 +++ cypress/integration/event_suggestion.js | 29 ++ cypress/integration/index.js | 5 - cypress/integration/login.js | 28 -- cypress/integration/manage.js | 30 +- cypress/integration/oauth.js | 5 + cypress/integration/oauth2_client.js | 56 +++ cypress/integration/oauth2_token.js | 14 + cypress/integration/organization.js | 10 + cypress/integration/organizer.js | 47 +++ cypress/integration/planing.js | 14 + cypress/integration/reference.js | 62 +++ cypress/integration/reference_request.js | 55 +-- .../integration/reference_request_review.js | 45 ++ cypress/integration/register.js | 43 -- cypress/integration/relations.js | 10 - cypress/integration/root.js | 30 ++ cypress/integration/user.js | 88 ++++ .../integration/{suggestion.js => widget.js} | 37 +- cypress/plugins/index.js | 16 +- cypress/support/commands.js | 154 ++++++- cypress/support/index.js | 3 + messages.pot | 331 ++++++++------- package-lock.json | 389 +++++++++++++++++- package.json | 3 +- project/cli/test.py | 159 ++++++- project/cli/user.py | 11 +- project/i10n.py | 2 + project/static/jquery.recurrenceinput.js | 128 ++++++ project/static/site.js | 138 ------- .../vue/organization-relations/create.vue.js | 1 + project/templates/_macros.html | 72 +++- project/templates/admin_unit/create.html | 11 +- project/templates/admin_unit/update.html | 13 +- project/templates/event/create.html | 9 +- project/templates/event/update.html | 9 +- project/templates/event_date/list.html | 25 +- project/templates/event_place/create.html | 11 +- project/templates/event_place/update.html | 11 +- project/templates/home.html | 1 + project/templates/layout.html | 35 +- project/templates/manage/events.html | 14 +- project/templates/manage/relations.html | 34 +- project/templates/manage/widgets.html | 2 +- project/templates/organizer/create.html | 11 +- project/templates/organizer/update.html | 11 +- project/templates/planing/list.html | 13 +- project/templates/security/register_user.html | 3 +- project/templates/widget/event_date/list.html | 9 +- .../widget/event_suggestion/create.html | 7 +- .../translations/de/LC_MESSAGES/messages.mo | Bin 29920 -> 30067 bytes .../translations/de/LC_MESSAGES/messages.po | 335 ++++++++------- .../translations/en/LC_MESSAGES/messages.mo | Bin 3225 -> 3365 bytes .../translations/en/LC_MESSAGES/messages.po | 331 ++++++++------- tests/cli/test_user.py | 2 +- 64 files changed, 2407 insertions(+), 845 deletions(-) create mode 100644 cypress/integration/admin.js create mode 100644 cypress/integration/admin_unit.js create mode 100644 cypress/integration/admin_unit_member.js create mode 100644 cypress/integration/admin_unit_member_invitation.js create mode 100644 cypress/integration/admin_unit_relation.js create mode 100644 cypress/integration/event_date.js create mode 100644 cypress/integration/event_place.js create mode 100644 cypress/integration/event_suggestion.js delete mode 100644 cypress/integration/index.js delete mode 100644 cypress/integration/login.js create mode 100644 cypress/integration/oauth.js create mode 100644 cypress/integration/oauth2_client.js create mode 100644 cypress/integration/oauth2_token.js create mode 100644 cypress/integration/organization.js create mode 100644 cypress/integration/organizer.js create mode 100644 cypress/integration/planing.js create mode 100644 cypress/integration/reference.js create mode 100644 cypress/integration/reference_request_review.js delete mode 100644 cypress/integration/register.js delete mode 100644 cypress/integration/relations.js create mode 100644 cypress/integration/root.js create mode 100644 cypress/integration/user.js rename cypress/integration/{suggestion.js => widget.js} (74%) diff --git a/.github/workflows/cypress.yml b/.github/workflows/cypress.yml index ebbc43e..08a500a 100644 --- a/.github/workflows/cypress.yml +++ b/.github/workflows/cypress.yml @@ -8,7 +8,7 @@ env: jobs: # Label of the container job - runner-job: + cypress: strategy: fail-fast: false matrix: @@ -71,6 +71,9 @@ jobs: env: DATABASE_URL: postgresql://postgres:postgres@localhost/gsevpt_tests TESTING: 1 + AUTHLIB_INSECURE_TRANSPORT: 1 + JWT_PRIVATE_KEY: '-----BEGIN RSA PRIVATE KEY-----\nMIIEpAIBAAKCAQEAxMl+DFiwhnoWRiVPcEIstAW66VY39JNo1TG1U10OfaFMuWI8\njcq5VfSRPBdXLRqAJwZi4CZCwOglEvURArf1QTxVBdLpDW75tD6fNOHaHKvX5WPR\nMGC/7Rfo9K/OgEWnQplc/0Me9D8MzTpIA56Uo/H/DE82kGWOMcWdqIA40pHaCZ7i\nWIoD7pS6DcRDt/8o0+IQqhMC4SrjL2HelzXHpg4glgY+GLbvTPOfV/OlFCAWDK3o\nN3wMBYS+TFP2Q/5pXfPCajIrSfF7dHyZU2d/K26A8naKcSUYuJzA8GBXkPx8YObt\nOS5SYYeD5GeGsX3IsVVyk3WqMVN7NXvRqmNjqQIDAQABAoIBABYoJbQYLFAH4Qgm\n3UnjeYsPdhsdpRE5o70VargnKyGEDtJ0uCKy56lA7zVX323ppPI/6tQYGr4DpWD8\nDN1Efy3IMD6Gn8zuaNkdj+lxYJCH3LgsQ/pxekqkvYsHXHXe4dVC1VC8avjPPI7C\n+CbILS5EahYluRwLAzahbH3zafJzXK6qxVCaPBn1QAG/b5FhGCoSSmar+6gxypX1\nIt977gMaZ9sbaRCfQ2BYEeRyWcBvPPWnM1q87Q/s4dFcHplE6ADLtTOAtFzwKne+\n0jP8AvcnQ6/vG7lM7epUfZLyPRt+79PIAj1ndtff10vGwVwoVuhGuwumIp7vMxQq\nF8VC5o0CgYEA/escZHgN25mrUlKhaGWmtxIfqreaLKjCc/mc1pMEfnMAVgrcVUu4\nMiAx6/k6o9CUrPtNUuKktAuAZMAN505it2k9wjwmu+snfgwj2oMKHGsss9yJ19Fc\nlKdoHE4QeHMQWnIqqN/lRza/tfUPlMDLY04gxMZR1R7Y7L2Hf2aLxQMCgYEAxmZ7\najpJResNEiSxFldImwBLjuLhqvOzPYDsqBpwB0gQOJtbKuPPzKB6J8guXVi+DHDz\neTKOAm3BQymb2xRuyvrclFi4a1LWFWsTz+PAMXss2h+TjGm1dkAYt/FiSqyuyLY5\n48igJjdH64G2M4w8eN0YUtKvQRqaZ37jFMbR5uMCgYEAkONbrCilH62sCKmF2KBI\nZSY+U5e4rcsOSkcgq3/wjIbqpi5EU5eFX3Tnh5MLVvZqH9q14JnbCbGWbeb5CAe+\nZJH036SbJZelTVN4EfO8DUNKmsc5EKEyhtCPo7cXxuNBbZq/pOU9W0luU1Gmtmbc\np6mpIR9ZCpcziMMNUjEdiCkCgYB8aoP2Z7rPd8lomU3cHrxPR24amri9xbmfVhwS\nhxG93zkc5n/Tc606O2CfVe+NZjs3/hUQ6d0YNM+/WHZ+el/INmzhMonj87yBDfcM\npVw/K2lDGA4lPZ0oHKXjpCHphkTNZUkESSn1DTGyxFMIHGdHvA6m0axJfW9ae73X\np5611QKBgQC/wOD9Wv6IQLR7f5GQSXrlmiCGmUugd3BG7UXrevYzbm48ePyIIa+e\nPaSvTkZR5Ji5XvajSDhYK1/2qmozk6B1pH1M4jqKD80zZOq8mc9q8lZ9fEIxi5wz\nPVHRdVKT+wEsbeQhxqX/RfaqIi1UcBmwhnZKXutXPon/ZIg7iVoo5g==\n-----END RSA PRIVATE KEY-----\n' + JWT_PUBLIC_JWKS: '{"keys":[{"kid":"default","kty":"RSA","use":"sig","alg":"RS256","n":"xMl-DFiwhnoWRiVPcEIstAW66VY39JNo1TG1U10OfaFMuWI8jcq5VfSRPBdXLRqAJwZi4CZCwOglEvURArf1QTxVBdLpDW75tD6fNOHaHKvX5WPRMGC_7Rfo9K_OgEWnQplc_0Me9D8MzTpIA56Uo_H_DE82kGWOMcWdqIA40pHaCZ7iWIoD7pS6DcRDt_8o0-IQqhMC4SrjL2HelzXHpg4glgY-GLbvTPOfV_OlFCAWDK3oN3wMBYS-TFP2Q_5pXfPCajIrSfF7dHyZU2d_K26A8naKcSUYuJzA8GBXkPx8YObtOS5SYYeD5GeGsX3IsVVyk3WqMVN7NXvRqmNjqQ","e":"AQAB"}]}' CYPRESS_PROJECT_ID: ${{ secrets.CYPRESS_PROJECT_ID }} CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c2f8d68..e5f18ef 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -7,7 +7,7 @@ on: [pull_request, workflow_dispatch] jobs: # Label of the container job - runner-job: + integration-tests: # Containers must run in Linux based operating systems runs-on: ubuntu-latest diff --git a/cypress/integration/admin.js b/cypress/integration/admin.js new file mode 100644 index 0000000..7a1818f --- /dev/null +++ b/cypress/integration/admin.js @@ -0,0 +1,35 @@ +describe("Admin", () => { + it("settings", () => { + cy.createUser("admin@test.de", "password", true).then(function (userId) { + cy.login("admin@test.de"); + cy.visit("/admin"); + cy.visit("/admin/settings"); + cy.get("#submit").click(); + cy.url().should("include", "/admin"); + }); + }); + + it("admin units", () => { + cy.createUser("admin@test.de", "password", true).then(function (userId) { + cy.login("admin@test.de"); + cy.visit("/admin/admin_units"); + + cy.createAdminUnit().then(function (adminUnitId) { + cy.visit("/admin/admin_unit/" + adminUnitId + "/update"); + cy.get("#submit").click(); + cy.url().should("include", "/admin/admin_units"); + }); + }); + }); + + it("users", () => { + cy.createUser("admin@test.de", "password", true).then(function (userId) { + cy.login("admin@test.de"); + cy.visit("/admin/users"); + + cy.visit("/admin/user/" + userId + "/update"); + cy.get("#submit").click(); + cy.url().should("include", "/admin/users"); + }); + }); +}); diff --git a/cypress/integration/admin_unit.js b/cypress/integration/admin_unit.js new file mode 100644 index 0000000..bab5955 --- /dev/null +++ b/cypress/integration/admin_unit.js @@ -0,0 +1,44 @@ +describe("Admin Unit", () => { + it("creates", () => { + cy.login(); + cy.visit("/admin_unit/create"); + cy.get("#name").type("Second Crew"); + cy.get("#location-postalCode").type("38640"); + cy.get("#location-city").type("Goslar"); + cy.screenshot("create"); + cy.get("#submit").click(); + cy.url().should("include", "/manage/admin_unit/"); + }); + + it("updates", () => { + cy.login(); + cy.createAdminUnit().then(function (adminUnitId) { + cy.visit("/admin_unit/" + adminUnitId + "/update"); + cy.screenshot("update"); + cy.get("#submit").click(); + cy.url().should("include", "/admin_unit/" + adminUnitId + "/update"); + cy.get("div.alert").should( + "contain", + "Organisation erfolgreich aktualisiert" + ); + }); + }); + + it("widgets", () => { + cy.login(); + cy.createAdminUnit().then(function (adminUnitId) { + cy.visit("/manage/admin_unit/" + adminUnitId + "/widgets"); + cy.get("#toggle-settings-btn").click(); + cy.screenshot("widgets"); + cy.get("#submit").click(); + cy.url().should( + "include", + "/manage/admin_unit/" + adminUnitId + "/widgets" + ); + cy.get("div.alert").should( + "contain", + "Einstellungen erfolgreich aktualisiert" + ); + }); + }); +}); diff --git a/cypress/integration/admin_unit_member.js b/cypress/integration/admin_unit_member.js new file mode 100644 index 0000000..d6ddc18 --- /dev/null +++ b/cypress/integration/admin_unit_member.js @@ -0,0 +1,41 @@ +describe("Admin Unit Member", () => { + it("updates", () => { + cy.login(); + cy.createAdminUnit().then(function (adminUnitId) { + cy.createUser("new@test.de").then(function () { + cy.createAdminUnitMember(adminUnitId, "new@test.de").then(function ( + memberId + ) { + cy.visit("/manage/member/" + memberId + "/update"); + cy.screenshot("update"); + cy.get("#submit").click(); + cy.url().should( + "include", + "/manage/admin_unit/" + adminUnitId + "/members" + ); + cy.screenshot("list"); + }); + }); + }); + }); + + it("deletes", () => { + cy.login(); + cy.createAdminUnit().then(function (adminUnitId) { + cy.createUser("new@test.de").then(function () { + cy.createAdminUnitMember(adminUnitId, "new@test.de").then(function ( + memberId + ) { + cy.visit("/manage/member/" + memberId + "/delete"); + cy.get("#email").type("new@test.de"); + cy.screenshot("delete"); + cy.get("#submit").click(); + cy.url().should( + "include", + "/manage/admin_unit/" + adminUnitId + "/members" + ); + }); + }); + }); + }); +}); diff --git a/cypress/integration/admin_unit_member_invitation.js b/cypress/integration/admin_unit_member_invitation.js new file mode 100644 index 0000000..d79400e --- /dev/null +++ b/cypress/integration/admin_unit_member_invitation.js @@ -0,0 +1,49 @@ +describe("Admin Unit Member Invitation", () => { + it("creates", () => { + cy.login(); + cy.createAdminUnit().then(function (adminUnitId) { + cy.visit("/manage/admin_unit/" + adminUnitId + "/members/invite"); + cy.get("#email").type("new@test.de"); + cy.screenshot("create"); + cy.get("#submit").click(); + cy.url().should( + "include", + "/manage/admin_unit/" + adminUnitId + "/members" + ); + }); + }); + + it("deletes", () => { + cy.login(); + cy.createAdminUnit().then(function (adminUnitId) { + cy.createAdminUnitMemberInvitation(adminUnitId).then(function ( + invitationId + ) { + cy.visit("/manage/invitation/" + invitationId + "/delete"); + cy.get("#email").type("new@test.de"); + cy.screenshot("delete"); + cy.get("#submit").click(); + cy.url().should( + "include", + "/manage/admin_unit/" + adminUnitId + "/members" + ); + }); + }); + }); + + it("reads", () => { + cy.login(); + cy.createAdminUnit().then(function (adminUnitId) { + cy.createAdminUnitMemberInvitation(adminUnitId, "test@test.de").then( + function (invitationId) { + cy.visit("/invitations/" + invitationId); + cy.get("#accept").click(); + cy.url().should( + "include", + "/manage/admin_unit/" + adminUnitId + "/events" + ); + } + ); + }); + }); +}); diff --git a/cypress/integration/admin_unit_relation.js b/cypress/integration/admin_unit_relation.js new file mode 100644 index 0000000..4204b1d --- /dev/null +++ b/cypress/integration/admin_unit_relation.js @@ -0,0 +1,68 @@ +describe("Admin unit relations", () => { + it("list", () => { + cy.login(); + cy.createAdminUnit().then(function (adminUnitId) { + cy.createAdminUnit("test@test.de", "Other Crew").then(function ( + otherAdminUnitId + ) { + cy.visit("/manage/admin_unit/" + adminUnitId + "/relations"); + cy.screenshot("list"); + }); + }); + }); + + it("create", () => { + cy.login(); + cy.createAdminUnit().then(function (adminUnitId) { + cy.createAdminUnit("test@test.de", "Other Crew").then(function ( + otherAdminUnitId + ) { + cy.visit("/manage/admin_unit/" + adminUnitId + "/relations"); + cy.visit("/manage/admin_unit/" + adminUnitId + "/relations/create"); + + cy.get("#targetOrganization input").type("ot"); + cy.get(".vbt-autcomplete-list").click(); + cy.screenshot("create"); + cy.get("button[type=submit]").click(); + + cy.url().should( + "not.include", + "/create" + ); + }); + }); + }); + + it("updates", () => { + cy.login(); + cy.createAdminUnit().then(function (adminUnitId) { + cy.createAdminUnitRelation(adminUnitId).then(function (relationId) { + cy.visit("/manage/admin_unit/" + adminUnitId + "/relations"); + cy.visit("/manage/admin_unit/" + adminUnitId + "/relations/" + relationId + "/update"); + cy.screenshot("update"); + cy.get("button[type=submit]").click(); + cy.url().should( + "not.include", + "/update" + ); + }); + }); + }); + + it("deletes", () => { + cy.login(); + cy.createAdminUnit().then(function (adminUnitId) { + cy.createAdminUnitRelation(adminUnitId).then(function (relationId) { + cy.visit("/manage/admin_unit/" + adminUnitId + "/relations"); + + cy.get('.dropdown-toggle.btn-link').click(); + cy.get('.b-dropdown.show li:last').click(); + + cy.get('.dropdown-toggle.btn-link').should('not.exist'); + }); + }); + }); + + + +}); diff --git a/cypress/integration/event.js b/cypress/integration/event.js index a91ec84..8ad6794 100644 --- a/cypress/integration/event.js +++ b/cypress/integration/event.js @@ -69,10 +69,40 @@ describe("Event", () => { "contain", "Veranstaltung erfolgreich aktualisiert" ); + cy.screenshot("list"); cy.visit("/manage/admin_unit/" + adminUnitId + "/events"); cy.get('main .badge-pill').should('contain', 'Entwurf') }); }); + it("read and actions", () => { + cy.login(); + cy.createAdminUnit().then(function (adminUnitId) { + cy.createEvent(adminUnitId).then(function (eventId) { + cy.visit("/event/" + eventId); + cy.screenshot("read"); + + cy.visit("/event/" + eventId + "/actions"); + cy.screenshot("actions"); + }); + }); + }); + + it("deletes", () => { + cy.login(); + cy.createAdminUnit().then(function (adminUnitId) { + cy.createEvent(adminUnitId).then(function (eventId) { + cy.visit("/event/" + eventId + "/delete"); + cy.get("#name").type("Name"); + cy.screenshot("delete"); + cy.get("#submit").click(); + cy.url().should( + "include", + "/manage/admin_unit/" + adminUnitId + "/events" + ); + }); + }); + }); + }); diff --git a/cypress/integration/event_date.js b/cypress/integration/event_date.js new file mode 100644 index 0000000..547006e --- /dev/null +++ b/cypress/integration/event_date.js @@ -0,0 +1,19 @@ +describe("Event Date", () => { + it("list, search and read", () => { + cy.login(); + cy.createAdminUnit().then(function (adminUnitId) { + cy.createEvent(adminUnitId).then(function (eventId) { + cy.visit("/eventdatesearch"); + + cy.visit("/eventdates"); + cy.get("#toggle-search-btn").click(); + cy.screenshot("search-form"); + cy.screenshotDatepicker("#date_from-user"); + cy.get("#toggle-search-btn").click(); + + cy.get(".stretched-link").click(); + cy.screenshot("event-date"); + }); + }); + }); +}); diff --git a/cypress/integration/event_place.js b/cypress/integration/event_place.js new file mode 100644 index 0000000..df496d7 --- /dev/null +++ b/cypress/integration/event_place.js @@ -0,0 +1,47 @@ +describe("Event place", () => { + it("creates", () => { + cy.login(); + cy.createAdminUnit().then(function (adminUnitId) { + cy.visit("/manage/admin_unit/" + adminUnitId + "/places/create"); + cy.get("#name").type("Mein Platz"); + cy.screenshot("create"); + cy.get("#submit").click(); + cy.url().should( + "include", + "/manage/admin_unit/" + adminUnitId + "/event_places" + ); + cy.screenshot("list"); + }); + }); + + it("updates", () => { + cy.login(); + cy.createAdminUnit().then(function (adminUnitId) { + cy.createEventPlace(adminUnitId).then(function (eventPlaceId) { + cy.visit("/event_place/" + eventPlaceId + "/update"); + cy.screenshot("update"); + cy.get("#submit").click(); + cy.url().should( + "include", + "/manage/admin_unit/" + adminUnitId + "/event_places" + ); + }); + }); + }); + + it("deletes", () => { + cy.login(); + cy.createAdminUnit().then(function (adminUnitId) { + cy.createEventPlace(adminUnitId).then(function (eventPlaceId) { + cy.visit("/event_place/" + eventPlaceId + "/delete"); + cy.get("#name").type("Mein Platz"); + cy.screenshot("delete"); + cy.get("#submit").click(); + cy.url().should( + "include", + "/manage/admin_unit/" + adminUnitId + "/event_places" + ); + }); + }); + }); +}); diff --git a/cypress/integration/event_suggestion.js b/cypress/integration/event_suggestion.js new file mode 100644 index 0000000..12efef3 --- /dev/null +++ b/cypress/integration/event_suggestion.js @@ -0,0 +1,29 @@ +describe("Suggestion", () => { + it("reject", () => { + cy.login(); + cy.createAdminUnit().then(function (adminUnitId) { + cy.createSuggestion(adminUnitId).then(function (suggestionId) { + cy.visit("/event_suggestion/" + suggestionId + "/review_status"); + cy.screenshot("status"); + + cy.visit("/event_suggestion/" + suggestionId + "/review"); + cy.screenshot("review"); + + cy.get(".decision-container .btn-danger").click(); + cy.get("#rejectFormModal select[name=rejection_resaon]") + .select("Duplikat") + .should("have.value", "1"); + cy.get("#rejectFormModal").screenshot("reject"); + cy.get("#rejectFormModal .btn-danger").click(); + + cy.url().should("include", "/reviews"); + cy.get("div.alert").should( + "contain", + "Veranstaltungsvorschlag erfolgreich abgelehnt" + ); + cy.get("main .badge-pill").should("contain", "Abgelehnt"); + cy.screenshot("list"); + }); + }); + }); +}); diff --git a/cypress/integration/index.js b/cypress/integration/index.js deleted file mode 100644 index bb48c65..0000000 --- a/cypress/integration/index.js +++ /dev/null @@ -1,5 +0,0 @@ -describe('Homepage', () => { - it('starts', () => { - cy.visit('/') - }) - }) \ No newline at end of file diff --git a/cypress/integration/login.js b/cypress/integration/login.js deleted file mode 100644 index 4eb596c..0000000 --- a/cypress/integration/login.js +++ /dev/null @@ -1,28 +0,0 @@ -describe('Login', () => { - it('user log in', () => { - cy.visit('/login') - - // Blank - cy.get('#submit').click() - cy.assertRequired('email') - cy.assertRequired('password') - - // Email - cy.get('#email').type("invalidmail") - cy.assertInvalid('email', 'Geben Sie bitte eine gültige E-Mail-Adresse ein.') - - cy.get('#email').clear().type("test@test.de") - cy.assertValid('email') - - // Password - cy.get('#password').type("password") - cy.assertValid('password') - - // Submit - cy.get('#submit').click() - - cy.url().should('include', '/manage') - cy.get('h1').should('contain', 'Organisationen') - cy.getCookie('session').should('exist') - }) - }) \ No newline at end of file diff --git a/cypress/integration/manage.js b/cypress/integration/manage.js index 8346509..c372124 100644 --- a/cypress/integration/manage.js +++ b/cypress/integration/manage.js @@ -1,10 +1,20 @@ -describe('Manage', () => { - it('manage', () => { - cy.login() - cy.createAdminUnit().then(function(adminUnitId) { - cy.createEvent(adminUnitId).then(function(eventId) { - cy.visit('/manage/admin_unit/' + adminUnitId) - }) - }) - }) - }) \ No newline at end of file +describe("Manage", () => { + it("manage", () => { + cy.login(); + cy.createAdminUnit().then(function (adminUnitId) { + cy.createEvent(adminUnitId).then(function (eventId) { + cy.visit("/manage/admin_unit/" + adminUnitId); + cy.url().should( + "include", + "/manage/admin_unit/" + adminUnitId + "/events" + ); + cy.screenshot("events") + + cy.get("#toggle-search-btn").click(); + cy.screenshot("search-form"); + cy.screenshotDatepicker("#date_from-user"); + cy.get("#toggle-search-btn").click(); + }); + }); + }); +}); diff --git a/cypress/integration/oauth.js b/cypress/integration/oauth.js new file mode 100644 index 0000000..a348242 --- /dev/null +++ b/cypress/integration/oauth.js @@ -0,0 +1,5 @@ +describe("OAuth", () => { + it("authorizes", () => { + cy.authorize(true); + }); +}); diff --git a/cypress/integration/oauth2_client.js b/cypress/integration/oauth2_client.js new file mode 100644 index 0000000..a38bbd6 --- /dev/null +++ b/cypress/integration/oauth2_client.js @@ -0,0 +1,56 @@ +describe("OAuth2 Client", () => { + it("creates", () => { + cy.createUser("new@test.de", "password", true).then(function (userId) { + cy.createOauth2Client(userId).then(function (result) { + cy.login("new@test.de"); + + cy.visit("/oauth2_client/create"); + cy.get("#client_name").type("Mein Client"); + cy.get("#scope-0").check(); + cy.get("#redirect_uris").type("/oauth2-redirect.html"); + cy.screenshot("create"); + cy.get("#submit").click(); + }); + }); + }); + + it("updates", () => { + cy.createUser("new@test.de", "password", true).then(function (userId) { + cy.createOauth2Client(userId).then(function (result) { + cy.login("new@test.de"); + + cy.visit("/oauth2_client/" + result.oauth2_client_id + "/update"); + cy.screenshot("update"); + cy.get("#submit").click(); + }); + }); + }); + + it("deletes", () => { + cy.createUser("new@test.de", "password", true).then(function (userId) { + cy.createOauth2Client(userId).then(function (result) { + cy.login("new@test.de"); + + cy.visit("/oauth2_client/" + result.oauth2_client_id + "/delete"); + cy.get("#name").type("Mein Client"); + cy.screenshot("delete"); + cy.get("#submit").click(); + cy.url().should("include", "/oauth2_clients"); + }); + }); + }); + + it("lists and reads", () => { + cy.createUser("new@test.de", "password", true).then(function (userId) { + cy.createOauth2Client(userId).then(function (result) { + cy.login("new@test.de"); + + cy.visit("/oauth2_clients"); + cy.screenshot("list"); + + cy.visit("/oauth2_client/" + result.oauth2_client_id); + cy.screenshot("read"); + }); + }); + }); +}); diff --git a/cypress/integration/oauth2_token.js b/cypress/integration/oauth2_token.js new file mode 100644 index 0000000..7651708 --- /dev/null +++ b/cypress/integration/oauth2_token.js @@ -0,0 +1,14 @@ +describe("OAuth2 token", () => { + it("lists and revokes", () => { + cy.authorize().then(function () { + cy.visit("/oauth2_tokens"); + cy.screenshot("list"); + + cy.get("a[href$=revoke]").click(); + cy.screenshot("revoke"); + cy.get("#submit").click(); + + cy.url().should("include", "/oauth2_tokens"); + }); + }); +}); diff --git a/cypress/integration/organization.js b/cypress/integration/organization.js new file mode 100644 index 0000000..efb9715 --- /dev/null +++ b/cypress/integration/organization.js @@ -0,0 +1,10 @@ +describe("Organization", () => { + it("reads", () => { + cy.createAdminUnit().then(function (adminUnitId) { + cy.createEvent(adminUnitId).then(function (eventId) { + cy.visit("/organization/" + adminUnitId); + cy.screenshot("read"); + }); + }); + }); +}); diff --git a/cypress/integration/organizer.js b/cypress/integration/organizer.js new file mode 100644 index 0000000..71081eb --- /dev/null +++ b/cypress/integration/organizer.js @@ -0,0 +1,47 @@ +describe("Event organizer", () => { + it("creates", () => { + cy.login(); + cy.createAdminUnit().then(function (adminUnitId) { + cy.visit("/manage/admin_unit/" + adminUnitId + "/organizers/create"); + cy.get("#name").type("Mein Veranstalter"); + cy.screenshot("create"); + cy.get("#submit").click(); + cy.url().should( + "include", + "/manage/admin_unit/" + adminUnitId + "/organizers" + ); + cy.screenshot("list"); + }); + }); + + it("updates", () => { + cy.login(); + cy.createAdminUnit().then(function (adminUnitId) { + cy.createEventOrganizer(adminUnitId).then(function (eventOrganizerId) { + cy.visit("/organizer/" + eventOrganizerId + "/update"); + cy.screenshot("update"); + cy.get("#submit").click(); + cy.url().should( + "include", + "/manage/admin_unit/" + adminUnitId + "/organizers" + ); + }); + }); + }); + + it("deletes", () => { + cy.login(); + cy.createAdminUnit().then(function (adminUnitId) { + cy.createEventOrganizer(adminUnitId).then(function (eventOrganizerId) { + cy.visit("/organizer/" + eventOrganizerId + "/delete"); + cy.get("#name").type("Mein Veranstalter"); + cy.screenshot("delete"); + cy.get("#submit").click(); + cy.url().should( + "include", + "/manage/admin_unit/" + adminUnitId + "/organizers" + ); + }); + }); + }); +}); diff --git a/cypress/integration/planing.js b/cypress/integration/planing.js new file mode 100644 index 0000000..5b7d7e5 --- /dev/null +++ b/cypress/integration/planing.js @@ -0,0 +1,14 @@ +describe("Planing", () => { + it("search", () => { + cy.createAdminUnit().then(function (adminUnitId) { + cy.createEvent(adminUnitId).then(function (eventId) { + + cy.visit("/planing"); + cy.screenshot("search-form"); + cy.screenshotDatepicker("#date_from-user"); + cy.get('#submit').click(); + cy.screenshot("result"); + }); + }); + }); +}); diff --git a/cypress/integration/reference.js b/cypress/integration/reference.js new file mode 100644 index 0000000..f458b51 --- /dev/null +++ b/cypress/integration/reference.js @@ -0,0 +1,62 @@ +describe("Reference", () => { + it("reads and outgoing", () => { + cy.login(); + cy.createAdminUnit().then(function (adminUnitId) { + cy.createIncomingReference(adminUnitId).then(function (referenceId) { + cy.visit("/reference/" + referenceId); + cy.screenshot("read"); + + cy.visit("/manage/admin_unit/" + adminUnitId + "/references/outgoing"); + cy.screenshot("outgoing"); + }); + }); + }); + + it("creates", () => { + cy.login(); + cy.createAdminUnit().then(function (adminUnitId) { + cy.createAdminUnit("test@test.de", "Other Crew").then(function ( + otherAdminUnitId + ) { + cy.createEvent(otherAdminUnitId).then(function (eventId) { + cy.visit("/event/" + eventId + "/reference"); + cy.screenshot("create"); + cy.get("#submit").click(); + cy.url().should("not.include", "/reference"); + }); + }); + }); + }); + + it("updates", () => { + cy.login(); + cy.createAdminUnit().then(function (adminUnitId) { + cy.createIncomingReference(adminUnitId).then(function (referenceId) { + cy.visit("/reference/" + referenceId + "/update"); + cy.screenshot("update"); + cy.get("#submit").click(); + cy.url().should( + "include", + "/manage/admin_unit/" + adminUnitId + "/references/incoming" + ); + cy.screenshot("incoming"); + }); + }); + }); + + it("deletes", () => { + cy.login(); + cy.createAdminUnit().then(function (adminUnitId) { + cy.createIncomingReference(adminUnitId).then(function (referenceId) { + cy.visit("/reference/" + referenceId + "/delete"); + cy.get("#name").type("Name"); + cy.screenshot("delete"); + cy.get("#submit").click(); + cy.url().should( + "include", + "/manage/admin_unit/" + adminUnitId + "/references/incoming" + ); + }); + }); + }); +}); diff --git a/cypress/integration/reference_request.js b/cypress/integration/reference_request.js index f3e09bb..5b2b29d 100644 --- a/cypress/integration/reference_request.js +++ b/cypress/integration/reference_request.js @@ -1,27 +1,30 @@ -describe('Reference Request', () => { - it('reference request', () => { - cy.login() - cy.createAdminUnit().then(function(adminUnitId) { - cy.createIncomingReferenceRequest(adminUnitId).then(function(referenceRequestId) { +describe("Reference request", () => { + it("lists", () => { + cy.login(); + cy.createAdminUnit().then(function (adminUnitId) { + cy.createIncomingReferenceRequest(adminUnitId).then(function ( + referenceRequestId + ) { + cy.visit( + "/manage/admin_unit/" + adminUnitId + "/reference_requests/incoming" + ); + cy.screenshot("incoming"); + }); + }); + }); - // Reject - cy.visit('/reference_request/' + referenceRequestId + '/review') - cy.get('.decision-container .btn-danger').click() - cy.get('#rejectFormModal select[name=rejection_reason]').select('Nicht relevant').should('have.value', '4') - cy.get('#rejectFormModal .btn-danger').click() - cy.url().should('include', '/reference_requests/incoming') - cy.get('div.alert').should('contain', 'Empfehlungsanfrage erfolgreich aktualisiert') - cy.get('main .badge-pill').should('contain', 'Abgelehnt') - - // Accept - cy.visit('/reference_request/' + referenceRequestId + '/review') - cy.get('.decision-container .btn-success').click() - cy.get('#acceptFormModal select[name=rating]').select('6').should('have.value', '60') - cy.get("#auto_verify").parent().click(); - cy.get('#acceptFormModal .btn-success').click() - cy.url().should('include', '/reference_requests/incoming') - cy.get('div.alert').should('contain', 'Empfehlung erfolgreich erstellt') - }) - }) - }) - }) \ No newline at end of file + it("creates", () => { + cy.login(); + cy.createAdminUnit().then(function (adminUnitId) { + cy.createAdminUnit("test@test.de", "Other Crew").then(function (otherAdminUnitId) { + cy.createEvent(adminUnitId).then(function (eventId) { + cy.visit("/event/" + eventId + "/reference_request/create"); + cy.screenshot("create"); + cy.get("#submit").click(); + cy.url().should("include", "/reference_requests/outgoing"); + cy.screenshot("outgoing"); + }); + }); + }); + }); +}); diff --git a/cypress/integration/reference_request_review.js b/cypress/integration/reference_request_review.js new file mode 100644 index 0000000..b5da2d3 --- /dev/null +++ b/cypress/integration/reference_request_review.js @@ -0,0 +1,45 @@ +describe("Reference request review", () => { + it("reviews", () => { + cy.login(); + cy.createAdminUnit().then(function (adminUnitId) { + cy.createIncomingReferenceRequest(adminUnitId).then(function ( + referenceRequestId + ) { + // Status + cy.visit("/reference_request/" + referenceRequestId + "/review_status"); + cy.screenshot("status"); + + // Reject + cy.visit("/reference_request/" + referenceRequestId + "/review"); + cy.screenshot("review"); + cy.get(".decision-container .btn-danger").click(); + cy.get("#rejectFormModal select[name=rejection_reason]") + .select("Nicht relevant") + .should("have.value", "4"); + cy.get("#rejectFormModal").screenshot("reject"); + cy.get("#rejectFormModal .btn-danger").click(); + cy.url().should("include", "/reference_requests/incoming"); + cy.get("div.alert").should( + "contain", + "Empfehlungsanfrage erfolgreich aktualisiert" + ); + cy.get("main .badge-pill").should("contain", "Abgelehnt"); + + // Accept + cy.visit("/reference_request/" + referenceRequestId + "/review"); + cy.get(".decision-container .btn-success").click(); + cy.get("#acceptFormModal select[name=rating]") + .select("6") + .should("have.value", "60"); + cy.get("#auto_verify").parent().click(); + cy.get("#acceptFormModal").screenshot("accept"); + cy.get("#acceptFormModal .btn-success").click(); + cy.url().should("include", "/reference_requests/incoming"); + cy.get("div.alert").should( + "contain", + "Empfehlung erfolgreich erstellt" + ); + }); + }); + }); +}); diff --git a/cypress/integration/register.js b/cypress/integration/register.js deleted file mode 100644 index ea13710..0000000 --- a/cypress/integration/register.js +++ /dev/null @@ -1,43 +0,0 @@ -describe('Register', () => { - it('registers user', () => { - cy.visit('/register') - - // Blank - cy.get('#submit').click() - cy.assertRequired('email') - cy.assertRequired('password') - cy.assertRequired('password_confirm') - cy.assertRequired('accept_tos') - - // Email - cy.get('#email').type("invalidmail") - cy.assertInvalid('email', 'Geben Sie bitte eine gültige E-Mail-Adresse ein.') - - cy.get('#email').clear().type("test@test.de") - cy.assertInvalid('email', 'Mit dieser E-Mail existiert bereits ein Account.') - - cy.get('#email').clear().type("firstname.lastname@gmail.com") - cy.assertValid('email') - - // Password - cy.get('#password').type("short") - cy.assertInvalid('password', 'Geben Sie bitte mindestens 8 Zeichen ein.') - - cy.get('#password').clear().type("iloveoveda") - cy.assertValid('password') - - // Confirm password - cy.get('#password_confirm').type("different") - cy.assertInvalid('password_confirm', 'Wiederholen Sie bitte denselben Wert.') - - cy.get('#password_confirm').clear().type("iloveoveda") - cy.assertValid('password_confirm') - - // Submit - cy.get('#accept_tos').check() - cy.get('#submit').click() - - cy.url().should('eq', Cypress.config().baseUrl + '/') - cy.get('div.alert').should('contain', 'Bestätigungsanleitung') - }) - }) \ No newline at end of file diff --git a/cypress/integration/relations.js b/cypress/integration/relations.js deleted file mode 100644 index 4d9825a..0000000 --- a/cypress/integration/relations.js +++ /dev/null @@ -1,10 +0,0 @@ -describe('Relations', () => { - it('list', () => { - cy.login() - cy.createAdminUnit().then(function(adminUnitId) { - cy.createAdminUnit("test@test.de", "Other Crew").then(function(otherAdminUnitId) { - cy.visit('/manage/admin_unit/' + adminUnitId + "/relations") - }) - }) - }) - }) \ No newline at end of file diff --git a/cypress/integration/root.js b/cypress/integration/root.js new file mode 100644 index 0000000..298b79d --- /dev/null +++ b/cypress/integration/root.js @@ -0,0 +1,30 @@ +describe("Root", () => { + it("simple", () => { + cy.visit("/"); + cy.screenshot("home"); + + cy.visit("/tos"); + cy.screenshot("tos"); + + cy.visit("/legal_notice"); + cy.screenshot("legal_notice"); + + cy.visit("/contact"); + cy.screenshot("contact"); + + cy.visit("/privacy"); + cy.screenshot("privacy"); + + cy.visit("/developer"); + cy.screenshot("developer"); + }); + + it("example", () => { + cy.createAdminUnit("test@test.de", "Goslar").then(function (adminUnitId) { + cy.createEvent(adminUnitId).then(function (eventId) { + cy.visit("/example"); + cy.screenshot("example"); + }); + }); + }); +}); diff --git a/cypress/integration/user.js b/cypress/integration/user.js new file mode 100644 index 0000000..64be2d3 --- /dev/null +++ b/cypress/integration/user.js @@ -0,0 +1,88 @@ +describe("User", () => { + it("registers user", () => { + cy.visit("/register"); + cy.screenshot("register"); + + // Blank + cy.get("#submit").click(); + cy.assertRequired("email"); + cy.assertRequired("password"); + cy.assertRequired("password_confirm"); + cy.assertRequired("accept_tos"); + + // Email + cy.get("#email").type("invalidmail"); + cy.assertInvalid( + "email", + "Geben Sie bitte eine gültige E-Mail-Adresse ein." + ); + + cy.get("#email").clear().type("test@test.de"); + cy.assertInvalid( + "email", + "Mit dieser E-Mail existiert bereits ein Account." + ); + + cy.get("#email").clear().type("firstname.lastname@gmail.com"); + cy.assertValid("email"); + + // Password + cy.get("#password").type("short"); + cy.assertInvalid("password", "Geben Sie bitte mindestens 8 Zeichen ein."); + + cy.get("#password").clear().type("iloveoveda"); + cy.assertValid("password"); + + // Confirm password + cy.get("#password_confirm").type("different"); + cy.assertInvalid( + "password_confirm", + "Wiederholen Sie bitte denselben Wert." + ); + + cy.get("#password_confirm").clear().type("iloveoveda"); + cy.assertValid("password_confirm"); + + // Submit + cy.get("#accept_tos").check(); + cy.get("#submit").click(); + + cy.url().should("eq", Cypress.config().baseUrl + "/"); + cy.get("div.alert").should("contain", "Bestätigungsanleitung"); + }); + + it("login", () => { + cy.visit("/login"); + cy.screenshot("login"); + + // Blank + cy.get("#submit").click(); + cy.assertRequired("email"); + cy.assertRequired("password"); + + // Email + cy.get("#email").type("invalidmail"); + cy.assertInvalid( + "email", + "Geben Sie bitte eine gültige E-Mail-Adresse ein." + ); + + cy.get("#email").clear().type("test@test.de"); + cy.assertValid("email"); + + // Password + cy.get("#password").type("password"); + cy.assertValid("password"); + + // Submit + cy.get("#submit").click(); + + cy.url().should("include", "/manage"); + cy.get("h1").should("contain", "Organisationen"); + cy.getCookie("session").should("exist"); + + // Profile + cy.visit("/profile"); + cy.screenshot("profile"); + }); +}); diff --git a/cypress/integration/suggestion.js b/cypress/integration/widget.js similarity index 74% rename from cypress/integration/suggestion.js rename to cypress/integration/widget.js index 1a84355..acc03ab 100644 --- a/cypress/integration/suggestion.js +++ b/cypress/integration/widget.js @@ -1,4 +1,21 @@ -describe("Suggestion", () => { +describe("Widget", () => { + it("event dates", () => { + cy.createAdminUnit().then(function (adminUnitId) { + cy.createEvent(adminUnitId).then(function (eventId) { + cy.visit("/meinecrew/widget/eventdates"); + cy.screenshotDatepicker("#date_from-user"); + cy.screenshot("eventdates"); + + cy.get(".stretched-link") + .invoke("attr", "href") + .then((href) => { + cy.visit(href); + cy.screenshot("event-date"); + }); + }); + }); + }); + [ { recurrence: false, @@ -71,22 +88,4 @@ describe("Suggestion", () => { } ); }); - - it('reject', () => { - cy.login() - cy.createAdminUnit().then(function(adminUnitId) { - cy.createSuggestion(adminUnitId).then(function(suggestionId) { - - cy.visit('/event_suggestion/' + suggestionId + '/review') - cy.get('.decision-container .btn-danger').click() - cy.get('#rejectFormModal select[name=rejection_resaon]').select('Duplikat').should('have.value', '1') - cy.screenshot() - cy.get('#rejectFormModal .btn-danger').click() - cy.url().should('include', '/reviews') - cy.get('div.alert').should('contain', 'Veranstaltungsvorschlag erfolgreich abgelehnt') - cy.get('main .badge-pill').should('contain', 'Abgelehnt') - }) - }) - }) - }); diff --git a/cypress/plugins/index.js b/cypress/plugins/index.js index 59b2bab..2aa944c 100644 --- a/cypress/plugins/index.js +++ b/cypress/plugins/index.js @@ -11,12 +11,20 @@ // This function is called when a project is opened or re-opened (e.g. due to // the project's config changing) - +const { renameSync } = require("fs"); /** * @type {Cypress.PluginConfig} */ // eslint-disable-next-line no-unused-vars module.exports = (on, config) => { - // `on` is used to hook into various events Cypress emits - // `config` is the resolved Cypress config -} + on("after:screenshot", ({ path }) => { + renameSync( + path, + path + .replace(/ \(\d*\)/i, "") + .replace(".png", "-" + config.viewportWidth + ".png") + ); + }); + + return config; +}; diff --git a/cypress/support/commands.js b/cypress/support/commands.js index 2fab8f5..e94d02e 100644 --- a/cypress/support/commands.js +++ b/cypress/support/commands.js @@ -16,6 +16,20 @@ Cypress.Commands.add("setup", () => { cy.logexec("flask user create test@test.de password --confirm"); }); +Cypress.Commands.add( + "createUser", + (email = "test@test.de", password = "password", admin = false) => { + let cmd = 'flask user create "' + email + '" "' + password + '" --confirm'; + if (admin) { + cmd += " --admin"; + } + return cy.logexec(cmd).then(function (result) { + let json = JSON.parse(result.stdout); + return json.user_id; + }); + } +); + Cypress.Commands.add( "createAdminUnit", (userEmail = "test@test.de", name = "Meine Crew") => { @@ -28,6 +42,37 @@ Cypress.Commands.add( } ); +Cypress.Commands.add( + "createAdminUnitMemberInvitation", + (adminUnitId, userEmail = "new@test.de") => { + return cy + .logexec( + "flask test admin-unit-member-invitation-create " + + adminUnitId + + " " + + userEmail + ) + .then(function (result) { + let json = JSON.parse(result.stdout); + return json.invitation_id; + }); + } +); + +Cypress.Commands.add( + "createAdminUnitMember", + (adminUnitId, userEmail = "new@test.de") => { + return cy + .logexec( + "flask test admin-unit-member-create " + adminUnitId + " " + userEmail + ) + .then(function (result) { + let json = JSON.parse(result.stdout); + return json.member_id; + }); + } +); + Cypress.Commands.add("createEvent", (adminUnitId) => { return cy .logexec("flask test event-create " + adminUnitId) @@ -37,6 +82,38 @@ Cypress.Commands.add("createEvent", (adminUnitId) => { }); }); +Cypress.Commands.add("createEventPlace", (adminUnitId, name = "Mein Platz") => { + return cy + .logexec("flask test event-place-create " + adminUnitId + ' "' + name + '"') + .then(function (result) { + let json = JSON.parse(result.stdout); + return json.event_place_id; + }); +}); + +Cypress.Commands.add( + "createEventOrganizer", + (adminUnitId, name = "Mein Veranstalter") => { + return cy + .logexec( + "flask test event-organizer-create " + adminUnitId + ' "' + name + '"' + ) + .then(function (result) { + let json = JSON.parse(result.stdout); + return json.event_organizer_id; + }); + } +); + +Cypress.Commands.add("createOauth2Client", (userId) => { + return cy + .logexec("flask test oauth2-client-create " + userId) + .then(function (result) { + let json = JSON.parse(result.stdout); + return json; + }); +}); + Cypress.Commands.add("createIncomingReferenceRequest", (adminUnitId) => { return cy .logexec("flask test reference-request-create-incoming " + adminUnitId) @@ -46,6 +123,24 @@ Cypress.Commands.add("createIncomingReferenceRequest", (adminUnitId) => { }); }); +Cypress.Commands.add("createIncomingReference", (adminUnitId) => { + return cy + .logexec("flask test reference-create-incoming " + adminUnitId) + .then(function (result) { + let json = JSON.parse(result.stdout); + return json.reference_id; + }); +}); + +Cypress.Commands.add("createAdminUnitRelation", (adminUnitId) => { + return cy + .logexec("flask test admin-unit-relation-create " + adminUnitId) + .then(function (result) { + let json = JSON.parse(result.stdout); + return json.relation_id; + }); +}); + Cypress.Commands.add("createSuggestion", (adminUnitId) => { return cy .logexec("flask test suggestion-create " + adminUnitId) @@ -107,10 +202,10 @@ Cypress.Commands.add( Cypress.Commands.add("inputsShouldHaveSameValue", (input1, input2) => { cy.get(input1) - .invoke("val") - .then((value) => { - cy.get(input2).should("have.value", value); - }); + .invoke("val") + .then((value) => { + cy.get(input2).should("have.value", value); + }); }); Cypress.Commands.add( @@ -165,3 +260,54 @@ Cypress.Commands.add( } } ); + +Cypress.Commands.add( + "screenshotDatepicker", + (elementId, screenshotName = "datepicker") => { + cy.get(elementId).click(); + cy.get("#ui-datepicker-div").should("be.visible"); + cy.get(".ui-datepicker-next > .ui-icon").click(); + cy.screenshot(screenshotName); + } +); + +Cypress.Commands.add("authorize", (screenshot = false) => { + return cy.createUser("new@test.de", "password", true).then(function (userId) { + cy.createOauth2Client(userId).then(function (result) { + cy.login("new@test.de"); + cy.visit( + "/oauth/authorize?nonce=4711&response_type=code&client_id=" + + result.oauth2_client_client_id + + "&scope=" + + result.oauth2_client_scope + + "&redirect_uri=/" + ); + + if (screenshot) { + cy.screenshot("authorize"); + } + + cy.get("#allow").click(); + + cy.url().should("not.include", "authorize"); + cy.location().then((location) => { + const urlParams = new URLSearchParams(location.search); + const code = urlParams.get("code"); + + cy.request({ + method: "POST", + url: "/oauth/token", + form: true, + body: { + client_id: result.oauth2_client_client_id, + client_secret: result.oauth2_client_secret, + grant_type: "authorization_code", + scope: result.oauth2_client_scope, + code: code, + redirect_uri: "/", + }, + }); + }); + }); + }); +}); diff --git a/cypress/support/index.js b/cypress/support/index.js index 6d22e51..2b371bd 100644 --- a/cypress/support/index.js +++ b/cypress/support/index.js @@ -1,4 +1,7 @@ import "./commands"; +import failOnConsoleError from 'cypress-fail-on-console-error'; + +failOnConsoleError(); beforeEach(() => { cy.setup(); diff --git a/messages.pot b/messages.pot index 66796fc..43747e1 100644 --- a/messages.pot +++ b/messages.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PROJECT VERSION\n" "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" -"POT-Creation-Date: 2021-08-30 23:19+0200\n" +"POT-Creation-Date: 2021-09-02 10:13+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -158,6 +158,14 @@ msgid "Scope_event:write" msgstr "" #: project/i10n.py:48 +msgid "Scope_organization:read" +msgstr "" + +#: project/i10n.py:49 +msgid "Scope_organization:write" +msgstr "" + +#: project/i10n.py:50 msgid "There must be no self-reference." msgstr "" @@ -169,28 +177,28 @@ msgstr "" msgid "." msgstr "" -#: project/api/__init__.py:83 +#: project/api/__init__.py:84 msgid "message" msgstr "" -#: project/forms/admin.py:10 project/templates/layout.html:335 +#: project/forms/admin.py:10 project/templates/layout.html:307 #: project/views/root.py:42 msgid "Terms of service" msgstr "" -#: project/forms/admin.py:11 project/templates/layout.html:339 +#: project/forms/admin.py:11 project/templates/layout.html:311 #: project/views/root.py:50 msgid "Legal notice" msgstr "" #: project/forms/admin.py:12 project/templates/_macros.html:1356 -#: project/templates/layout.html:343 -#: project/templates/widget/event_suggestion/create.html:199 +#: project/templates/layout.html:315 +#: project/templates/widget/event_suggestion/create.html:204 #: project/views/admin_unit.py:36 project/views/root.py:58 msgid "Contact" msgstr "" -#: project/forms/admin.py:13 project/templates/layout.html:347 +#: project/forms/admin.py:13 project/templates/layout.html:319 #: project/views/root.py:66 msgid "Privacy" msgstr "" @@ -317,7 +325,8 @@ msgstr "" msgid "Logo" msgstr "" -#: project/forms/admin_unit.py:63 project/templates/admin_unit/create.html:13 +#: project/forms/admin_unit.py:63 project/templates/admin_unit/create.html:5 +#: project/templates/admin_unit/create.html:22 #: project/templates/manage/admin_units.html:18 msgid "Create organization" msgstr "" @@ -472,9 +481,9 @@ msgstr "" msgid "Indicate when the event will end. An event can last a maximum of 14 days." msgstr "" -#: project/forms/event.py:82 project/templates/event/create.html:244 -#: project/templates/event/update.html:135 -#: project/templates/widget/event_suggestion/create.html:234 +#: project/forms/event.py:82 project/templates/event/create.html:251 +#: project/templates/event/update.html:142 +#: project/templates/widget/event_suggestion/create.html:239 msgid "Recurring event" msgstr "" @@ -551,7 +560,7 @@ msgid "If the participants needs to register for the event." msgstr "" #: project/forms/event.py:137 project/templates/_macros.html:276 -#: project/templates/layout.html:159 +#: project/templates/layout.html:130 msgid "Booked up" msgstr "" @@ -607,11 +616,11 @@ msgstr "" msgid "EventAttendanceMode.offline" msgstr "" -#: project/forms/event.py:184 project/templates/layout.html:147 +#: project/forms/event.py:184 project/templates/layout.html:118 msgid "EventAttendanceMode.online" msgstr "" -#: project/forms/event.py:186 project/templates/layout.html:150 +#: project/forms/event.py:186 project/templates/layout.html:121 msgid "EventAttendanceMode.mixed" msgstr "" @@ -620,7 +629,7 @@ msgid "Choose how people can attend the event." msgstr "" #: project/forms/event.py:192 project/forms/event_place.py:27 -#: project/templates/widget/event_suggestion/create.html:252 +#: project/templates/widget/event_suggestion/create.html:257 msgid "Photo" msgstr "" @@ -657,8 +666,8 @@ msgstr "" #: project/forms/event.py:231 project/forms/reference.py:14 #: project/forms/reference.py:27 project/forms/reference_request.py:76 -#: project/templates/event/create.html:358 -#: project/templates/event/update.html:215 +#: project/templates/event/create.html:365 +#: project/templates/event/update.html:222 msgid "Rating" msgstr "" @@ -672,11 +681,11 @@ msgstr "" #: project/forms/event.py:243 project/forms/event.py:252 #: project/forms/event.py:321 project/forms/event_suggestion.py:50 #: project/templates/_macros.html:468 project/templates/_macros.html:624 -#: project/templates/event/create.html:283 -#: project/templates/event/update.html:165 -#: project/templates/event_place/create.html:22 +#: project/templates/event/create.html:290 +#: project/templates/event/update.html:172 +#: project/templates/event_place/create.html:31 #: project/templates/event_place/delete.html:13 -#: project/templates/event_place/update.html:22 +#: project/templates/event_place/update.html:31 msgid "Place" msgstr "" @@ -689,13 +698,13 @@ msgid "Enter new place" msgstr "" #: project/forms/event.py:259 project/forms/event.py:268 -#: project/forms/event.py:329 project/forms/event.py:389 +#: project/forms/event.py:329 project/forms/event.py:391 #: project/forms/event_suggestion.py:60 project/templates/_macros.html:506 -#: project/templates/_macros.html:661 project/templates/event/create.html:254 -#: project/templates/event/update.html:156 -#: project/templates/organizer/create.html:18 +#: project/templates/_macros.html:661 project/templates/event/create.html:261 +#: project/templates/event/update.html:163 +#: project/templates/organizer/create.html:27 #: project/templates/organizer/delete.html:13 -#: project/templates/organizer/update.html:18 +#: project/templates/organizer/update.html:27 msgid "Organizer" msgstr "" @@ -735,7 +744,7 @@ msgid "" "Organizers." msgstr "" -#: project/forms/event.py:338 project/templates/event/update.html:145 +#: project/forms/event.py:338 project/templates/event/update.html:152 #: project/templates/oauth2_token/list.html:21 msgid "Status" msgstr "" @@ -744,23 +753,23 @@ msgstr "" msgid "EventStatus.scheduled" msgstr "" -#: project/forms/event.py:342 project/templates/layout.html:113 -#: project/templates/layout.html:128 +#: project/forms/event.py:342 project/templates/layout.html:84 +#: project/templates/layout.html:99 msgid "EventStatus.cancelled" msgstr "" -#: project/forms/event.py:343 project/templates/layout.html:116 -#: project/templates/layout.html:131 +#: project/forms/event.py:343 project/templates/layout.html:87 +#: project/templates/layout.html:102 msgid "EventStatus.movedOnline" msgstr "" -#: project/forms/event.py:344 project/templates/layout.html:119 -#: project/templates/layout.html:134 +#: project/forms/event.py:344 project/templates/layout.html:90 +#: project/templates/layout.html:105 msgid "EventStatus.postponed" msgstr "" -#: project/forms/event.py:345 project/templates/layout.html:122 -#: project/templates/layout.html:137 +#: project/forms/event.py:345 project/templates/layout.html:93 +#: project/templates/layout.html:108 msgid "EventStatus.rescheduled" msgstr "" @@ -784,8 +793,8 @@ msgstr "" msgid "Select the public status of the event." msgstr "" -#: project/forms/event.py:360 project/templates/event/update.html:4 -#: project/templates/event/update.html:112 +#: project/forms/event.py:360 project/templates/event/update.html:5 +#: project/templates/event/update.html:119 msgid "Update event" msgstr "" @@ -800,52 +809,54 @@ msgstr "" msgid "From" msgstr "" -#: project/forms/event.py:383 project/forms/event_date.py:16 -#: project/forms/planing.py:15 +#: project/forms/event.py:384 project/forms/event_date.py:17 +#: project/forms/planing.py:16 msgid "to" msgstr "" -#: project/forms/event.py:384 project/forms/event_date.py:17 +#: project/forms/event.py:386 project/forms/event_date.py:19 msgid "Keyword" msgstr "" -#: project/forms/event.py:386 project/forms/event_date.py:19 -#: project/forms/planing.py:17 project/templates/_macros.html:392 +#: project/forms/event.py:388 project/forms/event_date.py:21 +#: project/forms/planing.py:19 project/templates/_macros.html:392 msgid "Category" msgstr "" -#: project/forms/event.py:392 +#: project/forms/event.py:394 msgid "Find events" msgstr "" -#: project/forms/event_date.py:22 project/forms/planing.py:20 +#: project/forms/event_date.py:24 project/forms/planing.py:22 #: project/templates/_macros.html:137 project/templates/_macros.html:326 -#: project/templates/admin_unit/create.html:29 -#: project/templates/admin_unit/update.html:30 -#: project/templates/event_place/create.html:31 -#: project/templates/event_place/update.html:31 -#: project/templates/organizer/create.html:27 -#: project/templates/organizer/update.html:27 +#: project/templates/admin_unit/create.html:38 +#: project/templates/admin_unit/update.html:39 +#: project/templates/event_place/create.html:40 +#: project/templates/event_place/update.html:40 +#: project/templates/organizer/create.html:36 +#: project/templates/organizer/update.html:36 msgid "Location" msgstr "" -#: project/forms/event_date.py:24 project/forms/planing.py:22 +#: project/forms/event_date.py:26 project/forms/planing.py:24 msgid "Distance" msgstr "" -#: project/forms/event_date.py:30 project/forms/planing.py:34 -#: project/templates/widget/event_date/list.html:53 +#: project/forms/event_date.py:32 project/forms/planing.py:36 +#: project/templates/widget/event_date/list.html:60 msgid "Find" msgstr "" -#: project/forms/event_place.py:41 project/templates/event_place/create.html:12 +#: project/forms/event_place.py:41 project/templates/event_place/create.html:5 +#: project/templates/event_place/create.html:21 #: project/templates/event_place/list.html:11 #: project/templates/manage/places.html:18 msgid "Create place" msgstr "" #: project/forms/event_place.py:45 project/templates/event_place/read.html:12 -#: project/templates/event_place/update.html:12 +#: project/templates/event_place/update.html:5 +#: project/templates/event_place/update.html:21 msgid "Update place" msgstr "" @@ -873,21 +884,21 @@ msgstr "" msgid "I would like to be notified by email after the review" msgstr "" -#: project/forms/event_suggestion.py:52 project/templates/event/create.html:288 +#: project/forms/event_suggestion.py:52 project/templates/event/create.html:295 msgid "" "Choose where the event takes place. If the venue is not yet in the list, " "just enter it." msgstr "" -#: project/forms/event_suggestion.py:62 project/templates/event/create.html:258 +#: project/forms/event_suggestion.py:62 project/templates/event/create.html:265 msgid "" "Select the organizer. If the organizer is not yet on the list, just enter" " it." msgstr "" #: project/forms/event_suggestion.py:78 -#: project/templates/widget/event_suggestion/create.html:4 -#: project/templates/widget/event_suggestion/create.html:152 +#: project/templates/widget/event_suggestion/create.html:5 +#: project/templates/widget/event_suggestion/create.html:157 msgid "Create event suggestion" msgstr "" @@ -942,11 +953,13 @@ msgid "Revoke OAuth2 token" msgstr "" #: project/forms/organizer.py:43 project/templates/manage/organizers.html:12 -#: project/templates/organizer/create.html:12 +#: project/templates/organizer/create.html:5 +#: project/templates/organizer/create.html:21 msgid "Create organizer" msgstr "" -#: project/forms/organizer.py:47 project/templates/organizer/update.html:12 +#: project/forms/organizer.py:47 project/templates/organizer/update.html:5 +#: project/templates/organizer/update.html:21 msgid "Update organizer" msgstr "" @@ -954,15 +967,15 @@ msgstr "" msgid "Delete organizer" msgstr "" -#: project/forms/planing.py:28 +#: project/forms/planing.py:30 msgid "Weekdays" msgstr "" #: project/forms/reference.py:11 project/forms/reference_request.py:16 #: project/templates/_macros.html:527 project/templates/_macros.html:687 -#: project/templates/admin_unit/create.html:19 -#: project/templates/admin_unit/update.html:20 -#: project/templates/layout.html:289 +#: project/templates/admin_unit/create.html:28 +#: project/templates/admin_unit/update.html:29 +#: project/templates/layout.html:260 msgid "Organization" msgstr "" @@ -1049,7 +1062,7 @@ msgstr "" msgid "Deny" msgstr "" -#: project/forms/widgets.py:137 +#: project/forms/widgets.py:154 msgid "This field is required." msgstr "" @@ -1096,11 +1109,11 @@ msgstr "" #: project/templates/_macros.html:408 project/templates/_macros.html:584 #: project/templates/event/actions.html:12 -#: project/templates/event/create.html:228 +#: project/templates/event/create.html:235 #: project/templates/event/delete.html:13 -#: project/templates/event/update.html:119 +#: project/templates/event/update.html:126 #: project/templates/reference/delete.html:13 -#: project/templates/widget/event_suggestion/create.html:224 +#: project/templates/widget/event_suggestion/create.html:229 msgid "Event" msgstr "" @@ -1131,8 +1144,8 @@ msgstr "" msgid "The event takes place both offline and online." msgstr "" -#: project/templates/_macros.html:711 project/templates/event_date/list.html:4 -#: project/templates/event_date/list.html:259 +#: project/templates/_macros.html:711 project/templates/event_date/list.html:5 +#: project/templates/event_date/list.html:278 #: project/templates/event_date/search.html:3 #: project/templates/reference_request/review.html:32 msgid "Event Dates" @@ -1143,13 +1156,13 @@ msgid "Search location on Google" msgstr "" #: project/templates/_macros.html:845 project/templates/_macros.html:847 -#: project/templates/event_date/list.html:280 -#: project/templates/widget/event_suggestion/create.html:188 -#: project/templates/widget/event_suggestion/create.html:213 -#: project/templates/widget/event_suggestion/create.html:241 -#: project/templates/widget/event_suggestion/create.html:264 -#: project/templates/widget/event_suggestion/create.html:297 -#: project/templates/widget/event_suggestion/create.html:326 +#: project/templates/event_date/list.html:299 +#: project/templates/widget/event_suggestion/create.html:193 +#: project/templates/widget/event_suggestion/create.html:218 +#: project/templates/widget/event_suggestion/create.html:246 +#: project/templates/widget/event_suggestion/create.html:269 +#: project/templates/widget/event_suggestion/create.html:302 +#: project/templates/widget/event_suggestion/create.html:331 msgid "Previous" msgstr "" @@ -1159,12 +1172,12 @@ msgid "Page %(page)d of %(pages)d (%(total)d total)" msgstr "" #: project/templates/_macros.html:851 project/templates/_macros.html:853 -#: project/templates/event_date/list.html:282 -#: project/templates/widget/event_suggestion/create.html:189 -#: project/templates/widget/event_suggestion/create.html:214 -#: project/templates/widget/event_suggestion/create.html:242 -#: project/templates/widget/event_suggestion/create.html:265 -#: project/templates/widget/event_suggestion/create.html:298 +#: project/templates/event_date/list.html:301 +#: project/templates/widget/event_suggestion/create.html:194 +#: project/templates/widget/event_suggestion/create.html:219 +#: project/templates/widget/event_suggestion/create.html:247 +#: project/templates/widget/event_suggestion/create.html:270 +#: project/templates/widget/event_suggestion/create.html:303 msgid "Next" msgstr "" @@ -1192,7 +1205,7 @@ msgstr "" msgid "Edit event" msgstr "" -#: project/templates/_macros.html:1201 project/templates/manage/events.html:30 +#: project/templates/_macros.html:1201 project/templates/manage/events.html:40 msgid "More" msgstr "" @@ -1242,31 +1255,31 @@ msgstr "" msgid "Register for free" msgstr "" -#: project/templates/event_place/read.html:22 project/templates/layout.html:206 -#: project/templates/layout.html:250 project/templates/manage/events.html:5 -#: project/templates/manage/events.html:9 +#: project/templates/event_place/read.html:22 project/templates/layout.html:177 +#: project/templates/layout.html:221 project/templates/manage/events.html:6 +#: project/templates/manage/events.html:19 msgid "Events" msgstr "" -#: project/templates/layout.html:207 +#: project/templates/layout.html:178 msgid "Planing" msgstr "" -#: project/templates/layout.html:208 +#: project/templates/layout.html:179 msgid "Example" msgstr "" #: project/templates/admin/admin.html:19 #: project/templates/admin/admin_units.html:4 #: project/templates/admin/admin_units.html:11 -#: project/templates/layout.html:217 +#: project/templates/layout.html:188 #: project/templates/manage/admin_units.html:3 #: project/templates/manage/admin_units.html:16 #: project/templates/profile.html:60 msgid "Organizations" msgstr "" -#: project/templates/layout.html:218 +#: project/templates/layout.html:189 #: project/templates/oauth2_client/list.html:10 #: project/templates/oauth2_client/read.html:10 #: project/templates/oauth2_token/list.html:10 project/templates/profile.html:4 @@ -1276,92 +1289,97 @@ msgstr "" #: project/templates/admin/admin.html:3 project/templates/admin/admin.html:9 #: project/templates/admin/admin_units.html:10 -#: project/templates/admin/users.html:10 project/templates/layout.html:221 +#: project/templates/admin/users.html:10 project/templates/layout.html:192 msgid "Admin" msgstr "" -#: project/templates/layout.html:225 +#: project/templates/layout.html:196 msgid "Logout" msgstr "" -#: project/templates/layout.html:256 +#: project/templates/layout.html:227 msgid "Show events" msgstr "" -#: project/templates/event/create.html:4 -#: project/templates/event/create.html:221 project/templates/layout.html:257 -#: project/templates/manage/events.html:12 +#: project/templates/event/create.html:5 +#: project/templates/event/create.html:228 project/templates/layout.html:228 +#: project/templates/manage/events.html:22 #: project/templates/manage/organizers.html:21 msgid "Create event" msgstr "" -#: project/templates/layout.html:260 +#: project/templates/layout.html:231 msgid "Review suggestions" msgstr "" -#: project/templates/layout.html:270 +#: project/templates/layout.html:241 #: project/templates/manage/references_incoming.html:5 #: project/templates/manage/references_outgoing.html:5 msgid "References" msgstr "" -#: project/templates/layout.html:276 +#: project/templates/layout.html:247 #: project/templates/manage/references_incoming.html:9 msgid "Incoming references" msgstr "" -#: project/templates/layout.html:277 +#: project/templates/layout.html:248 #: project/templates/manage/references_outgoing.html:9 msgid "Outgoing references" msgstr "" -#: project/templates/layout.html:279 +#: project/templates/layout.html:250 #: project/templates/manage/reference_requests_incoming.html:9 msgid "Incoming reference requests" msgstr "" -#: project/templates/layout.html:284 +#: project/templates/layout.html:255 #: project/templates/manage/reference_requests_outgoing.html:9 msgid "Outgoing reference requests" msgstr "" -#: project/templates/layout.html:292 project/templates/manage/organizers.html:5 +#: project/templates/layout.html:263 project/templates/manage/organizers.html:5 #: project/templates/manage/organizers.html:9 msgid "Organizers" msgstr "" #: project/templates/event_place/list.html:3 -#: project/templates/event_place/list.html:7 project/templates/layout.html:293 +#: project/templates/event_place/list.html:7 project/templates/layout.html:264 #: project/templates/manage/places.html:5 #: project/templates/manage/places.html:9 msgid "Places" msgstr "" -#: project/templates/layout.html:295 project/templates/manage/members.html:5 +#: project/templates/layout.html:266 project/templates/manage/members.html:5 #: project/templates/manage/members.html:28 msgid "Members" msgstr "" +#: project/templates/layout.html:267 project/templates/manage/relations.html:3 +msgid "Relations" +msgstr "" + #: project/templates/admin/admin.html:15 #: project/templates/admin/settings.html:4 #: project/templates/admin/settings.html:8 -#: project/templates/admin_unit/update.html:14 -#: project/templates/layout.html:296 project/templates/manage/widgets.html:12 +#: project/templates/admin_unit/update.html:6 +#: project/templates/admin_unit/update.html:23 +#: project/templates/layout.html:268 project/templates/manage/widgets.html:12 #: project/templates/profile.html:19 msgid "Settings" msgstr "" -#: project/templates/layout.html:297 project/templates/manage/reviews.html:10 +#: project/templates/layout.html:269 project/templates/manage/reviews.html:10 #: project/templates/manage/widgets.html:5 #: project/templates/manage/widgets.html:9 msgid "Widgets" msgstr "" -#: project/templates/layout.html:307 +#: project/templates/layout.html:279 msgid "Switch organization" msgstr "" -#: project/templates/developer/read.html:4 project/templates/layout.html:357 +#: project/templates/developer/read.html:4 project/templates/layout.html:329 #: project/templates/profile.html:29 msgid "Developer" msgstr "" @@ -1389,7 +1407,7 @@ msgstr "" #: project/templates/admin/admin_units.html:27 #: project/templates/admin/users.html:27 -#: project/templates/manage/events.html:27 +#: project/templates/manage/events.html:37 #: project/templates/manage/members.html:35 #: project/templates/manage/organizers.html:22 #: project/templates/manage/places.html:27 @@ -1399,14 +1417,14 @@ msgstr "" msgid "Edit" msgstr "" -#: project/templates/admin_unit/create.html:49 -#: project/templates/admin_unit/update.html:50 -#: project/templates/event/create.html:346 -#: project/templates/event/update.html:203 -#: project/templates/event_place/create.html:48 -#: project/templates/event_place/update.html:48 -#: project/templates/organizer/create.html:47 -#: project/templates/organizer/update.html:47 +#: project/templates/admin_unit/create.html:58 +#: project/templates/admin_unit/update.html:59 +#: project/templates/event/create.html:353 +#: project/templates/event/update.html:210 +#: project/templates/event_place/create.html:57 +#: project/templates/event_place/update.html:57 +#: project/templates/organizer/create.html:56 +#: project/templates/organizer/update.html:56 msgid "Additional information" msgstr "" @@ -1512,38 +1530,38 @@ msgstr "" msgid "List all events of %(admin_unit_name)s" msgstr "" -#: project/templates/event/create.html:90 -#: project/templates/event/update.html:76 -#: project/templates/widget/event_suggestion/create.html:99 +#: project/templates/event/create.html:97 +#: project/templates/event/update.html:83 +#: project/templates/widget/event_suggestion/create.html:104 msgid "Enter place or address" msgstr "" -#: project/templates/event/create.html:176 -#: project/templates/event/update.html:99 -#: project/templates/widget/event_suggestion/create.html:124 +#: project/templates/event/create.html:183 +#: project/templates/event/update.html:106 +#: project/templates/widget/event_suggestion/create.html:129 msgid "Enter organizer" msgstr "" -#: project/templates/event/create.html:238 -#: project/templates/event/update.html:129 +#: project/templates/event/create.html:245 +#: project/templates/event/update.html:136 msgid "Event date" msgstr "" -#: project/templates/event/create.html:275 +#: project/templates/event/create.html:282 msgid "Switch to organizer search" msgstr "" -#: project/templates/event/create.html:308 +#: project/templates/event/create.html:315 msgid "Switch to place search" msgstr "" -#: project/templates/event/create.html:319 -#: project/templates/event/update.html:176 +#: project/templates/event/create.html:326 +#: project/templates/event/update.html:183 msgid "Access" msgstr "" -#: project/templates/event/create.html:333 -#: project/templates/event/update.html:190 +#: project/templates/event/create.html:340 +#: project/templates/event/update.html:197 msgid "Target group" msgstr "" @@ -1601,13 +1619,13 @@ msgstr "" msgid "Member" msgstr "" -#: project/templates/manage/events.html:26 +#: project/templates/manage/events.html:36 #: project/templates/manage/references_incoming.html:19 #: project/templates/manage/references_outgoing.html:19 msgid "View" msgstr "" -#: project/templates/manage/events.html:28 +#: project/templates/manage/events.html:38 #: project/templates/manage/members.html:21 #: project/templates/manage/members.html:36 #: project/templates/manage/organizers.html:23 @@ -1617,7 +1635,7 @@ msgstr "" msgid "Delete" msgstr "" -#: project/templates/manage/events.html:29 +#: project/templates/manage/events.html:39 msgid "Duplicate" msgstr "" @@ -1643,10 +1661,6 @@ msgstr "" msgid "Show review status" msgstr "" -#: project/templates/manage/relations.html:3 -msgid "Relations" -msgstr "" - #: project/templates/manage/reviews.html:5 #: project/templates/manage/reviews.html:9 msgid "Reviews" @@ -1696,7 +1710,8 @@ msgstr "" msgid "Revoke" msgstr "" -#: project/templates/planing/list.html:4 project/templates/planing/list.html:94 +#: project/templates/planing/list.html:5 +#: project/templates/planing/list.html:105 msgid "Event Planing" msgstr "" @@ -1750,23 +1765,23 @@ msgstr "" msgid "You do not have an account yet? Not a problem!" msgstr "" -#: project/templates/widget/event_date/list.html:4 +#: project/templates/widget/event_date/list.html:5 msgid "Widget" msgstr "" -#: project/templates/widget/event_date/list.html:116 +#: project/templates/widget/event_date/list.html:123 msgid "Print" msgstr "" -#: project/templates/widget/event_suggestion/create.html:170 +#: project/templates/widget/event_suggestion/create.html:175 msgid "Continue as guest" msgstr "" -#: project/templates/widget/event_suggestion/create.html:275 +#: project/templates/widget/event_suggestion/create.html:280 msgid "Optional details" msgstr "" -#: project/templates/widget/event_suggestion/create.html:308 +#: project/templates/widget/event_suggestion/create.html:313 msgid "Preview" msgstr "" @@ -1832,27 +1847,27 @@ msgstr "" msgid "Invitation successfully deleted" msgstr "" -#: project/views/event.py:171 +#: project/views/event.py:172 msgid "Event successfully published" msgstr "" -#: project/views/event.py:173 +#: project/views/event.py:174 msgid "Draft successfully saved" msgstr "" -#: project/views/event.py:216 +#: project/views/event.py:217 msgid "Event successfully updated" msgstr "" -#: project/views/event.py:239 project/views/reference.py:162 +#: project/views/event.py:240 project/views/reference.py:162 msgid "Entered name does not match event name" msgstr "" -#: project/views/event.py:245 +#: project/views/event.py:246 msgid "Event successfully deleted" msgstr "" -#: project/views/event.py:392 +#: project/views/event.py:393 msgid "Referenced event changed" msgstr "" @@ -1979,22 +1994,22 @@ msgid "" "verified automatically." msgstr "" -#: project/views/utils.py:36 +#: project/views/utils.py:54 msgid "" "An entry with the entered values ​​already exists. Duplicate entries are " "not allowed." msgstr "" -#: project/views/utils.py:83 +#: project/views/utils.py:101 #, python-format msgid "Error in the %s field - %s" msgstr "" -#: project/views/utils.py:90 +#: project/views/utils.py:108 msgid "Show" msgstr "" -#: project/views/utils.py:97 +#: project/views/utils.py:115 msgid "You do not have permission for this action" msgstr "" diff --git a/package-lock.json b/package-lock.json index 84a92ce..b311077 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,7 +9,8 @@ "version": "1.0.0", "license": "ISC", "devDependencies": { - "cypress": "^8.3.1" + "cypress": "^8.3.1", + "cypress-fail-on-console-error": "^2.1.2" } }, "node_modules/@cypress/request": { @@ -61,6 +62,41 @@ "ms": "^2.1.1" } }, + "node_modules/@sinonjs/commons": { + "version": "1.8.3", + "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-1.8.3.tgz", + "integrity": "sha512-xkNcLAn/wZaX14RPlwizcKicDk9G3F8m2nU3L7Ukm5zBgTwiT0wsoFAHx9Jq56fJA1z/7uKGtCRu16sOUCLIHQ==", + "dev": true, + "dependencies": { + "type-detect": "4.0.8" + } + }, + "node_modules/@sinonjs/fake-timers": { + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/@sinonjs/fake-timers/-/fake-timers-7.1.2.tgz", + "integrity": "sha512-iQADsW4LBMISqZ6Ci1dupJL9pprqwcVFTcOsEmQOEhW+KLCVn/Y4Jrvg2k19fIHCp+iFprriYPTdRcQR8NbUPg==", + "dev": true, + "dependencies": { + "@sinonjs/commons": "^1.7.0" + } + }, + "node_modules/@sinonjs/samsam": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/@sinonjs/samsam/-/samsam-6.0.2.tgz", + "integrity": "sha512-jxPRPp9n93ci7b8hMfJOFDPRLFYadN6FSpeROFTR4UNF4i5b+EK6m4QXPO46BDhFgRy1JuS87zAnFOzCUwMJcQ==", + "dev": true, + "dependencies": { + "@sinonjs/commons": "^1.6.0", + "lodash.get": "^4.4.2", + "type-detect": "^4.0.8" + } + }, + "node_modules/@sinonjs/text-encoding": { + "version": "0.7.1", + "resolved": "https://registry.npmjs.org/@sinonjs/text-encoding/-/text-encoding-0.7.1.tgz", + "integrity": "sha512-+iTbntw2IZPb/anVDbypzfQa+ay64MW0Zo8aJ8gZPWMMK6/OubMVb6lUPMagqjOPnmtauXnFCACVl3O7ogjeqQ==", + "dev": true + }, "node_modules/@types/node": { "version": "14.17.6", "resolved": "https://registry.npmjs.org/@types/node/-/node-14.17.6.tgz", @@ -204,6 +240,15 @@ "node": ">=0.8" } }, + "node_modules/assertion-error": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.1.0.tgz", + "integrity": "sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==", + "dev": true, + "engines": { + "node": "*" + } + }, "node_modules/astral-regex": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/astral-regex/-/astral-regex-2.0.0.tgz", @@ -310,6 +355,23 @@ "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=", "dev": true }, + "node_modules/chai": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/chai/-/chai-4.3.4.tgz", + "integrity": "sha512-yS5H68VYOCtN1cjfwumDSuzn/9c+yza4f3reKXlE5rUg7SFcCEy90gJvydNgOYtblyf4Zi6jIWRnXOgErta0KA==", + "dev": true, + "dependencies": { + "assertion-error": "^1.1.0", + "check-error": "^1.0.2", + "deep-eql": "^3.0.1", + "get-func-name": "^2.0.0", + "pathval": "^1.1.1", + "type-detect": "^4.0.5" + }, + "engines": { + "node": ">=4" + } + }, "node_modules/chalk": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", @@ -338,6 +400,15 @@ "node": ">=8" } }, + "node_modules/check-error": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.2.tgz", + "integrity": "sha1-V00xLt2Iu13YkS6Sht1sCu1KrII=", + "dev": true, + "engines": { + "node": "*" + } + }, "node_modules/check-more-types": { "version": "2.24.0", "resolved": "https://registry.npmjs.org/check-more-types/-/check-more-types-2.24.0.tgz", @@ -552,6 +623,17 @@ "node": ">=12.0.0" } }, + "node_modules/cypress-fail-on-console-error": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/cypress-fail-on-console-error/-/cypress-fail-on-console-error-2.1.2.tgz", + "integrity": "sha512-bRmKTqvXLu6oZq/5jOgFarn7e7+O/Ic2XjlOPstOYpns8FLeVAnXAUcoUVeV8GW+fm//x38vq/voI5Ij4+TAbg==", + "dev": true, + "dependencies": { + "chai": "^4.3.4", + "sinon": "^11.1.2", + "sinon-chai": "^3.7.0" + } + }, "node_modules/dashdash": { "version": "1.14.1", "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", @@ -587,6 +669,18 @@ } } }, + "node_modules/deep-eql": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-3.0.1.tgz", + "integrity": "sha512-+QeIQyN5ZuO+3Uk5DYh6/1eKO0m0YmJFGNmFHGACpf1ClL1nmlV/p4gNgbl2pJGxgXb4faqo6UE+M5ACEMyVcw==", + "dev": true, + "dependencies": { + "type-detect": "^4.0.0" + }, + "engines": { + "node": ">=0.12" + } + }, "node_modules/delayed-stream": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", @@ -596,6 +690,15 @@ "node": ">=0.4.0" } }, + "node_modules/diff": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/diff/-/diff-5.0.0.tgz", + "integrity": "sha512-/VTCrvm5Z0JGty/BWHljh+BAiw3IK+2j87NGMu8Nwc/f48WoDAC395uomO9ZD117ZOBaHmkX1oyLvkVM/aIT3w==", + "dev": true, + "engines": { + "node": ">=0.3.1" + } + }, "node_modules/ecc-jsbn": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", @@ -798,6 +901,15 @@ "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", "dev": true }, + "node_modules/get-func-name": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.0.tgz", + "integrity": "sha1-6td0q+5y4gQJQzoGY2YCPdaIekE=", + "dev": true, + "engines": { + "node": "*" + } + }, "node_modules/get-stream": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz", @@ -1038,6 +1150,12 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/isarray": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", + "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=", + "dev": true + }, "node_modules/isexe": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", @@ -1101,6 +1219,12 @@ "verror": "1.10.0" } }, + "node_modules/just-extend": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/just-extend/-/just-extend-4.2.1.tgz", + "integrity": "sha512-g3UB796vUFIY90VIv/WX3L2c8CS2MdWUww3CNrYmqza1Fg0DURc2K/O4YrnklBdQarSJ/y8JnJYDGc+1iumQjg==", + "dev": true + }, "node_modules/lazy-ass": { "version": "1.6.0", "resolved": "https://registry.npmjs.org/lazy-ass/-/lazy-ass-1.6.0.tgz", @@ -1137,6 +1261,12 @@ "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", "dev": true }, + "node_modules/lodash.get": { + "version": "4.4.2", + "resolved": "https://registry.npmjs.org/lodash.get/-/lodash.get-4.4.2.tgz", + "integrity": "sha1-LRd/ZS+jHpObRDjVNBSZ36OCXpk=", + "dev": true + }, "node_modules/lodash.once": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/lodash.once/-/lodash.once-4.1.1.tgz", @@ -1268,6 +1398,19 @@ "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", "dev": true }, + "node_modules/nise": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/nise/-/nise-5.1.0.tgz", + "integrity": "sha512-W5WlHu+wvo3PaKLsJJkgPup2LrsXCcm7AWwyNZkUnn5rwPkuPBi3Iwk5SQtN0mv+K65k7nKKjwNQ30wg3wLAQQ==", + "dev": true, + "dependencies": { + "@sinonjs/commons": "^1.7.0", + "@sinonjs/fake-timers": "^7.0.4", + "@sinonjs/text-encoding": "^0.7.1", + "just-extend": "^4.0.2", + "path-to-regexp": "^1.7.0" + } + }, "node_modules/npm-run-path": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz", @@ -1352,6 +1495,24 @@ "node": ">=8" } }, + "node_modules/path-to-regexp": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-1.8.0.tgz", + "integrity": "sha512-n43JRhlUKUAlibEJhPeir1ncUID16QnEjNpwzNdO3Lm4ywrBpBZ5oLD0I6br9evr1Y9JTqwRtAh7JLoOzAQdVA==", + "dev": true, + "dependencies": { + "isarray": "0.0.1" + } + }, + "node_modules/pathval": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.1.tgz", + "integrity": "sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ==", + "dev": true, + "engines": { + "node": "*" + } + }, "node_modules/pend": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/pend/-/pend-1.2.0.tgz", @@ -1537,6 +1698,46 @@ "integrity": "sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA==", "dev": true }, + "node_modules/sinon": { + "version": "11.1.2", + "resolved": "https://registry.npmjs.org/sinon/-/sinon-11.1.2.tgz", + "integrity": "sha512-59237HChms4kg7/sXhiRcUzdSkKuydDeTiamT/jesUVHshBgL8XAmhgFo0GfK6RruMDM/iRSij1EybmMog9cJw==", + "dev": true, + "dependencies": { + "@sinonjs/commons": "^1.8.3", + "@sinonjs/fake-timers": "^7.1.2", + "@sinonjs/samsam": "^6.0.2", + "diff": "^5.0.0", + "nise": "^5.1.0", + "supports-color": "^7.2.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/sinon" + } + }, + "node_modules/sinon-chai": { + "version": "3.7.0", + "resolved": "https://registry.npmjs.org/sinon-chai/-/sinon-chai-3.7.0.tgz", + "integrity": "sha512-mf5NURdUaSdnatJx3uhoBOrY9dtL19fiOtAdT1Azxg3+lNJFiuN0uzaU3xX1LeAfL17kHQhTAJgpsfhbMJMY2g==", + "dev": true, + "peerDependencies": { + "chai": "^4.0.0", + "sinon": ">=4.0.0" + } + }, + "node_modules/sinon/node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/slice-ansi": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-3.0.0.tgz", @@ -1687,6 +1888,15 @@ "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=", "dev": true }, + "node_modules/type-detect": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", + "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==", + "dev": true, + "engines": { + "node": ">=4" + } + }, "node_modules/type-fest": { "version": "0.21.3", "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.21.3.tgz", @@ -1863,6 +2073,41 @@ } } }, + "@sinonjs/commons": { + "version": "1.8.3", + "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-1.8.3.tgz", + "integrity": "sha512-xkNcLAn/wZaX14RPlwizcKicDk9G3F8m2nU3L7Ukm5zBgTwiT0wsoFAHx9Jq56fJA1z/7uKGtCRu16sOUCLIHQ==", + "dev": true, + "requires": { + "type-detect": "4.0.8" + } + }, + "@sinonjs/fake-timers": { + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/@sinonjs/fake-timers/-/fake-timers-7.1.2.tgz", + "integrity": "sha512-iQADsW4LBMISqZ6Ci1dupJL9pprqwcVFTcOsEmQOEhW+KLCVn/Y4Jrvg2k19fIHCp+iFprriYPTdRcQR8NbUPg==", + "dev": true, + "requires": { + "@sinonjs/commons": "^1.7.0" + } + }, + "@sinonjs/samsam": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/@sinonjs/samsam/-/samsam-6.0.2.tgz", + "integrity": "sha512-jxPRPp9n93ci7b8hMfJOFDPRLFYadN6FSpeROFTR4UNF4i5b+EK6m4QXPO46BDhFgRy1JuS87zAnFOzCUwMJcQ==", + "dev": true, + "requires": { + "@sinonjs/commons": "^1.6.0", + "lodash.get": "^4.4.2", + "type-detect": "^4.0.8" + } + }, + "@sinonjs/text-encoding": { + "version": "0.7.1", + "resolved": "https://registry.npmjs.org/@sinonjs/text-encoding/-/text-encoding-0.7.1.tgz", + "integrity": "sha512-+iTbntw2IZPb/anVDbypzfQa+ay64MW0Zo8aJ8gZPWMMK6/OubMVb6lUPMagqjOPnmtauXnFCACVl3O7ogjeqQ==", + "dev": true + }, "@types/node": { "version": "14.17.6", "resolved": "https://registry.npmjs.org/@types/node/-/node-14.17.6.tgz", @@ -1964,6 +2209,12 @@ "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=", "dev": true }, + "assertion-error": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.1.0.tgz", + "integrity": "sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==", + "dev": true + }, "astral-regex": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/astral-regex/-/astral-regex-2.0.0.tgz", @@ -2055,6 +2306,20 @@ "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=", "dev": true }, + "chai": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/chai/-/chai-4.3.4.tgz", + "integrity": "sha512-yS5H68VYOCtN1cjfwumDSuzn/9c+yza4f3reKXlE5rUg7SFcCEy90gJvydNgOYtblyf4Zi6jIWRnXOgErta0KA==", + "dev": true, + "requires": { + "assertion-error": "^1.1.0", + "check-error": "^1.0.2", + "deep-eql": "^3.0.1", + "get-func-name": "^2.0.0", + "pathval": "^1.1.1", + "type-detect": "^4.0.5" + } + }, "chalk": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", @@ -2076,6 +2341,12 @@ } } }, + "check-error": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.2.tgz", + "integrity": "sha1-V00xLt2Iu13YkS6Sht1sCu1KrII=", + "dev": true + }, "check-more-types": { "version": "2.24.0", "resolved": "https://registry.npmjs.org/check-more-types/-/check-more-types-2.24.0.tgz", @@ -2245,6 +2516,17 @@ "yauzl": "^2.10.0" } }, + "cypress-fail-on-console-error": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/cypress-fail-on-console-error/-/cypress-fail-on-console-error-2.1.2.tgz", + "integrity": "sha512-bRmKTqvXLu6oZq/5jOgFarn7e7+O/Ic2XjlOPstOYpns8FLeVAnXAUcoUVeV8GW+fm//x38vq/voI5Ij4+TAbg==", + "dev": true, + "requires": { + "chai": "^4.3.4", + "sinon": "^11.1.2", + "sinon-chai": "^3.7.0" + } + }, "dashdash": { "version": "1.14.1", "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", @@ -2269,12 +2551,27 @@ "ms": "2.1.2" } }, + "deep-eql": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-3.0.1.tgz", + "integrity": "sha512-+QeIQyN5ZuO+3Uk5DYh6/1eKO0m0YmJFGNmFHGACpf1ClL1nmlV/p4gNgbl2pJGxgXb4faqo6UE+M5ACEMyVcw==", + "dev": true, + "requires": { + "type-detect": "^4.0.0" + } + }, "delayed-stream": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=", "dev": true }, + "diff": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/diff/-/diff-5.0.0.tgz", + "integrity": "sha512-/VTCrvm5Z0JGty/BWHljh+BAiw3IK+2j87NGMu8Nwc/f48WoDAC395uomO9ZD117ZOBaHmkX1oyLvkVM/aIT3w==", + "dev": true + }, "ecc-jsbn": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", @@ -2436,6 +2733,12 @@ "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", "dev": true }, + "get-func-name": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.0.tgz", + "integrity": "sha1-6td0q+5y4gQJQzoGY2YCPdaIekE=", + "dev": true + }, "get-stream": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz", @@ -2608,6 +2911,12 @@ "integrity": "sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==", "dev": true }, + "isarray": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", + "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=", + "dev": true + }, "isexe": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", @@ -2666,6 +2975,12 @@ "verror": "1.10.0" } }, + "just-extend": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/just-extend/-/just-extend-4.2.1.tgz", + "integrity": "sha512-g3UB796vUFIY90VIv/WX3L2c8CS2MdWUww3CNrYmqza1Fg0DURc2K/O4YrnklBdQarSJ/y8JnJYDGc+1iumQjg==", + "dev": true + }, "lazy-ass": { "version": "1.6.0", "resolved": "https://registry.npmjs.org/lazy-ass/-/lazy-ass-1.6.0.tgz", @@ -2693,6 +3008,12 @@ "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", "dev": true }, + "lodash.get": { + "version": "4.4.2", + "resolved": "https://registry.npmjs.org/lodash.get/-/lodash.get-4.4.2.tgz", + "integrity": "sha1-LRd/ZS+jHpObRDjVNBSZ36OCXpk=", + "dev": true + }, "lodash.once": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/lodash.once/-/lodash.once-4.1.1.tgz", @@ -2793,6 +3114,19 @@ "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", "dev": true }, + "nise": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/nise/-/nise-5.1.0.tgz", + "integrity": "sha512-W5WlHu+wvo3PaKLsJJkgPup2LrsXCcm7AWwyNZkUnn5rwPkuPBi3Iwk5SQtN0mv+K65k7nKKjwNQ30wg3wLAQQ==", + "dev": true, + "requires": { + "@sinonjs/commons": "^1.7.0", + "@sinonjs/fake-timers": "^7.0.4", + "@sinonjs/text-encoding": "^0.7.1", + "just-extend": "^4.0.2", + "path-to-regexp": "^1.7.0" + } + }, "npm-run-path": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz", @@ -2853,6 +3187,21 @@ "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", "dev": true }, + "path-to-regexp": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-1.8.0.tgz", + "integrity": "sha512-n43JRhlUKUAlibEJhPeir1ncUID16QnEjNpwzNdO3Lm4ywrBpBZ5oLD0I6br9evr1Y9JTqwRtAh7JLoOzAQdVA==", + "dev": true, + "requires": { + "isarray": "0.0.1" + } + }, + "pathval": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.1.tgz", + "integrity": "sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ==", + "dev": true + }, "pend": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/pend/-/pend-1.2.0.tgz", @@ -2987,6 +3336,38 @@ "integrity": "sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA==", "dev": true }, + "sinon": { + "version": "11.1.2", + "resolved": "https://registry.npmjs.org/sinon/-/sinon-11.1.2.tgz", + "integrity": "sha512-59237HChms4kg7/sXhiRcUzdSkKuydDeTiamT/jesUVHshBgL8XAmhgFo0GfK6RruMDM/iRSij1EybmMog9cJw==", + "dev": true, + "requires": { + "@sinonjs/commons": "^1.8.3", + "@sinonjs/fake-timers": "^7.1.2", + "@sinonjs/samsam": "^6.0.2", + "diff": "^5.0.0", + "nise": "^5.1.0", + "supports-color": "^7.2.0" + }, + "dependencies": { + "supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + } + } + }, + "sinon-chai": { + "version": "3.7.0", + "resolved": "https://registry.npmjs.org/sinon-chai/-/sinon-chai-3.7.0.tgz", + "integrity": "sha512-mf5NURdUaSdnatJx3uhoBOrY9dtL19fiOtAdT1Azxg3+lNJFiuN0uzaU3xX1LeAfL17kHQhTAJgpsfhbMJMY2g==", + "dev": true, + "requires": {} + }, "slice-ansi": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-3.0.0.tgz", @@ -3102,6 +3483,12 @@ "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=", "dev": true }, + "type-detect": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", + "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==", + "dev": true + }, "type-fest": { "version": "0.21.3", "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.21.3.tgz", diff --git a/package.json b/package.json index 17c4d9b..34f85d8 100644 --- a/package.json +++ b/package.json @@ -22,6 +22,7 @@ }, "homepage": "https://github.com/DanielGrams/gsevpt#readme", "devDependencies": { - "cypress": "^8.3.1" + "cypress": "^8.3.1", + "cypress-fail-on-console-error": "^2.1.2" } } diff --git a/project/cli/test.py b/project/cli/test.py index eda5e09..d934d4c 100644 --- a/project/cli/test.py +++ b/project/cli/test.py @@ -6,21 +6,31 @@ from flask_security.confirmable import confirm_user from sqlalchemy import MetaData from project import app, db +from project.api import scope_list from project.init_data import create_initial_data from project.models import ( AdminUnit, Event, EventAttendanceMode, + EventReference, EventReferenceRequest, EventReferenceRequestReviewStatus, EventSuggestion, Location, + OAuth2Client, +) +from project.services.admin_unit import ( + add_user_to_admin_unit_with_roles, + get_admin_unit_by_id, + insert_admin_unit_for_user, + insert_admin_unit_member_invitation, + upsert_admin_unit_relation, ) -from project.services.admin_unit import get_admin_unit_by_id, insert_admin_unit_for_user from project.services.event import insert_event, upsert_event_category from project.services.event_suggestion import insert_event_suggestion -from project.services.organizer import get_event_organizer -from project.services.place import get_event_places +from project.services.oauth2_client import complete_oauth2_client +from project.services.organizer import get_event_organizer, upsert_event_organizer +from project.services.place import get_event_places, upsert_event_place from project.services.user import create_user, find_user_by_email, get_user test_cli = AppGroup("test") @@ -124,6 +134,27 @@ def create_admin_unit(user_email, name): click.echo(json.dumps(result)) +@test_cli.command("admin-unit-member-invitation-create") +@click.argument("admin_unit_id") +@click.argument("email") +def create_admin_unit_member_invitation(admin_unit_id, email): + invitation = insert_admin_unit_member_invitation(admin_unit_id, email, []) + result = {"invitation_id": invitation.id} + click.echo(json.dumps(result)) + + +@test_cli.command("admin-unit-member-create") +@click.argument("admin_unit_id") +@click.argument("user_email") +def create_admin_unit_member(admin_unit_id, user_email): + user = find_user_by_email(user_email) + admin_unit = get_admin_unit_by_id(admin_unit_id) + member = add_user_to_admin_unit_with_roles(user, admin_unit, []) + db.session.commit() + result = {"member_id": member.id} + click.echo(json.dumps(result)) + + def _create_event(admin_unit_id): event = Event() event.admin_unit_id = admin_unit_id @@ -151,6 +182,59 @@ def create_event(admin_unit_id): click.echo(json.dumps(result)) +@test_cli.command("event-place-create") +@click.argument("admin_unit_id") +@click.argument("name") +def create_event_place(admin_unit_id, name): + event_place = upsert_event_place(admin_unit_id, name) + db.session.commit() + result = {"event_place_id": event_place.id} + click.echo(json.dumps(result)) + + +@test_cli.command("event-organizer-create") +@click.argument("admin_unit_id") +@click.argument("name") +def create_event_organizer(admin_unit_id, name): + event_organizer = upsert_event_organizer(admin_unit_id, name) + db.session.commit() + result = {"event_organizer_id": event_organizer.id} + click.echo(json.dumps(result)) + + +def _insert_default_oauth2_client(user_id): + client = OAuth2Client() + client.user_id = user_id + complete_oauth2_client(client) + + metadata = dict() + metadata["client_name"] = "Mein Client" + metadata["scope"] = " ".join(scope_list) + metadata["grant_types"] = ["authorization_code", "refresh_token"] + metadata["response_types"] = ["code"] + metadata["token_endpoint_auth_method"] = "client_secret_post" + metadata["redirect_uris"] = ["/"] + client.set_client_metadata(metadata) + + db.session.add(client) + db.session.commit() + + return client + + +@test_cli.command("oauth2-client-create") +@click.argument("user_id") +def create_oauth2_client(user_id): + oauth2_client = _insert_default_oauth2_client(user_id) + result = { + "oauth2_client_id": oauth2_client.id, + "oauth2_client_client_id": oauth2_client.client_id, + "oauth2_client_secret": oauth2_client.client_secret, + "oauth2_client_scope": oauth2_client.scope, + } + click.echo(json.dumps(result)) + + def _create_reference_request(event_id, admin_unit_id): reference_request = EventReferenceRequest() reference_request.event_id = event_id @@ -196,6 +280,75 @@ def create_incoming_reference_request(admin_unit_id): click.echo(json.dumps(result)) +def _create_reference(event_id, admin_unit_id): + reference = EventReference() + reference.event_id = event_id + reference.admin_unit_id = admin_unit_id + db.session.add(reference) + db.session.commit() + return reference.id + + +def _create_incoming_reference(admin_unit_id): + other_user_id = _create_user("other@test.de") + other_admin_unit_id = _create_admin_unit(other_user_id, "Other Crew") + event_id = _create_event(other_admin_unit_id) + reference_id = _create_reference(event_id, admin_unit_id) + return (other_user_id, other_admin_unit_id, event_id, reference_id) + + +@test_cli.command("reference-create-incoming") +@click.argument("admin_unit_id") +def create_incoming_request(admin_unit_id): + ( + other_user_id, + other_admin_unit_id, + event_id, + reference_id, + ) = _create_incoming_reference(admin_unit_id) + result = { + "other_user_id": other_user_id, + "other_admin_unit_id": other_admin_unit_id, + "event_id": event_id, + "reference_id": reference_id, + } + click.echo(json.dumps(result)) + + +def _create_admin_unit_relation( + admin_unit_id, + target_admin_unit_id, + auto_verify_event_reference_requests=False, +): + relation = upsert_admin_unit_relation(admin_unit_id, target_admin_unit_id) + relation.auto_verify_event_reference_requests = auto_verify_event_reference_requests + db.session.commit() + return relation.id + + +def _create_any_admin_unit_relation(admin_unit_id): + other_user_id = _create_user("other@test.de") + other_admin_unit_id = _create_admin_unit(other_user_id, "Other Crew") + relation_id = _create_admin_unit_relation(admin_unit_id, other_admin_unit_id) + return (other_user_id, other_admin_unit_id, relation_id) + + +@test_cli.command("admin-unit-relation-create") +@click.argument("admin_unit_id") +def create_admin_unit_relation(admin_unit_id): + ( + other_user_id, + other_admin_unit_id, + relation_id, + ) = _create_any_admin_unit_relation(admin_unit_id) + result = { + "other_user_id": other_user_id, + "other_admin_unit_id": other_admin_unit_id, + "relation_id": relation_id, + } + click.echo(json.dumps(result)) + + def _create_event_suggestion(admin_unit_id, free_text=False): suggestion = EventSuggestion() suggestion.admin_unit_id = admin_unit_id diff --git a/project/cli/user.py b/project/cli/user.py index 0ced9fe..9f8a046 100644 --- a/project/cli/user.py +++ b/project/cli/user.py @@ -1,3 +1,5 @@ +import json + import click from flask.cli import AppGroup from flask_security.confirmable import confirm_user @@ -24,14 +26,19 @@ def add_admin_roles(email): @click.argument("email") @click.argument("password") @click.option("--confirm/--no-confirm", default=False) -def create(email, password, confirm): +@click.option("--admin/--no-admin", default=False) +def create(email, password, confirm, admin): user = create_user(email, password) if confirm: confirm_user(user) + if admin: + add_admin_roles_to_user(email) + db.session.commit() - click.echo(f"Created user {email}.") + result = {"user_id": user.id} + click.echo(json.dumps(result)) @user_cli.command("confirm") diff --git a/project/i10n.py b/project/i10n.py index 69bf8a4..f868ccf 100644 --- a/project/i10n.py +++ b/project/i10n.py @@ -45,4 +45,6 @@ def print_dynamic_texts(): gettext("Scope_organizer:write") gettext("Scope_place:write") gettext("Scope_event:write") + gettext("Scope_organization:read") + gettext("Scope_organization:write") gettext("There must be no self-reference.") diff --git a/project/static/jquery.recurrenceinput.js b/project/static/jquery.recurrenceinput.js index 66d8a9a..d77f525 100644 --- a/project/static/jquery.recurrenceinput.js +++ b/project/static/jquery.recurrenceinput.js @@ -1875,3 +1875,131 @@ }; }(jQuery)); + +jQuery.tools.recurrenceinput.localize("de", { + displayUnactivate: "Keine Wiederholungen", + displayActivate: "Alle ", + edit_rules: "Bearbeiten...", + add_rules: "Hinzufügen...", + delete_rules: "Löschen", + add: "Hinzufügen", + refresh: "Aktualisieren", + title: "Regelmäßige Veranstaltung", + preview: "Ausgewählte Termine", + addDate: "Termin hinzufügen", + recurrenceType: "Wiederholt sich", + dailyInterval1: "Wiederholt sich alle", + dailyInterval2: "Tage", + weeklyInterval1: "Wiederholt sich alle", + weeklyInterval2: "Woche(n)", + weeklyWeekdays: "Wiederholt sich alle", + weeklyWeekdaysHuman: "am: ", + monthlyInterval1: "Wiederholt sich alle", + monthlyInterval2: "Monat(e)", + monthlyDayOfMonth1: "Tag", + monthlyDayOfMonth1Human: "am Tag", + monthlyDayOfMonth2: "des Monats", + monthlyDayOfMonth3: "Monat(e)", + monthlyDayOfMonth4: "monthly_day_of_month_4", + monthlyWeekdayOfMonth1: "Den", + monthlyWeekdayOfMonth1Human: "am", + monthlyWeekdayOfMonth2: " ", + monthlyWeekdayOfMonth3: "im Monat", + monthlyRepeatOn: "Wiederholt sich", + yearlyInterval1: "Wiederholt sich alle", + yearlyInterval2: "Jahr(e)", + yearlyDayOfMonth1: "Jeden", + yearlyDayOfMonth1Human: "am", + yearlyDayOfMonth2: " ", + yearlyDayOfMonth3: " ", + yearlyWeekdayOfMonth1: "Jeden", + yearlyWeekdayOfMonth1Human: "am", + yearlyWeekdayOfMonth2: " ", + yearlyWeekdayOfMonth3: "im", + yearlyWeekdayOfMonth4: " ", + yearlyRepeatOn: "Wiederholt sich", + range: "Ende der Wiederholung", + rangeNoEnd: "Niemals", + rangeByOccurrences1: "Endet nach", + rangeByOccurrences1Human: "endet nach", + rangeByOccurrences2: "Ereigniss(en)", + rangeByEndDate: "Bis ", + rangeByEndDateHuman: "endet am ", + including: ", und auch ", + except: ", ausser für", + cancel: "Abbrechen", + save: "Speichern", + recurrenceStart: "Beginn der Wiederholung", + additionalDate: "Weitere Termine", + include: "Eingeschlossen", + exclude: "Ausgenommen", + remove: "Entfernen", + orderIndexes: ["ersten", "zweiten", "dritten", "vierten", "letzten"], + months: [ + "Januar", + "Februar", + "März", + "April", + "Mai", + "Juni", + "Juli", + "August", + "September", + "Oktober", + "November", + "Dezember", + ], + shortMonths: [ + "Jan", + "Feb", + "Mär", + "Apr", + "Mai", + "Jun", + "Jul", + "Aug", + "Sep", + "Okt", + "Nov", + "Dez", + ], + weekdays: [ + "Sonntag", + "Montag", + "Dienstag", + "Mittwoch", + "Donnerstag", + "Freitag", + "Samstag", + ], + shortWeekdays: ["Son", "Mon", "Die", "Mit", "Don", "Fre", "Sam"], + longDateFormat: "D, dd.mm.yy", + shortDateFormat: "dd.mm.yy", + unsupportedFeatures: + "Warning: This event uses recurrence features not supported by this widget. Saving the recurrence may change the recurrence in unintended ways: ", + noTemplateMatch: "No matching recurrence template", + multipleDayOfMonth: + "Dieses Widget unterstützt keine mehrfach angelegten Tage in monatlicher oder jährlicher Wiederholung", + bysetpos: "BYSETPOS wird nicht unterstützt", + noRule: "Keine RRULE in RRULE Daten", + noRepeatEvery: 'Error: The "Repeat every"-field must be between 1 and 1000', + noEndDate: + "Fehler: Das Terminende ist nicht gesetzt. Bitte geben Sie einen korrekten Wert ein.", + noRepeatOn: 'Error: "Repeat on"-value must be selected', + pastEndDate: "Fehler: Das Terminende kann nicht vor dem Terminanfang sein.", + noEndAfterNOccurrences: + 'Error: The "After N occurrences"-field must be between 1 and 1000', + alreadyAdded: "Das Datum wurde bereits hinzugefügt", + rtemplate: { + daily: "Täglich", + mondayfriday: "Montags und Freitags", + weekdays: "Wochentags", + weekly: "Wöchentlich", + monthly: "Monatlich", + yearly: "Jährlich", + }, + + reccStart: "Startdatum", + reccStartTime: "Beginn", + reccFoEndTime: "Ende", + }); \ No newline at end of file diff --git a/project/static/site.js b/project/static/site.js index deca6df..291f05c 100644 --- a/project/static/site.js +++ b/project/static/site.js @@ -1,133 +1,4 @@ moment.locale("de"); -$.datepicker.setDefaults($.datepicker.regional["de"]); - -jQuery.tools.recurrenceinput.localize("de", { - displayUnactivate: "Keine Wiederholungen", - displayActivate: "Alle ", - edit_rules: "Bearbeiten...", - add_rules: "Hinzufügen...", - delete_rules: "Löschen", - add: "Hinzufügen", - refresh: "Aktualisieren", - title: "Regelmäßige Veranstaltung", - preview: "Ausgewählte Termine", - addDate: "Termin hinzufügen", - recurrenceType: "Wiederholt sich", - dailyInterval1: "Wiederholt sich alle", - dailyInterval2: "Tage", - weeklyInterval1: "Wiederholt sich alle", - weeklyInterval2: "Woche(n)", - weeklyWeekdays: "Wiederholt sich alle", - weeklyWeekdaysHuman: "am: ", - monthlyInterval1: "Wiederholt sich alle", - monthlyInterval2: "Monat(e)", - monthlyDayOfMonth1: "Tag", - monthlyDayOfMonth1Human: "am Tag", - monthlyDayOfMonth2: "des Monats", - monthlyDayOfMonth3: "Monat(e)", - monthlyDayOfMonth4: "monthly_day_of_month_4", - monthlyWeekdayOfMonth1: "Den", - monthlyWeekdayOfMonth1Human: "am", - monthlyWeekdayOfMonth2: " ", - monthlyWeekdayOfMonth3: "im Monat", - monthlyRepeatOn: "Wiederholt sich", - yearlyInterval1: "Wiederholt sich alle", - yearlyInterval2: "Jahr(e)", - yearlyDayOfMonth1: "Jeden", - yearlyDayOfMonth1Human: "am", - yearlyDayOfMonth2: " ", - yearlyDayOfMonth3: " ", - yearlyWeekdayOfMonth1: "Jeden", - yearlyWeekdayOfMonth1Human: "am", - yearlyWeekdayOfMonth2: " ", - yearlyWeekdayOfMonth3: "im", - yearlyWeekdayOfMonth4: " ", - yearlyRepeatOn: "Wiederholt sich", - range: "Ende der Wiederholung", - rangeNoEnd: "Niemals", - rangeByOccurrences1: "Endet nach", - rangeByOccurrences1Human: "endet nach", - rangeByOccurrences2: "Ereigniss(en)", - rangeByEndDate: "Bis ", - rangeByEndDateHuman: "endet am ", - including: ", und auch ", - except: ", ausser für", - cancel: "Abbrechen", - save: "Speichern", - recurrenceStart: "Beginn der Wiederholung", - additionalDate: "Weitere Termine", - include: "Eingeschlossen", - exclude: "Ausgenommen", - remove: "Entfernen", - orderIndexes: ["ersten", "zweiten", "dritten", "vierten", "letzten"], - months: [ - "Januar", - "Februar", - "März", - "April", - "Mai", - "Juni", - "Juli", - "August", - "September", - "Oktober", - "November", - "Dezember", - ], - shortMonths: [ - "Jan", - "Feb", - "Mär", - "Apr", - "Mai", - "Jun", - "Jul", - "Aug", - "Sep", - "Okt", - "Nov", - "Dez", - ], - weekdays: [ - "Sonntag", - "Montag", - "Dienstag", - "Mittwoch", - "Donnerstag", - "Freitag", - "Samstag", - ], - shortWeekdays: ["Son", "Mon", "Die", "Mit", "Don", "Fre", "Sam"], - longDateFormat: "D, dd.mm.yy", - shortDateFormat: "dd.mm.yy", - unsupportedFeatures: - "Warning: This event uses recurrence features not supported by this widget. Saving the recurrence may change the recurrence in unintended ways: ", - noTemplateMatch: "No matching recurrence template", - multipleDayOfMonth: - "Dieses Widget unterstützt keine mehrfach angelegten Tage in monatlicher oder jährlicher Wiederholung", - bysetpos: "BYSETPOS wird nicht unterstützt", - noRule: "Keine RRULE in RRULE Daten", - noRepeatEvery: 'Error: The "Repeat every"-field must be between 1 and 1000', - noEndDate: - "Fehler: Das Terminende ist nicht gesetzt. Bitte geben Sie einen korrekten Wert ein.", - noRepeatOn: 'Error: "Repeat on"-value must be selected', - pastEndDate: "Fehler: Das Terminende kann nicht vor dem Terminanfang sein.", - noEndAfterNOccurrences: - 'Error: The "After N occurrences"-field must be between 1 and 1000', - alreadyAdded: "Das Datum wurde bereits hinzugefügt", - rtemplate: { - daily: "Täglich", - mondayfriday: "Montags und Freitags", - weekdays: "Wochentags", - weekly: "Wöchentlich", - monthly: "Monatlich", - yearly: "Jährlich", - }, - - reccStart: "Startdatum", - reccStartTime: "Beginn", - reccFoEndTime: "Ende", -}); function get_moment_with_time(field_id) { var date_time_string = $(field_id).val(); @@ -408,15 +279,6 @@ function scroll_to_element(element, complete) { $(function () { $('[data-toggle="tooltip"]').tooltip(); - $.fn.select2.defaults.set("language", "de"); - $(".autocomplete").select2({ - width: "100%", - theme: "bootstrap4", - }); - $(".autocomplete-multi").select2({ - width: "100%", - }); - $(".datepicker").each(function (index, element) { start_datepicker($(element)); }); diff --git a/project/static/vue/organization-relations/create.vue.js b/project/static/vue/organization-relations/create.vue.js index 8f58418..0bb765a 100644 --- a/project/static/vue/organization-relations/create.vue.js +++ b/project/static/vue/organization-relations/create.vue.js @@ -5,6 +5,7 @@ const OrganizationRelationCreate = { - - + + + {% endmacro %} {% macro render_event_suggestion(event_suggestion, hide_review_status=False) %} @@ -1483,7 +1483,7 @@ $('#end-container').on('hidden', function() { {% endmacro %} -{% macro render_admin_unit_form_script(admin_unit_id=None) %} +{% macro render_admin_unit_form_script(admin_unit=None) %} {% endmacro %} + +{% macro render_form_scripts() %} + + + + + + +{% endmacro %} + +{% macro render_manage_form_scripts() %} +{{ render_form_scripts() }} + + +{% endmacro %} + +{% macro render_form_styles() %} + + + + +{% endmacro %} + +{% macro render_manage_form_styles() %} +{{ render_form_styles() }} + +{% endmacro %} + + diff --git a/project/templates/admin_unit/create.html b/project/templates/admin_unit/create.html index 847d8dd..ba255f9 100644 --- a/project/templates/admin_unit/create.html +++ b/project/templates/admin_unit/create.html @@ -1,7 +1,16 @@ {% extends "layout.html" %} -{% from "_macros.html" import render_admin_unit_form_script, render_jquery_steps_header, render_cropper_logo_block, render_crop_image_form_section, render_google_place_autocomplete_header, render_google_place_autocomplete_field, render_field_with_errors, render_field %} +{% from "_macros.html" import render_manage_form_styles, render_manage_form_scripts, render_admin_unit_form_script, render_jquery_steps_header, render_cropper_logo_block, render_crop_image_form_section, render_google_place_autocomplete_header, render_google_place_autocomplete_field, render_field_with_errors, render_field %} + +{%- block title -%} +{{ _('Create organization') }} +{%- endblock -%} + +{% block styles %} +{{ render_manage_form_styles() }} +{% endblock %} {% block header %} +{{ render_manage_form_scripts() }} {{ render_jquery_steps_header() }} {{ render_google_place_autocomplete_header() }} {{ render_cropper_logo_block() }} diff --git a/project/templates/admin_unit/update.html b/project/templates/admin_unit/update.html index 50a8614..65f9bac 100644 --- a/project/templates/admin_unit/update.html +++ b/project/templates/admin_unit/update.html @@ -1,12 +1,21 @@ {% extends "layout.html" %} {% set active_id = "settings" %} -{% from "_macros.html" import render_admin_unit_form_script, render_jquery_steps_header, render_cropper_logo_block, render_crop_image_form_section, render_google_place_autocomplete_header, render_google_place_autocomplete_field, render_field_with_errors, render_field %} +{% from "_macros.html" import render_manage_form_styles, render_manage_form_scripts, render_admin_unit_form_script, render_jquery_steps_header, render_cropper_logo_block, render_crop_image_form_section, render_google_place_autocomplete_header, render_google_place_autocomplete_field, render_field_with_errors, render_field %} + +{%- block title -%} +{{ _('Settings') }} +{%- endblock -%} + +{% block styles %} +{{ render_manage_form_styles() }} +{% endblock %} {% block header %} +{{ render_manage_form_scripts() }} {{ render_jquery_steps_header() }} {{ render_google_place_autocomplete_header() }} {{ render_cropper_logo_block() }} -{{ render_admin_unit_form_script(admin_unit.id) }} +{{ render_admin_unit_form_script(admin_unit) }} {% endblock %} {% block content %} diff --git a/project/templates/event/create.html b/project/templates/event/create.html index cb95696..9b73586 100644 --- a/project/templates/event/create.html +++ b/project/templates/event/create.html @@ -1,9 +1,16 @@ {% extends "layout.html" %} -{% from "_macros.html" import render_cropper_header, render_end_container_handling, render_jquery_steps_header, render_cropper_header, render_cropper_code, render_crop_image_form_section, render_radio_buttons, render_field_with_errors, render_field %} +{% from "_macros.html" import render_manage_form_styles, render_manage_form_scripts, render_cropper_header, render_end_container_handling, render_jquery_steps_header, render_cropper_header, render_cropper_code, render_crop_image_form_section, render_radio_buttons, render_field_with_errors, render_field %} + {%- block title -%} {{ _('Create event') }} {%- endblock -%} + +{% block styles %} +{{ render_manage_form_styles() }} +{% endblock %} + {% block header_before_site_js %} +{{ render_manage_form_scripts() }} {{ render_jquery_steps_header() }} {{ render_cropper_header() }} + + +{%- endblock -%} + {% block header %} + {{ render_jquery_steps_header() }} {{ render_google_filter_autocomplete_header() }} {% endblock %} + {% block content %}

{{ _('Event Dates') }} - - + +