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/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/LessonCreationPage/index.vue b/kolibri/plugins/coach/assets/src/views/plan/LessonCreationPage/index.vue index 6a1fb6da609..632d26b1d75 100644 --- a/kolibri/plugins/coach/assets/src/views/plan/LessonCreationPage/index.vue +++ b/kolibri/plugins/coach/assets/src/views/plan/LessonCreationPage/index.vue @@ -35,12 +35,16 @@ icon="back" @click="$router.go(-1)" /> - {{ $tr('numberOfSelectedResource') }} + {{ $tr('numberOfSelectedResource', { count: resourcesTable.length }) }} + - - + + @@ -57,6 +61,7 @@ import commonCoach from '../../common'; import CoachImmersivePage from '../../CoachImmersivePage'; import { LessonsPageNames } from '../../../constants/lessonsConstants'; + import { mapState } from 'vuex'; import ManageSelectedLessonResources from '../LessonResourceSelectionPage/ManageSelectedLessonResource'; export default { @@ -69,12 +74,41 @@ }, mixins: [commonCoach, commonCoreStrings], computed: { + ...mapState('classSummary', { classId: 'id' }), + ...mapState('lessonSummary', ['currentLesson', 'workingResources', 'resourceCache']), showSidePanel() { return !(this.$route.name === LessonsPageNames.LESSON_CREATION_ROOT_BETTER); }, 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); @@ -107,9 +141,31 @@ } }); }, + 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 }, + ); + } + } + }, }, $trs:{ - numberOfSelectedResource: '4 resources selected', + 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/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)" /> - diff --git a/kolibri/plugins/coach/assets/src/views/plan/LessonSummaryPage/index.vue b/kolibri/plugins/coach/assets/src/views/plan/LessonSummaryPage/index.vue index a631b73e144..7f80558c9a0 100644 --- a/kolibri/plugins/coach/assets/src/views/plan/LessonSummaryPage/index.vue +++ b/kolibri/plugins/coach/assets/src/views/plan/LessonSummaryPage/index.vue @@ -257,6 +257,9 @@ } }, }, + mounted(){ + console.log(this.route.params); + }, methods: { ...mapActions('lessonSummary', [ 'saveLessonResources',