Skip to content

Commit

Permalink
fixes the routing issue
Browse files Browse the repository at this point in the history
  • Loading branch information
AllanOXDi committed Nov 18, 2024
1 parent 8be2963 commit 64c274c
Show file tree
Hide file tree
Showing 5 changed files with 85 additions and 6 deletions.
3 changes: 2 additions & 1 deletion kolibri/plugins/coach/assets/src/routes/planLessonsRoutes.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -97,7 +98,7 @@ export default [
{
name: PageNames.LESSON_PREVIEW_SELECTED_RESOURCES,
path: 'preview-resources/',
component: PreviewSelectedResources,
component: ManageSelectedResourcePanel,
},
{
name: PageNames.LESSON_PREVIEW_RESOURCE,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<template>


<div>

</div>

</template>


<script>
export default {
name: 'ManageSelectedResource',
};
</script>


Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,16 @@
icon="back"
@click="$router.go(-1)"
/>
<span style="font-weight:600">{{ $tr('numberOfSelectedResource') }} </span>
<span style="font-weight:600">{{ $tr('numberOfSelectedResource', { count: resourcesTable.length }) }}</span>
</template>

<router-view @closePanel="() => $router.go(-1)" />
<ManageSelectedLessonResources />


<ManageSelectedLessonResources
:lessonResourceList="resourcesTable"
:lessonObject="currentLesson"
/>

</SidePanelModal>
</CoachImmersivePage>

Expand All @@ -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 {
Expand All @@ -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);
Expand Down Expand Up @@ -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'
}
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@
icon="minus"
@click="removeResource(lesson.id)"
/>

</span>
</KGridItem>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,9 @@
}
},
},
mounted(){
console.log(this.route.params);
},
methods: {
...mapActions('lessonSummary', [
'saveLessonResources',
Expand Down

0 comments on commit 64c274c

Please sign in to comment.