From 95d5985093e81ceb67c4fdfd8101e6610c4a008e Mon Sep 17 00:00:00 2001 From: Allan Otodi Opeto <103313919+AllanOXDi@users.noreply.github.com> Date: Wed, 13 Nov 2024 18:33:15 +0300 Subject: [PATCH 01/24] basic layout added --- .../ManageSelectedLessonResource.vue | 172 ++++++++++++++++++ .../quizzes/CreateExamPage/SectionOrder.vue | 12 +- 2 files changed, 178 insertions(+), 6 deletions(-) create mode 100644 kolibri/plugins/coach/assets/src/views/lessons/LessonResourceSelectionPage/ManageSelectedLessonResource.vue diff --git a/kolibri/plugins/coach/assets/src/views/lessons/LessonResourceSelectionPage/ManageSelectedLessonResource.vue b/kolibri/plugins/coach/assets/src/views/lessons/LessonResourceSelectionPage/ManageSelectedLessonResource.vue new file mode 100644 index 00000000000..b58895cbf8b --- /dev/null +++ b/kolibri/plugins/coach/assets/src/views/lessons/LessonResourceSelectionPage/ManageSelectedLessonResource.vue @@ -0,0 +1,172 @@ + + + + + + + \ No newline at end of file diff --git a/kolibri/plugins/coach/assets/src/views/quizzes/CreateExamPage/SectionOrder.vue b/kolibri/plugins/coach/assets/src/views/quizzes/CreateExamPage/SectionOrder.vue index 07e657bd5e1..ab640d3b1b1 100644 --- a/kolibri/plugins/coach/assets/src/views/quizzes/CreateExamPage/SectionOrder.vue +++ b/kolibri/plugins/coach/assets/src/views/quizzes/CreateExamPage/SectionOrder.vue @@ -104,12 +104,12 @@ export default { name: 'SectionOrder', - components: { - Draggable, - DragContainer, - DragHandle, - DragSortWidget, - }, + components: { + Draggable, + DragContainer, + DragHandle, + DragSortWidget, + }, mixins: [commonCoreStrings], setup(_, context) { const { From 7291c4400ef26d88e2831144c10a0026dc66831a Mon Sep 17 00:00:00 2001 From: Allan Otodi Opeto <103313919+AllanOXDi@users.noreply.github.com> Date: Thu, 14 Nov 2024 22:46:25 +0300 Subject: [PATCH 02/24] fixes routes --- .../coach/assets/src/routes/lessonsRoutes.js | 3 +- .../assets/src/routes/planLessonsRoutes.js | 247 ++++++++++++++++++ .../LessonResourceSelectionPage/index.vue | 15 ++ .../views/lessons/LessonSummaryPage/index.vue | 32 +++ .../ManageSelectedLessonResource.vue | 0 .../PreviewSelectedResources.vue | 28 ++ .../ManageSelectedLessonResource.vue | 169 ++++++++++++ 7 files changed, 493 insertions(+), 1 deletion(-) create mode 100644 kolibri/plugins/coach/assets/src/routes/planLessonsRoutes.js rename kolibri/plugins/coach/assets/src/views/lessons/{LessonResourceSelectionPage => LessonSummaryPage/sidePanels}/ManageSelectedLessonResource.vue (100%) create mode 100644 kolibri/plugins/coach/assets/src/views/plan/LessonContentPreviewPage/PreviewSelectedResources.vue create mode 100644 kolibri/plugins/coach/assets/src/views/plan/LessonResourceSelectionPage/ManageSelectedLessonResource.vue diff --git a/kolibri/plugins/coach/assets/src/routes/lessonsRoutes.js b/kolibri/plugins/coach/assets/src/routes/lessonsRoutes.js index cf688592915..8d791353396 100644 --- a/kolibri/plugins/coach/assets/src/routes/lessonsRoutes.js +++ b/kolibri/plugins/coach/assets/src/routes/lessonsRoutes.js @@ -39,6 +39,7 @@ import QuestionLearnersPage from '../views/common/reports/QuestionLearnersPage.v import EditLessonDetails from '../views/lessons/LessonSummaryPage/sidePanels/EditLessonDetails'; import PreviewSelectedResources from '../views/lessons/LessonSummaryPage/sidePanels/PreviewSelectedResources'; import LessonResourceSelection from '../views/lessons/LessonSummaryPage/sidePanels/LessonResourceSelection'; +import ManageSelectedLessonResources from '../views/lessons/LessonSummaryPage/sidePanels/ManageSelectedLessonResources'; import { classIdParamRequiredGuard, RouteSegments } from './utils'; const { @@ -138,7 +139,7 @@ export default [ { name: PageNames.LESSON_PREVIEW_SELECTED_RESOURCES, path: 'preview-resources/', - component: PreviewSelectedResources, + component: ManageSelectedLessonResources, }, { name: PageNames.LESSON_PREVIEW_RESOURCE, diff --git a/kolibri/plugins/coach/assets/src/routes/planLessonsRoutes.js b/kolibri/plugins/coach/assets/src/routes/planLessonsRoutes.js new file mode 100644 index 00000000000..78664f7dac0 --- /dev/null +++ b/kolibri/plugins/coach/assets/src/routes/planLessonsRoutes.js @@ -0,0 +1,247 @@ +import store from 'kolibri.coreVue.vuex.store'; +import { + showLessonResourceContentPreview, + showLessonResourceSelectionRootPage, + showLessonResourceSelectionTopicPage, + showLessonSelectionContentPreview, + showLessonResourceSearchPage, + showLessonResourceBookmarks, + showLessonResourceBookmarksMain, +} from '../modules/lessonResources/handlers'; +import { showLessonSummaryPage } from '../modules/lessonSummary/handlers'; +import { LessonsPageNames } from '../constants/lessonsConstants'; +import { PageNames } from '../constants'; + +import { useLessons } from '../composables/useLessons'; + +import LessonsRootPage from '../views/plan/LessonsRootPage'; +import LessonSummaryPage from '../views/plan/LessonSummaryPage'; +import LessonResourceSelectionPage from '../views/plan/LessonResourceSelectionPage'; +import PlanLessonSelectionContentPreview from '../views/plan/PlanLessonSelectionContentPreview'; +import LessonEditDetailsPage from '../views/plan/LessonEditDetailsPage'; +import LessonCreationPage from '../views/plan/LessonCreationPage'; +import EditLessonDetails from '../views/plan/LessonEditDetailsPage/EditLessonDetails.vue'; +import PreviewSelectedResources from '../views/plan/LessonContentPreviewPage/PreviewSelectedResources.vue'; +import LessonResourceSelection from '../views/plan/LessonResourceSelectionPage/LessonResourceSelection.vue'; +import { classIdParamRequiredGuard } from './utils'; + +const OPTIONAL_CLASS = '/:classId?/plan'; +const CLASS = '/:classId/plan'; +const LESSON = '/lessons/:lessonId'; +const ALL_LESSONS = '/lessons'; +const SELECTION = '/selection'; +const TOPIC = '/topic/:topicId'; +const SEARCH = '/search/:searchTerm'; +const PREVIEW = '/preview/:contentId'; + +function path(...args) { + return args.join(''); +} + +const { showLessonsRootPage } = useLessons(); + +export default [ + { + name: LessonsPageNames.PLAN_LESSONS_ROOT, + path: path(OPTIONAL_CLASS, ALL_LESSONS), + component: LessonsRootPage, + handler(toRoute, fromRoute, next) { + if (classIdParamRequiredGuard(toRoute, PageNames.PLAN_PAGE, next)) { + return; + } + showLessonsRootPage(store, toRoute.params.classId); + }, + meta: { + titleParts: ['lessonsLabel', 'CLASS_NAME'], + }, + }, + { + name: LessonsPageNames.PLAN_LESSONS_ROOT_BETTER, + path: '/:classId/plan/lessonstemp', + component: LessonsRootPage, + handler(toRoute, fromRoute, next) { + if (classIdParamRequiredGuard(toRoute, PageNames.PLAN_PAGE, next)) { + return; + } + showLessonsRootPage(store, toRoute.params.classId); + }, + meta: { + titleParts: ['lessonsLabel', 'CLASS_NAME'], + }, + }, + { + name: LessonsPageNames.LESSON_CREATION_ROOT, + path: path(CLASS, ALL_LESSONS, '/new'), + component: LessonCreationPage, + }, + { + name: PageNames.LESSON_CREATION_ROOT_BETTER, + path: '/:classId/plan/lessonstemp/:lessonId/edit', + component: LessonCreationPage, + children: [ + { + name: PageNames.LESSON_EDIT_DETAILS, + path: 'details/', + component: EditLessonDetails, + props: { + text: 'test', + }, + }, + { + + + name: PageNames.LESSON_SELECT_RESOURCES, + path: 'select-resources/:topicId?', + component: LessonResourceSelection, + }, + { + name: PageNames.LESSON_PREVIEW_SELECTED_RESOURCES, + path: 'preview-resources/', + component: PreviewSelectedResources, + }, + { + name: PageNames.LESSON_PREVIEW_RESOURCE, + path: 'preview-resources/:nodeId', + component: PreviewSelectedResources, + }, + ], + }, + { + name: LessonsPageNames.SUMMARY, + path: '/:classId/plan/lessonstemp/:lessonId/:tabId?', + component: LessonSummaryPage, + handler(toRoute, fromRoute) { + if ( + fromRoute.name !== LessonsPageNames.SUMMARY || + toRoute.params.lessonId !== fromRoute.params.lessonId + ) { + return showLessonSummaryPage(store, toRoute.params); + } + store.dispatch('notLoading'); + }, + meta: { + titleParts: ['LESSON_NAME', 'CLASS_NAME'], + }, + }, + { + name: LessonsPageNames.SUMMARY, + path: path(CLASS, LESSON), + component: LessonSummaryPage, + handler(toRoute, fromRoute) { + if ( + fromRoute.name !== LessonsPageNames.SUMMARY || + toRoute.params.lessonId !== fromRoute.params.lessonId + ) { + return showLessonSummaryPage(store, toRoute.params); + } + store.dispatch('notLoading'); + }, + meta: { + titleParts: ['LESSON_NAME', 'CLASS_NAME'], + }, + }, + { + name: LessonEditDetailsPage.name, + path: path(CLASS, LESSON, '/edit'), + component: LessonEditDetailsPage, + }, + { + name: LessonsPageNames.SELECTION_ROOT, + path: path(CLASS, LESSON, SELECTION), + component: LessonResourceSelectionPage, + handler(toRoute) { + showLessonResourceSelectionRootPage(store, toRoute.params); + }, + }, + { + name: LessonsPageNames.SELECTION, + path: path(CLASS, LESSON, SELECTION, TOPIC), + component: LessonResourceSelectionPage, + handler(toRoute, fromRoute) { + // HACK if last page was LessonContentPreviewPage, then we need to make sure + // to immediately autosave just in case a change was made there. This gets + // called whether or not a change is made, because we don't track changes + // enough steps back. + let preHandlerPromise; + if (fromRoute.name === LessonsPageNames.SELECTION_CONTENT_PREVIEW) { + preHandlerPromise = store.dispatch('lessonSummary/saveLessonResources', { + lessonId: toRoute.params.lessonId, + resources: store.state.lessonSummary.workingResources, + }); + } else { + preHandlerPromise = Promise.resolve(); + } + preHandlerPromise.then(() => { + showLessonResourceSelectionTopicPage(store, toRoute.params); + }); + }, + }, + { + name: LessonsPageNames.SELECTION_SEARCH, + path: path(CLASS, LESSON, SELECTION, SEARCH), + component: LessonResourceSelectionPage, + handler(toRoute) { + showLessonResourceSearchPage(store, toRoute.params, toRoute.query); + }, + }, + { + name: LessonsPageNames.LESSON_SELECTION_BOOKMARKS, + path: path(CLASS, LESSON, SELECTION, TOPIC), + component: LessonResourceSelectionPage, + handler(toRoute, fromRoute) { + let preHandlerPromise; + if (fromRoute.name === LessonsPageNames.SELECTION_CONTENT_PREVIEW) { + preHandlerPromise = store.dispatch('lessonSummary/saveLessonResources', { + lessonId: toRoute.params.lessonId, + resources: store.state.lessonSummary.workingResources, + }); + } else { + preHandlerPromise = Promise.resolve(); + } + preHandlerPromise.then(() => { + showLessonResourceBookmarks(store, toRoute.params, toRoute.query); + }); + }, + }, + { + name: LessonsPageNames.LESSON_SELECTION_BOOKMARKS_MAIN, + path: path(CLASS, LESSON, SELECTION), + component: LessonResourceSelectionPage, + handler(toRoute) { + showLessonResourceBookmarksMain(store, toRoute.params, toRoute.query); + }, + }, + { + name: LessonsPageNames.SELECTION_CONTENT_PREVIEW, + path: path(CLASS, LESSON, SELECTION, PREVIEW), + component: PlanLessonSelectionContentPreview, + handler(toRoute) { + showLessonSelectionContentPreview(store, toRoute.params, toRoute.query); + }, + }, + { + name: LessonsPageNames.RESOURCE_CONTENT_PREVIEW, + path: path(CLASS, LESSON, '/resource', PREVIEW), + component: PlanLessonSelectionContentPreview, + props(data) { + let backRoute; + // If linked from the Reports section, go back there + if (data.query.last === 'LessonReportEditDetailsPage') { + backRoute = { + name: 'LessonReportEditDetailsPage', + }; + } else { + backRoute = { + name: LessonsPageNames.SUMMARY, + }; + } + return { + showSelectOptions: false, + backRoute, + }; + }, + handler(toRoute) { + showLessonResourceContentPreview(store, toRoute.params); + }, + }, +]; diff --git a/kolibri/plugins/coach/assets/src/views/lessons/LessonResourceSelectionPage/index.vue b/kolibri/plugins/coach/assets/src/views/lessons/LessonResourceSelectionPage/index.vue index 9496de9d7be..361ca6043b1 100644 --- a/kolibri/plugins/coach/assets/src/views/lessons/LessonResourceSelectionPage/index.vue +++ b/kolibri/plugins/coach/assets/src/views/lessons/LessonResourceSelectionPage/index.vue @@ -96,6 +96,13 @@ + + + + + + + + @@ -150,6 +177,7 @@ ReportsLessonTabs, workingResourcesBackup, REPORTS_LESSON_TABS_ID, + showSidePanel:true, }; }, computed: { @@ -359,6 +387,10 @@ message: 'Undo', context: 'Allows user to undo an action.', }, + numberOfSelectedResource: { + message: '{count, number, integer} {count, plural, one {resource selected} other {resources selected}}', + context:'Indicates the number of resources selected' + } }, }; diff --git a/kolibri/plugins/coach/assets/src/views/lessons/LessonResourceSelectionPage/ManageSelectedLessonResource.vue b/kolibri/plugins/coach/assets/src/views/lessons/LessonSummaryPage/sidePanels/ManageSelectedLessonResource.vue similarity index 100% rename from kolibri/plugins/coach/assets/src/views/lessons/LessonResourceSelectionPage/ManageSelectedLessonResource.vue rename to kolibri/plugins/coach/assets/src/views/lessons/LessonSummaryPage/sidePanels/ManageSelectedLessonResource.vue diff --git a/kolibri/plugins/coach/assets/src/views/plan/LessonContentPreviewPage/PreviewSelectedResources.vue b/kolibri/plugins/coach/assets/src/views/plan/LessonContentPreviewPage/PreviewSelectedResources.vue new file mode 100644 index 00000000000..971988f297b --- /dev/null +++ b/kolibri/plugins/coach/assets/src/views/plan/LessonContentPreviewPage/PreviewSelectedResources.vue @@ -0,0 +1,28 @@ + + + + diff --git a/kolibri/plugins/coach/assets/src/views/plan/LessonResourceSelectionPage/ManageSelectedLessonResource.vue b/kolibri/plugins/coach/assets/src/views/plan/LessonResourceSelectionPage/ManageSelectedLessonResource.vue new file mode 100644 index 00000000000..2af5a263739 --- /dev/null +++ b/kolibri/plugins/coach/assets/src/views/plan/LessonResourceSelectionPage/ManageSelectedLessonResource.vue @@ -0,0 +1,169 @@ + + + + + + + \ No newline at end of file From 4e571ab65bbc33c0ff738d2265a06cdb83d4bd87 Mon Sep 17 00:00:00 2001 From: Allan Otodi Opeto <103313919+AllanOXDi@users.noreply.github.com> Date: Mon, 18 Nov 2024 21:41:33 +0300 Subject: [PATCH 03/24] fixes the routing issue --- .../assets/src/routes/planLessonsRoutes.js | 3 +- .../src/views/lessons/LessonCreationPage.vue | 46 +++++++++++++++++++ .../views/lessons/LessonSummaryPage/index.vue | 3 ++ .../ManageSelectedResourcePanel.vue | 20 ++++++++ .../ManageSelectedLessonResource.vue | 1 - 5 files changed, 71 insertions(+), 2 deletions(-) create mode 100644 kolibri/plugins/coach/assets/src/views/plan/LessonContentPreviewPage/ManageSelectedResourcePanel.vue diff --git a/kolibri/plugins/coach/assets/src/routes/planLessonsRoutes.js b/kolibri/plugins/coach/assets/src/routes/planLessonsRoutes.js index 78664f7dac0..df3a6531c83 100644 --- a/kolibri/plugins/coach/assets/src/routes/planLessonsRoutes.js +++ b/kolibri/plugins/coach/assets/src/routes/planLessonsRoutes.js @@ -22,6 +22,7 @@ import LessonEditDetailsPage from '../views/plan/LessonEditDetailsPage'; import LessonCreationPage from '../views/plan/LessonCreationPage'; import EditLessonDetails from '../views/plan/LessonEditDetailsPage/EditLessonDetails.vue'; import PreviewSelectedResources from '../views/plan/LessonContentPreviewPage/PreviewSelectedResources.vue'; +import ManageSelectedResourcePanel from '../views/plan/LessonContentPreviewPage/ManageSelectedResourcePanel.vue'; import LessonResourceSelection from '../views/plan/LessonResourceSelectionPage/LessonResourceSelection.vue'; import { classIdParamRequiredGuard } from './utils'; @@ -97,7 +98,7 @@ export default [ { name: PageNames.LESSON_PREVIEW_SELECTED_RESOURCES, path: 'preview-resources/', - component: PreviewSelectedResources, + component: ManageSelectedResourcePanel, }, { name: PageNames.LESSON_PREVIEW_RESOURCE, diff --git a/kolibri/plugins/coach/assets/src/views/lessons/LessonCreationPage.vue b/kolibri/plugins/coach/assets/src/views/lessons/LessonCreationPage.vue index a719a9e3b0c..f9189ddaf1a 100644 --- a/kolibri/plugins/coach/assets/src/views/lessons/LessonCreationPage.vue +++ b/kolibri/plugins/coach/assets/src/views/lessons/LessonCreationPage.vue @@ -45,6 +45,33 @@ classId() { return this.$route.params.classId; }, + recipients() { + return this.getLearnersForLesson(this.currentLesson); + }, + resourcesTable() { + return this.workingResources.map(resource => { + const content = this.resourceCache[resource.contentnode_id]; + if (!content) { + return this.missingResourceObj(resource.contentnode_id); + } + + const tally = this.getContentStatusTally(content.content_id, this.recipients); + const tableRow = { + ...content, + node_id: content.id, + avgTimeSpent: this.getContentAvgTimeSpent(content.content_id, this.recipients), + tally, + hasAssignments: Object.values(tally).reduce((a, b) => a + b, 0), + }; + + const link = this.resourceLink(tableRow); + if (link) { + tableRow.link = link; + } + + return tableRow; + }); + }, }, created() { const initClassInfoPromise = this.$store.dispatch('initClassInfo', this.classId); @@ -77,6 +104,25 @@ } }); }, + resourceLink(resource) { + if (resource.hasAssignments) { + if (resource.kind === this.ContentNodeKinds.EXERCISE) { + return this.classRoute( + this.group + ? 'ReportsGroupReportLessonExerciseLearnerListPage' + : 'ReportsLessonExerciseLearnerListPage', + { exerciseId: resource.content_id }, + ); + } else { + return this.classRoute( + this.group + ? 'ReportsGroupReportLessonResourceLearnerListPage' + : 'ReportsLessonResourceLearnerListPage', + { resourceId: resource.content_id }, + ); + } + } + }, }, }; diff --git a/kolibri/plugins/coach/assets/src/views/lessons/LessonSummaryPage/index.vue b/kolibri/plugins/coach/assets/src/views/lessons/LessonSummaryPage/index.vue index 7018427f4b0..88e8f4238c6 100644 --- a/kolibri/plugins/coach/assets/src/views/lessons/LessonSummaryPage/index.vue +++ b/kolibri/plugins/coach/assets/src/views/lessons/LessonSummaryPage/index.vue @@ -288,6 +288,9 @@ } }, }, + mounted(){ + console.log(this.route.params); + }, methods: { ...mapActions('lessonSummary', [ 'saveLessonResources', diff --git a/kolibri/plugins/coach/assets/src/views/plan/LessonContentPreviewPage/ManageSelectedResourcePanel.vue b/kolibri/plugins/coach/assets/src/views/plan/LessonContentPreviewPage/ManageSelectedResourcePanel.vue new file mode 100644 index 00000000000..a624d33f4de --- /dev/null +++ b/kolibri/plugins/coach/assets/src/views/plan/LessonContentPreviewPage/ManageSelectedResourcePanel.vue @@ -0,0 +1,20 @@ + + + + + + \ No newline at end of file diff --git a/kolibri/plugins/coach/assets/src/views/plan/LessonResourceSelectionPage/ManageSelectedLessonResource.vue b/kolibri/plugins/coach/assets/src/views/plan/LessonResourceSelectionPage/ManageSelectedLessonResource.vue index 2af5a263739..3ae195a8666 100644 --- a/kolibri/plugins/coach/assets/src/views/plan/LessonResourceSelectionPage/ManageSelectedLessonResource.vue +++ b/kolibri/plugins/coach/assets/src/views/plan/LessonResourceSelectionPage/ManageSelectedLessonResource.vue @@ -65,7 +65,6 @@ icon="minus" @click="removeResource(lesson.id)" /> - From 0b1e4a0b509d67f928cb58a08166a3160cba4074 Mon Sep 17 00:00:00 2001 From: Allan Otodi Opeto <103313919+AllanOXDi@users.noreply.github.com> Date: Thu, 21 Nov 2024 22:36:46 +0300 Subject: [PATCH 04/24] clean up routing business --- .../coach/assets/src/routes/lessonsRoutes.js | 2 +- .../sidePanels/LessonResourceSelection.vue | 27 ++- .../ManageSelectedLessonResource.vue | 222 ++++++++++-------- .../ManageSelectedLessonResource.vue | 168 ------------- 4 files changed, 148 insertions(+), 271 deletions(-) delete mode 100644 kolibri/plugins/coach/assets/src/views/plan/LessonResourceSelectionPage/ManageSelectedLessonResource.vue diff --git a/kolibri/plugins/coach/assets/src/routes/lessonsRoutes.js b/kolibri/plugins/coach/assets/src/routes/lessonsRoutes.js index 8d791353396..825b54842d9 100644 --- a/kolibri/plugins/coach/assets/src/routes/lessonsRoutes.js +++ b/kolibri/plugins/coach/assets/src/routes/lessonsRoutes.js @@ -39,7 +39,7 @@ import QuestionLearnersPage from '../views/common/reports/QuestionLearnersPage.v import EditLessonDetails from '../views/lessons/LessonSummaryPage/sidePanels/EditLessonDetails'; import PreviewSelectedResources from '../views/lessons/LessonSummaryPage/sidePanels/PreviewSelectedResources'; import LessonResourceSelection from '../views/lessons/LessonSummaryPage/sidePanels/LessonResourceSelection'; -import ManageSelectedLessonResources from '../views/lessons/LessonSummaryPage/sidePanels/ManageSelectedLessonResources'; +import ManageSelectedLessonResources from '../views/lessons/LessonSummaryPage/sidePanels/ManageSelectedLessonResource'; import { classIdParamRequiredGuard, RouteSegments } from './utils'; const { diff --git a/kolibri/plugins/coach/assets/src/views/lessons/LessonSummaryPage/sidePanels/LessonResourceSelection.vue b/kolibri/plugins/coach/assets/src/views/lessons/LessonSummaryPage/sidePanels/LessonResourceSelection.vue index ba5a5caa01b..79ede6152fe 100644 --- a/kolibri/plugins/coach/assets/src/views/lessons/LessonSummaryPage/sidePanels/LessonResourceSelection.vue +++ b/kolibri/plugins/coach/assets/src/views/lessons/LessonSummaryPage/sidePanels/LessonResourceSelection.vue @@ -94,10 +94,13 @@ @@ -109,27 +102,29 @@ - - - \ No newline at end of file From c5a0cce75f08afcc86bbf8eadb42ba651ae6ae30 Mon Sep 17 00:00:00 2001 From: Allan Otodi Opeto <103313919+AllanOXDi@users.noreply.github.com> Date: Fri, 22 Nov 2024 21:03:09 +0300 Subject: [PATCH 05/24] clean ups importations --- .../assets/src/routes/planLessonsRoutes.js | 20 +-- .../views/lessons/LessonSummaryPage/index.vue | 30 ---- .../ManageSelectedLessonResource.vue | 132 +++----------- .../sidePanels/SelectedResource.vue | 165 ++++++++++++++++++ .../ManageSelectedResourcePanel.vue | 20 --- .../PreviewSelectedResources.vue | 28 --- 6 files changed, 198 insertions(+), 197 deletions(-) create mode 100644 kolibri/plugins/coach/assets/src/views/lessons/LessonSummaryPage/sidePanels/SelectedResource.vue delete mode 100644 kolibri/plugins/coach/assets/src/views/plan/LessonContentPreviewPage/ManageSelectedResourcePanel.vue delete mode 100644 kolibri/plugins/coach/assets/src/views/plan/LessonContentPreviewPage/PreviewSelectedResources.vue diff --git a/kolibri/plugins/coach/assets/src/routes/planLessonsRoutes.js b/kolibri/plugins/coach/assets/src/routes/planLessonsRoutes.js index df3a6531c83..192ed37ddeb 100644 --- a/kolibri/plugins/coach/assets/src/routes/planLessonsRoutes.js +++ b/kolibri/plugins/coach/assets/src/routes/planLessonsRoutes.js @@ -14,16 +14,16 @@ import { PageNames } from '../constants'; import { useLessons } from '../composables/useLessons'; -import LessonsRootPage from '../views/plan/LessonsRootPage'; -import LessonSummaryPage from '../views/plan/LessonSummaryPage'; -import LessonResourceSelectionPage from '../views/plan/LessonResourceSelectionPage'; -import PlanLessonSelectionContentPreview from '../views/plan/PlanLessonSelectionContentPreview'; -import LessonEditDetailsPage from '../views/plan/LessonEditDetailsPage'; -import LessonCreationPage from '../views/plan/LessonCreationPage'; -import EditLessonDetails from '../views/plan/LessonEditDetailsPage/EditLessonDetails.vue'; -import PreviewSelectedResources from '../views/plan/LessonContentPreviewPage/PreviewSelectedResources.vue'; -import ManageSelectedResourcePanel from '../views/plan/LessonContentPreviewPage/ManageSelectedResourcePanel.vue'; -import LessonResourceSelection from '../views/plan/LessonResourceSelectionPage/LessonResourceSelection.vue'; +import LessonsRootPage from '../views/lessons/LessonsRootPage'; +import LessonSummaryPage from '../views/lessons/LessonSummaryPage'; +import LessonResourceSelectionPage from '../views/lessons/LessonResourceSelectionPage'; +import PlanLessonSelectionContentPreview from '../views/lessons/LessonSelectionContentPreviewPage'; +import LessonEditDetailsPage from '../views/lessons/LessonEditDetailsPage'; +import LessonCreationPage from '../views/lessons/LessonCreationPage'; +import EditLessonDetails from '../views/lessons/LessonEditDetailsPage/EditDetailsResourceListTable.vue'; +import PreviewSelectedResources from '../views/lessons/LessonSummaryPage/sidePanels/PreviewSelectedResources'; +import ManageSelectedResourcePanel from '../views/lessons/LessonSummaryPage/sidePanels/ManageSelectedLessonResource'; +import LessonResourceSelection from '../views/lessons/LessonSummaryPage/sidePanels/LessonResourceSelection'; import { classIdParamRequiredGuard } from './utils'; const OPTIONAL_CLASS = '/:classId?/plan'; diff --git a/kolibri/plugins/coach/assets/src/views/lessons/LessonSummaryPage/index.vue b/kolibri/plugins/coach/assets/src/views/lessons/LessonSummaryPage/index.vue index 88e8f4238c6..8ca767a6855 100644 --- a/kolibri/plugins/coach/assets/src/views/lessons/LessonSummaryPage/index.vue +++ b/kolibri/plugins/coach/assets/src/views/lessons/LessonSummaryPage/index.vue @@ -74,33 +74,6 @@ :currentAction="currentAction" @cancel="currentAction = ''" /> - - - - - - @@ -288,9 +261,6 @@ } }, }, - mounted(){ - console.log(this.route.params); - }, methods: { ...mapActions('lessonSummary', [ 'saveLessonResources', diff --git a/kolibri/plugins/coach/assets/src/views/lessons/LessonSummaryPage/sidePanels/ManageSelectedLessonResource.vue b/kolibri/plugins/coach/assets/src/views/lessons/LessonSummaryPage/sidePanels/ManageSelectedLessonResource.vue index 157e37ba1f3..b235b0017e0 100644 --- a/kolibri/plugins/coach/assets/src/views/lessons/LessonSummaryPage/sidePanels/ManageSelectedLessonResource.vue +++ b/kolibri/plugins/coach/assets/src/views/lessons/LessonSummaryPage/sidePanels/ManageSelectedLessonResource.vue @@ -7,83 +7,19 @@ @shouldFocusFirstEl="() => null" > -
- -
- -
-

{{ coreString('lessonsLabel') }} : {{ currentLesson.title }}

-

{{ $tr('sizeLabel') }} : {{ bytesForHumans(currentLesson.size) }}

- -
- - -
-
- -
-
- - - -
-
- - - - -

4MB

-
-
-
-
- - - - - - - - - -
-
-
+ @@ -40,6 +43,7 @@ import SidePanelModal from 'kolibri-common/components/SidePanelModal'; import { mapState } from 'vuex'; + import { searchAndFilterStrings } from 'kolibri-common/strings/searchAndFilterStrings'; import SelectedResource from './SelectedResource'; export default { @@ -48,6 +52,13 @@ SidePanelModal, SelectedResource }, + setup() { + const { saveLessonResources$ } = + searchAndFilterStrings; + return { + saveLessonResources$ + }; + }, computed: { ...mapState('lessonSummary', ['currentLesson', 'workingResources','resourceCache']), lessonOrderListButtonBorder(){ diff --git a/kolibri/plugins/coach/assets/src/views/lessons/LessonSummaryPage/sidePanels/SelectedResource.vue b/kolibri/plugins/coach/assets/src/views/lessons/LessonSummaryPage/sidePanels/SelectedResource.vue index 4a9882e4bc3..73b301b2dca 100644 --- a/kolibri/plugins/coach/assets/src/views/lessons/LessonSummaryPage/sidePanels/SelectedResource.vue +++ b/kolibri/plugins/coach/assets/src/views/lessons/LessonSummaryPage/sidePanels/SelectedResource.vue @@ -19,8 +19,8 @@
Date: Thu, 28 Nov 2024 01:08:05 +0300 Subject: [PATCH 08/24] fix review comments --- .../sidePanels/ManageSelectedLessonResource.vue | 9 +++++---- ...electedResource.vue => SelectedResources.vue} | 16 ++++++++++------ .../strings/searchAndFilterStrings.js | 4 ++++ 3 files changed, 19 insertions(+), 10 deletions(-) rename kolibri/plugins/coach/assets/src/views/lessons/LessonSummaryPage/sidePanels/{SelectedResource.vue => SelectedResources.vue} (93%) diff --git a/kolibri/plugins/coach/assets/src/views/lessons/LessonSummaryPage/sidePanels/ManageSelectedLessonResource.vue b/kolibri/plugins/coach/assets/src/views/lessons/LessonSummaryPage/sidePanels/ManageSelectedLessonResource.vue index 19e5b4ff4a0..85213378074 100644 --- a/kolibri/plugins/coach/assets/src/views/lessons/LessonSummaryPage/sidePanels/ManageSelectedLessonResource.vue +++ b/kolibri/plugins/coach/assets/src/views/lessons/LessonSummaryPage/sidePanels/ManageSelectedLessonResource.vue @@ -18,7 +18,7 @@ - - +
Date: Thu, 28 Nov 2024 21:07:00 +0300 Subject: [PATCH 09/24] adds a draggable --- .../assets/src/routes/planLessonsRoutes.js | 248 ------------------ .../ManageSelectedLessonResource.vue | 97 +++++-- .../sidePanels/SelectedResources.vue | 162 ++++++------ 3 files changed, 158 insertions(+), 349 deletions(-) delete mode 100644 kolibri/plugins/coach/assets/src/routes/planLessonsRoutes.js diff --git a/kolibri/plugins/coach/assets/src/routes/planLessonsRoutes.js b/kolibri/plugins/coach/assets/src/routes/planLessonsRoutes.js deleted file mode 100644 index 192ed37ddeb..00000000000 --- a/kolibri/plugins/coach/assets/src/routes/planLessonsRoutes.js +++ /dev/null @@ -1,248 +0,0 @@ -import store from 'kolibri.coreVue.vuex.store'; -import { - showLessonResourceContentPreview, - showLessonResourceSelectionRootPage, - showLessonResourceSelectionTopicPage, - showLessonSelectionContentPreview, - showLessonResourceSearchPage, - showLessonResourceBookmarks, - showLessonResourceBookmarksMain, -} from '../modules/lessonResources/handlers'; -import { showLessonSummaryPage } from '../modules/lessonSummary/handlers'; -import { LessonsPageNames } from '../constants/lessonsConstants'; -import { PageNames } from '../constants'; - -import { useLessons } from '../composables/useLessons'; - -import LessonsRootPage from '../views/lessons/LessonsRootPage'; -import LessonSummaryPage from '../views/lessons/LessonSummaryPage'; -import LessonResourceSelectionPage from '../views/lessons/LessonResourceSelectionPage'; -import PlanLessonSelectionContentPreview from '../views/lessons/LessonSelectionContentPreviewPage'; -import LessonEditDetailsPage from '../views/lessons/LessonEditDetailsPage'; -import LessonCreationPage from '../views/lessons/LessonCreationPage'; -import EditLessonDetails from '../views/lessons/LessonEditDetailsPage/EditDetailsResourceListTable.vue'; -import PreviewSelectedResources from '../views/lessons/LessonSummaryPage/sidePanels/PreviewSelectedResources'; -import ManageSelectedResourcePanel from '../views/lessons/LessonSummaryPage/sidePanels/ManageSelectedLessonResource'; -import LessonResourceSelection from '../views/lessons/LessonSummaryPage/sidePanels/LessonResourceSelection'; -import { classIdParamRequiredGuard } from './utils'; - -const OPTIONAL_CLASS = '/:classId?/plan'; -const CLASS = '/:classId/plan'; -const LESSON = '/lessons/:lessonId'; -const ALL_LESSONS = '/lessons'; -const SELECTION = '/selection'; -const TOPIC = '/topic/:topicId'; -const SEARCH = '/search/:searchTerm'; -const PREVIEW = '/preview/:contentId'; - -function path(...args) { - return args.join(''); -} - -const { showLessonsRootPage } = useLessons(); - -export default [ - { - name: LessonsPageNames.PLAN_LESSONS_ROOT, - path: path(OPTIONAL_CLASS, ALL_LESSONS), - component: LessonsRootPage, - handler(toRoute, fromRoute, next) { - if (classIdParamRequiredGuard(toRoute, PageNames.PLAN_PAGE, next)) { - return; - } - showLessonsRootPage(store, toRoute.params.classId); - }, - meta: { - titleParts: ['lessonsLabel', 'CLASS_NAME'], - }, - }, - { - name: LessonsPageNames.PLAN_LESSONS_ROOT_BETTER, - path: '/:classId/plan/lessonstemp', - component: LessonsRootPage, - handler(toRoute, fromRoute, next) { - if (classIdParamRequiredGuard(toRoute, PageNames.PLAN_PAGE, next)) { - return; - } - showLessonsRootPage(store, toRoute.params.classId); - }, - meta: { - titleParts: ['lessonsLabel', 'CLASS_NAME'], - }, - }, - { - name: LessonsPageNames.LESSON_CREATION_ROOT, - path: path(CLASS, ALL_LESSONS, '/new'), - component: LessonCreationPage, - }, - { - name: PageNames.LESSON_CREATION_ROOT_BETTER, - path: '/:classId/plan/lessonstemp/:lessonId/edit', - component: LessonCreationPage, - children: [ - { - name: PageNames.LESSON_EDIT_DETAILS, - path: 'details/', - component: EditLessonDetails, - props: { - text: 'test', - }, - }, - { - - - name: PageNames.LESSON_SELECT_RESOURCES, - path: 'select-resources/:topicId?', - component: LessonResourceSelection, - }, - { - name: PageNames.LESSON_PREVIEW_SELECTED_RESOURCES, - path: 'preview-resources/', - component: ManageSelectedResourcePanel, - }, - { - name: PageNames.LESSON_PREVIEW_RESOURCE, - path: 'preview-resources/:nodeId', - component: PreviewSelectedResources, - }, - ], - }, - { - name: LessonsPageNames.SUMMARY, - path: '/:classId/plan/lessonstemp/:lessonId/:tabId?', - component: LessonSummaryPage, - handler(toRoute, fromRoute) { - if ( - fromRoute.name !== LessonsPageNames.SUMMARY || - toRoute.params.lessonId !== fromRoute.params.lessonId - ) { - return showLessonSummaryPage(store, toRoute.params); - } - store.dispatch('notLoading'); - }, - meta: { - titleParts: ['LESSON_NAME', 'CLASS_NAME'], - }, - }, - { - name: LessonsPageNames.SUMMARY, - path: path(CLASS, LESSON), - component: LessonSummaryPage, - handler(toRoute, fromRoute) { - if ( - fromRoute.name !== LessonsPageNames.SUMMARY || - toRoute.params.lessonId !== fromRoute.params.lessonId - ) { - return showLessonSummaryPage(store, toRoute.params); - } - store.dispatch('notLoading'); - }, - meta: { - titleParts: ['LESSON_NAME', 'CLASS_NAME'], - }, - }, - { - name: LessonEditDetailsPage.name, - path: path(CLASS, LESSON, '/edit'), - component: LessonEditDetailsPage, - }, - { - name: LessonsPageNames.SELECTION_ROOT, - path: path(CLASS, LESSON, SELECTION), - component: LessonResourceSelectionPage, - handler(toRoute) { - showLessonResourceSelectionRootPage(store, toRoute.params); - }, - }, - { - name: LessonsPageNames.SELECTION, - path: path(CLASS, LESSON, SELECTION, TOPIC), - component: LessonResourceSelectionPage, - handler(toRoute, fromRoute) { - // HACK if last page was LessonContentPreviewPage, then we need to make sure - // to immediately autosave just in case a change was made there. This gets - // called whether or not a change is made, because we don't track changes - // enough steps back. - let preHandlerPromise; - if (fromRoute.name === LessonsPageNames.SELECTION_CONTENT_PREVIEW) { - preHandlerPromise = store.dispatch('lessonSummary/saveLessonResources', { - lessonId: toRoute.params.lessonId, - resources: store.state.lessonSummary.workingResources, - }); - } else { - preHandlerPromise = Promise.resolve(); - } - preHandlerPromise.then(() => { - showLessonResourceSelectionTopicPage(store, toRoute.params); - }); - }, - }, - { - name: LessonsPageNames.SELECTION_SEARCH, - path: path(CLASS, LESSON, SELECTION, SEARCH), - component: LessonResourceSelectionPage, - handler(toRoute) { - showLessonResourceSearchPage(store, toRoute.params, toRoute.query); - }, - }, - { - name: LessonsPageNames.LESSON_SELECTION_BOOKMARKS, - path: path(CLASS, LESSON, SELECTION, TOPIC), - component: LessonResourceSelectionPage, - handler(toRoute, fromRoute) { - let preHandlerPromise; - if (fromRoute.name === LessonsPageNames.SELECTION_CONTENT_PREVIEW) { - preHandlerPromise = store.dispatch('lessonSummary/saveLessonResources', { - lessonId: toRoute.params.lessonId, - resources: store.state.lessonSummary.workingResources, - }); - } else { - preHandlerPromise = Promise.resolve(); - } - preHandlerPromise.then(() => { - showLessonResourceBookmarks(store, toRoute.params, toRoute.query); - }); - }, - }, - { - name: LessonsPageNames.LESSON_SELECTION_BOOKMARKS_MAIN, - path: path(CLASS, LESSON, SELECTION), - component: LessonResourceSelectionPage, - handler(toRoute) { - showLessonResourceBookmarksMain(store, toRoute.params, toRoute.query); - }, - }, - { - name: LessonsPageNames.SELECTION_CONTENT_PREVIEW, - path: path(CLASS, LESSON, SELECTION, PREVIEW), - component: PlanLessonSelectionContentPreview, - handler(toRoute) { - showLessonSelectionContentPreview(store, toRoute.params, toRoute.query); - }, - }, - { - name: LessonsPageNames.RESOURCE_CONTENT_PREVIEW, - path: path(CLASS, LESSON, '/resource', PREVIEW), - component: PlanLessonSelectionContentPreview, - props(data) { - let backRoute; - // If linked from the Reports section, go back there - if (data.query.last === 'LessonReportEditDetailsPage') { - backRoute = { - name: 'LessonReportEditDetailsPage', - }; - } else { - backRoute = { - name: LessonsPageNames.SUMMARY, - }; - } - return { - showSelectOptions: false, - backRoute, - }; - }, - handler(toRoute) { - showLessonResourceContentPreview(store, toRoute.params); - }, - }, -]; diff --git a/kolibri/plugins/coach/assets/src/views/lessons/LessonSummaryPage/sidePanels/ManageSelectedLessonResource.vue b/kolibri/plugins/coach/assets/src/views/lessons/LessonSummaryPage/sidePanels/ManageSelectedLessonResource.vue index 85213378074..57b7b351760 100644 --- a/kolibri/plugins/coach/assets/src/views/lessons/LessonSummaryPage/sidePanels/ManageSelectedLessonResource.vue +++ b/kolibri/plugins/coach/assets/src/views/lessons/LessonSummaryPage/sidePanels/ManageSelectedLessonResource.vue @@ -7,21 +7,23 @@ @shouldFocusFirstEl="() => null" > @@ -45,6 +47,8 @@ import { mapState } from 'vuex'; import { searchAndFilterStrings } from 'kolibri-common/strings/searchAndFilterStrings'; import SelectedResources from './SelectedResources'; + import { PageNames } from '../../../../constants'; + import commonCoach from '../../../common'; export default { name:'ManageSelectedLessonResources', @@ -52,14 +56,15 @@ SidePanelModal, SelectedResources }, + mixins: [commonCoach], setup() { - const { saveLessonResources$ , } = + const { saveLessonResources$,numberOfSelectedResource$ } = searchAndFilterStrings; return { - saveLessonResources$ - + saveLessonResources$, + numberOfSelectedResource$ }; - }, + }, computed: { ...mapState('lessonSummary', ['currentLesson', 'workingResources','resourceCache']), lessonOrderListButtonBorder(){ @@ -69,17 +74,43 @@ marginTop:`0.5em` }; }, - fetchResources(){ - return this.workingResources.map(resource => { + }, + data(){ + return { + PageNames, + resources :[] + } + }, + mounted(){ + setTimeout(() => { + this.getResources(); + }, 2000); + }, + methods:{ + removeResource(id){ + this.resources = this.resources.filter(lesson => lesson.id !== id); + }, + recipients() { + return this.group + ? this.getLearnersForGroups([this.group.id]) + : this.getLearnersForLesson(this.currentLesson); + }, + getResources(){ + const response = this.workingResources.map(resource => { const content = this.resourceCache[resource.contentnode_id]; if (!content) { return this.missingResourceObj(resource.contentnode_id); } + // const tally = this.getContentStatusTally(content.content_id, this.recipients); + const tableRow = { ...content, node_id: content.id, + // hasAssignments: Object.values(tally).reduce((a, b) => a + b, 0), + // tally, }; + const link = {}; if (link) { tableRow.link = link; @@ -87,18 +118,36 @@ return tableRow; }); + + Promise.all(response).then((results) => { + this.resources = results; + }).catch((error) => { + console.error("An error occurred:", error); + }); + }, + resourceLink(resource) { + if (resource.hasAssignments) { + if (resource.kind === this.ContentNodeKinds.EXERCISE) { + return this.classRoute( + this.group + ? PageNames.GROUP_LESSON_EXERCISE_LEARNER_REPORT + : PageNames.LESSON_EXERCISE_LEARNERS_REPORT, + { exerciseId: resource.content_id }, + ); + } else { + return this.classRoute( + this.group ? PageNames.GROUPS_ROOT : PageNames.LESSON_RESOURCE_LEARNERS_REPORT, + { resourceId: resource.content_id }, + ); + } + } }, - }, - methods:{ closeSidePanel() { - this.$router.go(-2); + this.$router.push({ name: PageNames.LESSONS_ROOT , params: { classId: this.$route.params.classId }}); }, }, $trs:{ - numberOfSelectedResource: { - message: '{count, number, integer} {count, plural, one {resource selected} other {resources selected}}', - context:'Indicates the number of resources selected' - } + } } diff --git a/kolibri/plugins/coach/assets/src/views/lessons/LessonSummaryPage/sidePanels/SelectedResources.vue b/kolibri/plugins/coach/assets/src/views/lessons/LessonSummaryPage/sidePanels/SelectedResources.vue index e4a813a7bc9..ab79c3f381b 100644 --- a/kolibri/plugins/coach/assets/src/views/lessons/LessonSummaryPage/sidePanels/SelectedResources.vue +++ b/kolibri/plugins/coach/assets/src/views/lessons/LessonSummaryPage/sidePanels/SelectedResources.vue @@ -10,74 +10,88 @@

{{ coreString('lessonsLabel') }} : {{ currentLesson.title }}

{{ $tr('sizeLabel') }} : {{ bytesForHumans(currentLesson.size) }}

-
- - + -
-
- -
-
+ + +
+ + + +
+ + + +
+
+ + + + +

{{ bytesForHumans(lesson.files[0].file_size) }}

+
+
+
+
+ + - + + -
-
- - - - -

4MB

-
-
-
-
- - - - - - - - - -
-
+ + + + +
@@ -86,6 +100,9 @@ @@ -168,4 +172,4 @@ border-top: 1px solid black; } - \ No newline at end of file + diff --git a/kolibri/plugins/coach/assets/src/views/lessons/LessonSummaryPage/sidePanels/SelectedResources.vue b/kolibri/plugins/coach/assets/src/views/lessons/LessonSummaryPage/sidePanels/SelectedResources.vue index ab79c3f381b..6d82be0e20e 100644 --- a/kolibri/plugins/coach/assets/src/views/lessons/LessonSummaryPage/sidePanels/SelectedResources.vue +++ b/kolibri/plugins/coach/assets/src/views/lessons/LessonSummaryPage/sidePanels/SelectedResources.vue @@ -3,11 +3,11 @@
-
-

{{ coreString('lessonsLabel') }} : {{ currentLesson.title }}

+

{{ coreString('lessonsLabel') }} : {{ currentLesson.title }}

{{ $tr('sizeLabel') }} : {{ bytesForHumans(currentLesson.size) }}

- -
- +
+
- + -

{{ bytesForHumans(lesson.files[0].file_size) }}

+

{{ bytesForHumans(lesson.files[0].file_size) }}

- - - + - + @@ -107,79 +101,79 @@ import LearningActivityIcon from 'kolibri-common/components/ResourceDisplayAndSearch/LearningActivityIcon.vue'; import bytesForHumans from 'kolibri/uiText/bytesForHumans'; import { searchAndFilterStrings } from 'kolibri-common/strings/searchAndFilterStrings'; - + export default { - name:"SelectedResources", - components:{ + name: 'SelectedResources', + components: { DragSortWidget, DragContainer, DragHandle, Draggable, - LearningActivityIcon + LearningActivityIcon, }, - mixins:[commonCoreStrings], - setup(){ + mixins: [commonCoreStrings], + setup() { const { upLabel$, downLabel$ } = searchAndFilterStrings; return { upLabel$, - downLabel$ + downLabel$, }; }, - props:{ - resourceList:{ + props: { + resourceList: { type: Array, - required:true + required: true, + }, + currentLesson: { + type: Object, + required: true, }, - currentLesson:{ - type:Object, - required:true + loading: { + type: Boolean, + required: true, }, - loading:{ - type:Boolean, - required:true - } }, - computed:{ - lessonOrderListButtonBorder(){ + computed: { + lessonOrderListButtonBorder() { return { - borderBottom: `1px solid ${this.$themePalette.grey.v_200}`, - height:`auto`, - width:`100%` + borderBottom: `1px solid ${this.$themePalette.grey.v_200}`, + height: `auto`, + width: `100%`, }; }, }, - methods:{ - bytesForHumans + methods: { + bytesForHumans, }, - $trs:{ - sizeLabel:{ + $trs: { + sizeLabel: { message: 'Size', - context: 'Size of the lesson' + context: 'Size of the lesson', }, - } - } + }, + }; - \ No newline at end of file + + diff --git a/packages/kolibri-common/strings/searchAndFilterStrings.js b/packages/kolibri-common/strings/searchAndFilterStrings.js index fa8544ede30..7cb339ddf7a 100644 --- a/packages/kolibri-common/strings/searchAndFilterStrings.js +++ b/packages/kolibri-common/strings/searchAndFilterStrings.js @@ -40,7 +40,8 @@ export const searchAndFilterStrings = createTranslator('SearchAndFilterStrings', context: 'Button to save resources in a lesson', }, numberOfSelectedResource: { - message: '{count, number, integer} {count, plural, one {resource selected} other {resources selected}}', - context:'Indicates the number of resources selected' + message: + '{count, number, integer} {count, plural, one {resource selected} other {resources selected}}', + context: 'Indicates the number of resources selected', }, }); From 25cafe4f666c562f7f0319e2716d1371a3ff1105 Mon Sep 17 00:00:00 2001 From: Allan Otodi Opeto <103313919+AllanOXDi@users.noreply.github.com> Date: Thu, 5 Dec 2024 20:19:07 +0300 Subject: [PATCH 13/24] handles navigation --- .../ManageSelectedLessonResource.vue | 35 ++++++++++--------- .../sidePanels/SelectedResources.vue | 4 +-- 2 files changed, 20 insertions(+), 19 deletions(-) diff --git a/kolibri/plugins/coach/assets/src/views/lessons/LessonSummaryPage/sidePanels/ManageSelectedLessonResource.vue b/kolibri/plugins/coach/assets/src/views/lessons/LessonSummaryPage/sidePanels/ManageSelectedLessonResource.vue index 7850a80e30f..16e7cb76202 100644 --- a/kolibri/plugins/coach/assets/src/views/lessons/LessonSummaryPage/sidePanels/ManageSelectedLessonResource.vue +++ b/kolibri/plugins/coach/assets/src/views/lessons/LessonSummaryPage/sidePanels/ManageSelectedLessonResource.vue @@ -28,6 +28,7 @@ :currentLesson="currentLesson" :loading="resources.length === 0" @removeResource="removeResource" + @navigateToParent="navigateToParent" /> @@ -50,6 +64,11 @@ import SidePanelModal from 'kolibri-common/components/SidePanelModal'; import { mapState } from 'vuex'; import { searchAndFilterStrings } from 'kolibri-common/strings/searchAndFilterStrings'; + import commonCoreStrings from 'kolibri/uiText/commonCoreStrings'; + import { ref , getCurrentInstance, computed } from 'vue'; + import { + enhancedQuizManagementStrings, + } from 'kolibri-common/strings/enhancedQuizManagementStrings'; import { PageNames } from '../../../../constants'; import commonCoach from '../../../common'; import SelectedResources from './SelectedResources'; @@ -60,12 +79,45 @@ SidePanelModal, SelectedResources, }, - mixins: [commonCoach], + mixins: [commonCoach,commonCoreStrings], setup() { + const showModal = ref(false); + const backupResources = ref([]); + const store = getCurrentInstance().proxy.$store; + const router = getCurrentInstance().proxy.$router; + + const workingResourcePool = computed(()=> store.state.lessonSummary.workingResources); const { saveLessonResources$, numberOfSelectedResource$ } = searchAndFilterStrings; + const { + closeConfirmationTitle$, + closeConfirmationMessage$ + } = enhancedQuizManagementStrings; + + function closeModal(){ + showModal.value = false; + } + + function closeSidePanel() { + if(workingResourcePool.value !== backupResources.value){ + router.go(-1); + } + showModal.value = true; + } + + function saveResourcesCopy(){ + backupResources.value = workingResourcePool; + } + + saveResourcesCopy(); + return { saveLessonResources$, numberOfSelectedResource$, + closeConfirmationTitle$, + closeConfirmationMessage$, + showModal, + closeModal, + closeSidePanel, }; }, data() { @@ -146,12 +198,6 @@ } } }, - closeSidePanel() { - this.$router.push({ - name: PageNames.LESSONS_ROOT, - params: { classId: this.$route.params.classId }, - }); - }, }, $trs: {}, }; diff --git a/kolibri/plugins/coach/assets/src/views/lessons/LessonSummaryPage/sidePanels/SelectedResources.vue b/kolibri/plugins/coach/assets/src/views/lessons/LessonSummaryPage/sidePanels/SelectedResources.vue index 8ce6e6332a6..f816a090a3a 100644 --- a/kolibri/plugins/coach/assets/src/views/lessons/LessonSummaryPage/sidePanels/SelectedResources.vue +++ b/kolibri/plugins/coach/assets/src/views/lessons/LessonSummaryPage/sidePanels/SelectedResources.vue @@ -174,6 +174,7 @@ .resource-list-style { margin-bottom: 3.5em; + margin-top:2em; } From a9eb60122c87f217b2cc8188f6d28b1f13e30f8f Mon Sep 17 00:00:00 2001 From: Allan Otodi Opeto <103313919+AllanOXDi@users.noreply.github.com> Date: Wed, 18 Dec 2024 17:27:37 +0300 Subject: [PATCH 20/24] fixes comments --- .../ManageSelectedLessonResource.vue | 31 +++++++------------ .../sidePanels/SelectedResources.vue | 4 +-- 2 files changed, 14 insertions(+), 21 deletions(-) diff --git a/kolibri/plugins/coach/assets/src/views/lessons/LessonSummaryPage/sidePanels/ManageSelectedLessonResource.vue b/kolibri/plugins/coach/assets/src/views/lessons/LessonSummaryPage/sidePanels/ManageSelectedLessonResource.vue index 59e1c946f56..5f7ebc90259 100644 --- a/kolibri/plugins/coach/assets/src/views/lessons/LessonSummaryPage/sidePanels/ManageSelectedLessonResource.vue +++ b/kolibri/plugins/coach/assets/src/views/lessons/LessonSummaryPage/sidePanels/ManageSelectedLessonResource.vue @@ -1,7 +1,6 @@