From 69b335393125745aa51e67ee769ec5d311ef2838 Mon Sep 17 00:00:00 2001 From: Ramon Wenger Date: Wed, 28 Apr 2021 00:40:10 +0200 Subject: [PATCH] Add new client elements for snapshots --- .../integration/frontend/snapshots.spec.js | 8 ++ client/src/App.vue | 4 +- .../components/modules/ModuleNavigation.vue | 7 +- .../components/modules/SnapshotCreated.vue | 91 +++++++++++++++++ .../components/modules/SnapshotListItem.vue | 28 ++++++ .../src/components/modules/SnapshotMenu.vue | 99 +++++++++++++++++++ client/src/graphql/gql/moduleSnapshots.gql | 14 +++ .../graphql/gql/mutations/createSnapshot.gql | 9 ++ client/src/graphql/gql/snapshotsQuery.gql | 13 +++ client/src/pages/snapshot/snapshots.vue | 73 ++++++++++++++ client/src/router/module.names.js | 1 + client/src/router/module.routes.js | 11 ++- 12 files changed, 352 insertions(+), 6 deletions(-) create mode 100644 client/cypress/integration/frontend/snapshots.spec.js create mode 100644 client/src/components/modules/SnapshotCreated.vue create mode 100644 client/src/components/modules/SnapshotListItem.vue create mode 100644 client/src/components/modules/SnapshotMenu.vue create mode 100644 client/src/graphql/gql/moduleSnapshots.gql create mode 100644 client/src/graphql/gql/mutations/createSnapshot.gql create mode 100644 client/src/graphql/gql/snapshotsQuery.gql create mode 100644 client/src/pages/snapshot/snapshots.vue diff --git a/client/cypress/integration/frontend/snapshots.spec.js b/client/cypress/integration/frontend/snapshots.spec.js new file mode 100644 index 00000000..e9bb461c --- /dev/null +++ b/client/cypress/integration/frontend/snapshots.spec.js @@ -0,0 +1,8 @@ +describe('Snapshot', () => { + it('Menu is visible for teacher', () => { + cy.get('NotImplemented'); + }); + it('Menu is not visible for student', () => { + cy.get('NotImplemented'); + }); +}); diff --git a/client/src/App.vue b/client/src/App.vue index 2680ec21..0f4623c9 100644 --- a/client/src/App.vue +++ b/client/src/App.vue @@ -36,6 +36,7 @@ import FullscreenInfographic from '@/components/FullscreenInfographic'; import FullscreenVideo from '@/components/FullscreenVideo'; import DeactivatePerson from '@/components/profile/DeactivatePerson'; + import SnapshotCreated from '@/components/modules/SnapshotCreated'; import {mapGetters} from 'vuex'; import ScrollUp from '@/components/ScrollUp'; @@ -64,7 +65,8 @@ FullscreenImage, FullscreenInfographic, FullscreenVideo, - DeactivatePerson + DeactivatePerson, + SnapshotCreated }, computed: { diff --git a/client/src/components/modules/ModuleNavigation.vue b/client/src/components/modules/ModuleNavigation.vue index a7961669..c1dbae30 100644 --- a/client/src/components/modules/ModuleNavigation.vue +++ b/client/src/components/modules/ModuleNavigation.vue @@ -44,10 +44,7 @@ class="module-navigation__toggle-menu" v-if="canManageContent" > - - - - + + +
+

Ein neuer Snapshot wurde erstellt

+
+
+
+ {{ snapshot.title }} + 30.11.2020 - 17:31 - Simone Gerber +
+
+
+ Alle Snapshots anzeigen + Zurück zum Modul +
+
+ + + + + diff --git a/client/src/components/modules/SnapshotListItem.vue b/client/src/components/modules/SnapshotListItem.vue new file mode 100644 index 00000000..8a9c1317 --- /dev/null +++ b/client/src/components/modules/SnapshotListItem.vue @@ -0,0 +1,28 @@ + + + + + diff --git a/client/src/components/modules/SnapshotMenu.vue b/client/src/components/modules/SnapshotMenu.vue new file mode 100644 index 00000000..a75081fa --- /dev/null +++ b/client/src/components/modules/SnapshotMenu.vue @@ -0,0 +1,99 @@ + + + + + diff --git a/client/src/graphql/gql/moduleSnapshots.gql b/client/src/graphql/gql/moduleSnapshots.gql new file mode 100644 index 00000000..0646f5fe --- /dev/null +++ b/client/src/graphql/gql/moduleSnapshots.gql @@ -0,0 +1,14 @@ +query ModuleSnapshotsQuery($slug: String!) { + module(slug: $slug) { + id + title + metaTitle + topic { + title + } + snapshots { + id + title + } + } +} diff --git a/client/src/graphql/gql/mutations/createSnapshot.gql b/client/src/graphql/gql/mutations/createSnapshot.gql new file mode 100644 index 00000000..0d64b711 --- /dev/null +++ b/client/src/graphql/gql/mutations/createSnapshot.gql @@ -0,0 +1,9 @@ +mutation CreateSnapshot($input: CreateSnapshotInput!) { + createSnapshot(input: $input) { + snapshot { + id + title + } + success + } +} diff --git a/client/src/graphql/gql/snapshotsQuery.gql b/client/src/graphql/gql/snapshotsQuery.gql new file mode 100644 index 00000000..e0e9b5c0 --- /dev/null +++ b/client/src/graphql/gql/snapshotsQuery.gql @@ -0,0 +1,13 @@ +query SnapshotsQuery($slug: String!) { + snapshot(slug: $slug) { + id + module { + id + title + metaTitle + topic { + title + } + } + } +} diff --git a/client/src/pages/snapshot/snapshots.vue b/client/src/pages/snapshot/snapshots.vue new file mode 100644 index 00000000..1b57936b --- /dev/null +++ b/client/src/pages/snapshot/snapshots.vue @@ -0,0 +1,73 @@ + + + + + diff --git a/client/src/router/module.names.js b/client/src/router/module.names.js index 793e0b65..dd1b8a8a 100644 --- a/client/src/router/module.names.js +++ b/client/src/router/module.names.js @@ -2,3 +2,4 @@ export const SUBMISSIONS_PAGE = 'submissions'; export const MODULE_PAGE = 'module'; export const MODULE_SETTINGS_PAGE = 'module-settings'; export const VISIBILITY_PAGE = 'visibility'; +export const SNAPSHOT_LIST = 'snapshot-list'; diff --git a/client/src/router/module.routes.js b/client/src/router/module.routes.js index 1f0ac4bd..dabf5214 100644 --- a/client/src/router/module.routes.js +++ b/client/src/router/module.routes.js @@ -2,8 +2,9 @@ import moduleBase from '@/pages/module/module-base'; import module from '@/pages/module/module'; import submissions from '@/pages/submissions'; import moduleVisibility from '@/pages/module/moduleVisibility'; -import {MODULE_PAGE, MODULE_SETTINGS_PAGE, SUBMISSIONS_PAGE, VISIBILITY_PAGE} from '@/router/module.names'; +import {MODULE_PAGE, MODULE_SETTINGS_PAGE, SUBMISSIONS_PAGE, VISIBILITY_PAGE, SNAPSHOT_LIST} from '@/router/module.names'; import settingsPage from '@/pages/module/moduleSettings'; +import snapshots from '@/pages/snapshot/snapshots'; export default [ { @@ -42,6 +43,14 @@ export default [ hideNavigation: true, }, }, + { + path: 'snapshots', + component: snapshots, + name: SNAPSHOT_LIST, + meta: { + showSubNavigation: true, + }, + }, ], }, ];