From 4893a791779ce9d95b3d0ebcf863e5890fc901f8 Mon Sep 17 00:00:00 2001 From: Jacob Pierce Date: Mon, 1 Jul 2024 16:10:58 -0700 Subject: [PATCH 1/5] only show save success msg when saving --- .../coach/assets/src/views/plan/CoachExamsPage/index.vue | 5 +++++ .../src/views/plan/CreateExamPage/CreateQuizSection.vue | 3 --- .../src/views/plan/CreateExamPage/ResourceSelection.vue | 3 --- .../assets/src/views/plan/CreateExamPage/SectionEditor.vue | 3 --- .../coach/assets/src/views/plan/CreateExamPage/index.vue | 6 ++++++ 5 files changed, 11 insertions(+), 9 deletions(-) diff --git a/kolibri/plugins/coach/assets/src/views/plan/CoachExamsPage/index.vue b/kolibri/plugins/coach/assets/src/views/plan/CoachExamsPage/index.vue index 5e224adcb85..7660bb47b3c 100644 --- a/kolibri/plugins/coach/assets/src/views/plan/CoachExamsPage/index.vue +++ b/kolibri/plugins/coach/assets/src/views/plan/CoachExamsPage/index.vue @@ -354,6 +354,11 @@ return '--'; }, }, + mounted() { + if (this.$route.query.snackbar) { + this.$store.dispatch('createSnackbar', this.$route.query.snackbar); + } + }, methods: { handleOpenQuiz(quizId) { const promise = ExamResource.saveModel({ diff --git a/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/CreateQuizSection.vue b/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/CreateQuizSection.vue index c6b159f7a6c..5d72a8e5946 100644 --- a/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/CreateQuizSection.vue +++ b/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/CreateQuizSection.vue @@ -378,7 +378,6 @@ numberOfReplacementsAvailable$, sectionDeletedNotification$, deleteConfirmation$, - changesSavedSuccessfully$, questionsDeletedNotification$, expandAll$, collapseAll$, @@ -449,7 +448,6 @@ numberOfReplacementsAvailable$, sectionDeletedNotification$, deleteConfirmation$, - changesSavedSuccessfully$, questionsDeletedNotification$, toggleQuestionInSelection, @@ -657,7 +655,6 @@ questions: newArray, }; this.updateSection(payload); - this.$store.dispatch('createSnackbar', this.changesSavedSuccessfully$()); this.dragActive = false; }, handleAddSection() { diff --git a/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/ResourceSelection.vue b/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/ResourceSelection.vue index 44f2cae96d6..55e7d4bbf6e 100644 --- a/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/ResourceSelection.vue +++ b/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/ResourceSelection.vue @@ -263,7 +263,6 @@ numberOfSelectedBookmarks$, selectResourcesDescription$, questionsFromResources$, - changesSavedSuccessfully$, cannotSelectSomeTopicWarning$, closeConfirmationMessage$, closeConfirmationTitle$, @@ -662,7 +661,6 @@ cannotSelectSomeTopicWarning$, closeConfirmationMessage$, closeConfirmationTitle$, - changesSavedSuccessfully$, sectionSettings$, numberOfQuestionsSelected$, tooManyQuestions$, @@ -809,7 +807,6 @@ ...this.$route.params, }, }); - this.$store.dispatch('createSnackbar', this.changesSavedSuccessfully$()); }, // The message put onto the content's card when listed selectionMetadata(content) { diff --git a/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/SectionEditor.vue b/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/SectionEditor.vue index 33db5d1adad..18d1e13a523 100644 --- a/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/SectionEditor.vue +++ b/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/SectionEditor.vue @@ -252,7 +252,6 @@ closeConfirmationMessage$, closeConfirmationTitle$, deleteConfirmation$, - changesSavedSuccessfully$, addQuestionsLabel$, addMoreQuestionsLabel$, sectionDeletedNotification$, @@ -401,7 +400,6 @@ currentSection$, deleteSectionLabel$, applySettings$, - changesSavedSuccessfully$, closeConfirmationTitle$, closeConfirmationMessage$, deleteConfirmation$, @@ -478,7 +476,6 @@ question_sources, }); } - this.$store.dispatch('createSnackbar', this.changesSavedSuccessfully$()); }, }, }; diff --git a/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/index.vue b/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/index.vue index 553e5dd36df..d2569e877e9 100644 --- a/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/index.vue +++ b/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/index.vue @@ -142,6 +142,7 @@ allSectionsEmptyWarning$, closeConfirmationTitle$, closeConfirmationMessage$, + changesSavedSuccessfully$, sectionOrderLabel$, randomizedLabel$, fixedLabel$, @@ -165,6 +166,7 @@ allSectionsEmpty, allSectionsEmptyWarning$, saveAndClose$, + changesSavedSuccessfully$, sectionOrderLabel$, randomizedLabel$, fixedLabel$, @@ -238,12 +240,16 @@ saveQuizAndRedirect(close = true) { this.saveQuiz() .then(exam => { + this.$store.dispatch('createSnackbar', this.changesSavedSuccessfully$()); if (close) { this.$router.replace({ name: PageNames.EXAMS, params: { classId: this.$route.params.classId, }, + query: { + snackbar: this.changesSavedSuccessfully$(), + }, }); } else { if (String(this.$route.params.quizId) === String(exam.id)) { From 4ebc1dcd330bb853472e2dd8a28f91375be34a62 Mon Sep 17 00:00:00 2001 From: Jacob Pierce Date: Tue, 2 Jul 2024 09:57:04 -0700 Subject: [PATCH 2/5] fix section deletion issue --- .../src/views/plan/CreateExamPage/CreateQuizSection.vue | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/CreateQuizSection.vue b/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/CreateQuizSection.vue index 5d72a8e5946..c8416a71652 100644 --- a/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/CreateQuizSection.vue +++ b/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/CreateQuizSection.vue @@ -572,10 +572,7 @@ } }, handleConfirmDelete() { - const section_title = displaySectionTitle( - this.activeSection.value, - this.activeSectionIndex.value, - ); + const section_title = displaySectionTitle(this.activeSection, this.activeSectionIndex); const newIndex = this.activeSectionIndex > 0 ? this.activeSectionIndex - 1 : 0; this.setActiveSection(newIndex); this.removeSection(this.activeSectionIndex); From 327319710783dc38ecee604280991b5f64af4d03 Mon Sep 17 00:00:00 2001 From: Jacob Pierce Date: Tue, 2 Jul 2024 10:04:33 -0700 Subject: [PATCH 3/5] make the UiAlert dismissible so it's not so in-your-face --- .../src/views/plan/assignments/AssignmentDetailsModal.vue | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kolibri/plugins/coach/assets/src/views/plan/assignments/AssignmentDetailsModal.vue b/kolibri/plugins/coach/assets/src/views/plan/assignments/AssignmentDetailsModal.vue index ac311f0324a..a2ce23de118 100644 --- a/kolibri/plugins/coach/assets/src/views/plan/assignments/AssignmentDetailsModal.vue +++ b/kolibri/plugins/coach/assets/src/views/plan/assignments/AssignmentDetailsModal.vue @@ -5,7 +5,8 @@ {{ submitErrorMessage }} From 476ee36ed529ded5bce40f0bdb83cb19e8fd8c31 Mon Sep 17 00:00:00 2001 From: Jacob Pierce Date: Tue, 2 Jul 2024 10:54:47 -0700 Subject: [PATCH 4/5] emit closePanel when applying settings --- .../coach/assets/src/views/plan/CreateExamPage/SectionEditor.vue | 1 + 1 file changed, 1 insertion(+) diff --git a/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/SectionEditor.vue b/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/SectionEditor.vue index 18d1e13a523..207a68c4d6e 100644 --- a/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/SectionEditor.vue +++ b/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/SectionEditor.vue @@ -476,6 +476,7 @@ question_sources, }); } + this.$emit('closePanel'); }, }, }; From 05d3b54c8135d85f04f6275c4d78194634cd202c Mon Sep 17 00:00:00 2001 From: Jacob Pierce Date: Tue, 2 Jul 2024 16:46:56 -0700 Subject: [PATCH 5/5] hide errors about saving once save is successfull --- .../coach/assets/src/views/plan/CreateExamPage/index.vue | 1 + .../src/views/plan/assignments/AssignmentDetailsModal.vue | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/index.vue b/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/index.vue index d2569e877e9..812d06e8707 100644 --- a/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/index.vue +++ b/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/index.vue @@ -240,6 +240,7 @@ saveQuizAndRedirect(close = true) { this.saveQuiz() .then(exam => { + this.$refs.detailsModal.handleSubmitSuccess(); this.$store.dispatch('createSnackbar', this.changesSavedSuccessfully$()); if (close) { this.$router.replace({ diff --git a/kolibri/plugins/coach/assets/src/views/plan/assignments/AssignmentDetailsModal.vue b/kolibri/plugins/coach/assets/src/views/plan/assignments/AssignmentDetailsModal.vue index a2ce23de118..1b589ccd931 100644 --- a/kolibri/plugins/coach/assets/src/views/plan/assignments/AssignmentDetailsModal.vue +++ b/kolibri/plugins/coach/assets/src/views/plan/assignments/AssignmentDetailsModal.vue @@ -320,6 +320,13 @@ // Scroll to the title field in case focus() didn't do that immediately window.scrollTo({ top: 0, behavior: 'smooth' }); }, + /** + * @public + */ + handleSubmitSuccess() { + this.showTitleError = false; + this.showServerError = false; + }, }, };