From 12f3b2d9a7b19cbbbc3bd1a6cfc173bfe311b1fa Mon Sep 17 00:00:00 2001 From: Ramon Wenger Date: Mon, 10 Feb 2020 09:27:43 +0100 Subject: [PATCH 001/102] Simplify the logic of visible content blocks for students --- client/cypress/integration/bookmarks.spec.js | 1 - .../src/components/ClassSelectionWidget.vue | 10 ++-- server/books/schema/queries.py | 46 +++++-------------- server/objectives/schema.py | 16 +++---- 4 files changed, 23 insertions(+), 50 deletions(-) diff --git a/client/cypress/integration/bookmarks.spec.js b/client/cypress/integration/bookmarks.spec.js index 3ac32dae..0677c4d6 100644 --- a/client/cypress/integration/bookmarks.spec.js +++ b/client/cypress/integration/bookmarks.spec.js @@ -27,7 +27,6 @@ describe('Survey', () => { cy.get('@interviewContent').within(() => { cy.get('.bookmark-actions__edit-note').click(); - }); cy.get('[data-cy=bookmark-note]').within(() => { diff --git a/client/src/components/ClassSelectionWidget.vue b/client/src/components/ClassSelectionWidget.vue index 214d345a..999afbfd 100644 --- a/client/src/components/ClassSelectionWidget.vue +++ b/client/src/components/ClassSelectionWidget.vue @@ -1,5 +1,5 @@ @@ -89,9 +93,11 @@ order: 3; border-bottom: 0; } + &:nth-child(2) { order: 1; } + &:nth-child(3) { order: 2; } From 4173fe70ab20f22cf77608888da3617534891e59 Mon Sep 17 00:00:00 2001 From: Ramon Wenger Date: Tue, 24 Mar 2020 16:16:13 +0100 Subject: [PATCH 088/102] Add confirmation modal when deactivating users in school class --- client/src/App.vue | 4 +- .../components/profile/DeactivatePerson.vue | 118 ++++++++++++++++++ client/src/pages/myClass.vue | 11 +- client/src/store/index.js | 37 +++++- 4 files changed, 165 insertions(+), 5 deletions(-) create mode 100644 client/src/components/profile/DeactivatePerson.vue diff --git a/client/src/App.vue b/client/src/App.vue index 210e0254..3d27aa5b 100644 --- a/client/src/App.vue +++ b/client/src/App.vue @@ -27,6 +27,7 @@ import FullscreenImage from '@/components/FullscreenImage'; import FullscreenInfographic from '@/components/FullscreenInfographic'; import FullscreenVideo from '@/components/FullscreenVideo'; + import DeactivatePerson from '@/components/profile/DeactivatePerson'; import {mapGetters} from 'vuex'; @@ -53,7 +54,8 @@ EditClassNameWizard, FullscreenImage, FullscreenInfographic, - FullscreenVideo + FullscreenVideo, + DeactivatePerson }, computed: { diff --git a/client/src/components/profile/DeactivatePerson.vue b/client/src/components/profile/DeactivatePerson.vue new file mode 100644 index 00000000..756ea2a6 --- /dev/null +++ b/client/src/components/profile/DeactivatePerson.vue @@ -0,0 +1,118 @@ + + + + + diff --git a/client/src/pages/myClass.vue b/client/src/pages/myClass.vue index 7cf4b50e..688d2891 100644 --- a/client/src/pages/myClass.vue +++ b/client/src/pages/myClass.vue @@ -61,7 +61,16 @@ this.changeMember(member, true); }, remove(member) { - this.changeMember(member, false); + this.$store.dispatch('deactivateUser', [ + member.id === this.me.id, // myself + `${member.firstName} ${member.lastName}`, // full name + this.me.selectedClass.name // class name + ]) + .then(() => { + this.changeMember(member, false); + }) + .catch(() => { + }); } }, } diff --git a/client/src/store/index.js b/client/src/store/index.js index 42328442..8cd14dd3 100644 --- a/client/src/store/index.js +++ b/client/src/store/index.js @@ -1,7 +1,7 @@ import Vue from 'vue' import Vuex from 'vuex' -Vue.use(Vuex) +Vue.use(Vuex); // WARNING fixme todo: please do not use this anymore, use the local GraphQL cache export default new Vuex.Store({ @@ -33,7 +33,10 @@ export default new Vuex.Store({ scrollToAssignmentId: '', scrollToAssignmentReady: false, scrollingToAssignment: false, - editModule: false + editModule: false, + modulePayload: [], + modalResolve: () => {}, + modalReject: () => {}, }, getters: { @@ -50,12 +53,21 @@ export default new Vuex.Store({ currentNote: state => state.currentNote, currentNoteParent: state => state.currentNoteParent, noteType: state => state.noteType, + modulePayload: state => state.modulePayload }, actions: { setSpecialContainerClass({commit}, payload) { commit('setSpecialContainerClass', payload); }, + confirmModal({dispatch, state}) { + dispatch('hideModal'); + state.modalResolve(); + }, + cancelModal({dispatch, state}) { + dispatch('hideModal'); + state.modalReject(); + }, hideModal({commit, dispatch}) { document.body.classList.remove('no-scroll'); // won't get at the body any other way commit('setModal', false); @@ -80,6 +92,7 @@ export default new Vuex.Store({ commit('setVimeoId', null); commit('setCurrentNote', null); commit('setNoteType', ''); + commit('setModulePayload', []); }, resetContentBlockPosition({commit}) { commit('setContentBlockPosition', {}); @@ -109,7 +122,12 @@ export default new Vuex.Store({ }, showModal({commit}, payload) { document.body.classList.add('no-scroll'); // won't get at the body any other way + commit('setModal', payload); + return new Promise((resolve, reject) => { + commit('setModalResolve', resolve); + commit('setModalReject', reject); + }) }, addProjectEntry({commit, dispatch}, payload) { commit('setParentProject', payload); @@ -167,8 +185,12 @@ export default new Vuex.Store({ editModule({commit}, payload) { commit('setEditModule', payload) }, - editClassName({commit, dispatch}, payload) { + editClassName({dispatch}, payload) { dispatch('showModal', 'edit-class-name-wizard'); + }, + deactivateUser({commit, dispatch}, payload) { + commit('setModulePayload', payload); + return dispatch('showModal', 'deactivate-person'); } }, @@ -244,6 +266,15 @@ export default new Vuex.Store({ }, setNoteType(state, payload) { state.noteType = payload; + }, + setModulePayload(state, payload) { + state.modulePayload = payload; + }, + setModalResolve(state, payload) { + state.modalResolve = payload; + }, + setModalReject(state, payload) { + state.modalReject = payload; } } }) From b13ca67d7859230359baab1ec5aedb3f4a4a2d06 Mon Sep 17 00:00:00 2001 From: Ramon Wenger Date: Tue, 24 Mar 2020 16:23:46 +0100 Subject: [PATCH 089/102] Fix section title block --- client/src/components/content-blocks/ContentComponent.vue | 3 +++ 1 file changed, 3 insertions(+) diff --git a/client/src/components/content-blocks/ContentComponent.vue b/client/src/components/content-blocks/ContentComponent.vue index 4332a037..9f40af6e 100644 --- a/client/src/components/content-blocks/ContentComponent.vue +++ b/client/src/components/content-blocks/ContentComponent.vue @@ -32,6 +32,7 @@ import ThinglinkBlock from '@/components/content-blocks/ThinglinkBlock'; import GeniallyBlock from '@/components/content-blocks/GeniallyBlock'; import SubtitleBlock from '@/components/content-blocks/SubtitleBlock'; + import SectionTitleBlock from '@/components/content-blocks/SectionTitleBlock'; import ContentListBlock from '@/components/content-blocks/ContentListBlock'; import ModuleRoomSlug from '@/components/content-blocks/ModuleRoomSlug'; import Assignment from '@/components/content-blocks/assignment/Assignment'; @@ -56,6 +57,7 @@ 'infogram_block': InfogramBlock, 'genially_block': GeniallyBlock, 'subtitle': SubtitleBlock, + 'section_title': SectionTitleBlock, 'content_list': ContentListBlock, 'module_room_slug': ModuleRoomSlug, 'thinglink_block': ThinglinkBlock, @@ -102,6 +104,7 @@ .content-component { position: relative; + &--bookmarked { } From 18d52f8d2ee7099c8252c8e96072478467bd64d4 Mon Sep 17 00:00:00 2001 From: Ramon Wenger Date: Tue, 24 Mar 2020 16:48:11 +0100 Subject: [PATCH 090/102] Fix cypress test --- client/cypress/integration/school-class.spec.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/client/cypress/integration/school-class.spec.js b/client/cypress/integration/school-class.spec.js index 4309617d..cbeeeee5 100644 --- a/client/cypress/integration/school-class.spec.js +++ b/client/cypress/integration/school-class.spec.js @@ -143,6 +143,8 @@ describe('Class Management', () => { cy.get('[data-cy=remove-from-class]').first().click(); + cy.get('[data-cy=modal-save-button]').click(); + cy.get('[data-cy=active-class-members-list]').within(() => { cy.get('[data-cy=school-class-member]').should('have.length', 1) }); From 32e3c6067bbf11a1200e4eb004d1231a528267c0 Mon Sep 17 00:00:00 2001 From: Ramon Wenger Date: Wed, 25 Mar 2020 12:58:53 +0100 Subject: [PATCH 091/102] Move modal to plugin --- client/src/App.vue | 9 ++- .../components/profile/DeactivatePerson.vue | 13 ++-- client/src/main.js | 4 ++ client/src/pages/myClass.vue | 10 +-- client/src/plugins/modal.js | 72 +++++++++++++++++++ 5 files changed, 94 insertions(+), 14 deletions(-) create mode 100644 client/src/plugins/modal.js diff --git a/client/src/App.vue b/client/src/App.vue index 3d27aa5b..b1acde34 100644 --- a/client/src/App.vue +++ b/client/src/App.vue @@ -1,5 +1,6 @@ @@ -33,6 +36,7 @@ import WidgetPopover from '@/components/WidgetPopover'; import ChevronDown from '@/components/icons/ChevronDown'; import CurrentClass from '@/components/school-class/CurrentClass'; + import AddIcon from '@/components/icons/AddIcon'; import updateSelectedClassMixin from '@/mixins/updateSelectedClass'; import sidebarMixin from '@/mixins/sidebar'; @@ -42,7 +46,8 @@ components: { WidgetPopover, ChevronDown, - CurrentClass + CurrentClass, + AddIcon }, props: { @@ -97,6 +102,7 @@ left: 0; transform: translateY($small-spacing); } + } .selected-class { diff --git a/client/src/styles/_widget-popover.scss b/client/src/styles/_widget-popover.scss new file mode 100644 index 00000000..19c346d8 --- /dev/null +++ b/client/src/styles/_widget-popover.scss @@ -0,0 +1,67 @@ +@import "variables"; +@import "mixins"; + +.widget-popover { + position: absolute; + right: 0; + display: flex; + flex-direction: column; + background-color: $color-white; + padding: 0; + z-index: 100; + @include widget-shadow; + + &--mobile { + left: 0; + right: inherit; + } +} + +.popover-links { + list-style: none; + display: grid; + + &__icon { + width: 25px; + height: 25px; + margin-right: $small-spacing; + } + + &__link-with-icon { + display: flex; + align-items: center; + } + + &__link { + cursor: pointer; + padding: 0 $medium-spacing; + + & > a { + display: inline-block; + color: $color-silver-dark; + font-family: $sans-serif-font-family; + font-size: toRem(14px); + line-height: 1.5; + padding: 5px 0; + cursor: pointer; + } + + &--large { + line-height: 40px; + padding: $small-spacing $medium-spacing; + + & > a, & { + @include small-text; + } + } + + &--emph { + @include regular-text; + font-weight: 600; + } + } + + &__divider { + border-top: 1px solid $color-silver-dark; + } +} diff --git a/client/src/styles/main.scss b/client/src/styles/main.scss index e4b996ec..9493d8dd 100644 --- a/client/src/styles/main.scss +++ b/client/src/styles/main.scss @@ -24,3 +24,4 @@ @import "module-activity"; @import "book-subnavigation"; @import "simple-list"; +@import "widget-popover";