Skip to content

Commit

Permalink
fixes routes
Browse files Browse the repository at this point in the history
  • Loading branch information
AllanOXDi committed Nov 14, 2024
1 parent 31294c8 commit 8be2963
Show file tree
Hide file tree
Showing 5 changed files with 164 additions and 88 deletions.
2 changes: 2 additions & 0 deletions kolibri/plugins/coach/assets/src/routes/planLessonsRoutes.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ export default [
},
},
{


name: PageNames.LESSON_SELECT_RESOURCES,
path: 'select-resources/:topicId?',
component: LessonResourceSelection,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,28 @@
<template>

<div>
<h1>PreviewSelectedResources</h1>
</div>
<ManageSelectedLessonResources
:lessonResourceList="resources"
:lessonObject="lessonObject"
/>

</template>


<script>
import ManageSelectedLessonResources from '../LessonResourceSelectionPage/ManageSelectedLessonResource';
export default {
name: 'PreviewSelectedResources',
components: {
ManageSelectedLessonResources,
},
data() {
return {
resources: [],
lessonObject: {},
}
},
};
</script>
Original file line number Diff line number Diff line change
@@ -1,93 +1,82 @@
<template>

<div>
<p>Lesson : Intro to chemical bond </p>
<p>{{ coreString('lessonsLabel') }} : {{ lessonObject.title }} </p>

<p>Size : 16 MB</p>
<p>{{ $tr('sizeLabel') }} : {{ bytesForHumans(lessonObject.size) }}</p>

<DragContainer
v-if="sectionOrderList.length > 0"
:items="sectionOrderList"
@sort=""
<div
v-for="(lesson , index) in resources"
:key="index"
>
<transition-group>
<Draggable
v-for="(index) in sectionOrderList"
:key="index"
>
<DragHandle>
<KGrid :style="lessonOrderListButtonBorder">
<KGridItem :layout12="{ span: 8 }">
<div style="display:flex;">
<div>
<DragSortWidget
class="drag-title"
moveUpText="up"
moveDownText="down"
:noDrag="true"
:isFirst="index === 0"
:isLast="index === sectionOrderList.length - 1"
@moveUp="() => {}"
@moveDown="() => {}"
/>
</div>
<div style="padding:0px 10px">
<span
class="drag-title"
style="flex: 1"
>
<KIcon
class="icon-style"
icon="practiceSolid"
/>
</span>
</div>
<div>
<span
class="arrange-item-block"
>
<span>
<KRouterLink
text="Metallic bond"
:to="{}"
style="font-size:14px"
/>
</span>
<p style="font-size:12px"> 0.4MB </p>
</span>
</div>
</div>
</KGridItem>


<KGridItem :layout12="{ span: 4 }">
<span
class="add-minus-button"
>
<KIcon
class="icon-style"
style="font-weight:600"
icon="emptyTopic"
/>
<KIcon
class="icon-style"
style="font-weight:600"
icon="minus"
<KGrid :style="lessonOrderListButtonBorder">
<KGridItem :layout12="{ span: 6 }">
<div style="display:flex;">
<div>
<DragSortWidget
moveUpText="up"
moveDownText="down"
:noDrag="true"
:isFirst="index === 0"
:isLast="index === resources.length - 1"
@moveUp="() => {}"
@moveDown="() => {}"
/>
</div>
<div style="padding:0px 10px">
<span
style="flex: 1"
>
<LearningActivityIcon
:kind="lesson.learning_activities[0]"
class="icon-style"
/>
</span>
</div>
<div>
<span
class="arrange-item-block"
>
<span>
<KRouterLink
v-if="lesson.link"
:text="lesson.title"
:to="lesson.link"
style="font-size:14px"
/>
</span>
</KGridItem>

</KGrid>
</DragHandle>
</Draggable>
</transition-group>
</DragContainer>
<p style="font-size:12px"> 4MB </p>
</span>
</div>
</div>
</KGridItem>


<KGridItem :layout12="{ span: 6 }">
<span
class="add-minus-button"
>
<KIconButton
icon="emptyTopic"
@click="()=>{ }"
/>

<KIconButton
icon="minus"
@click="removeResource(lesson.id)"
/>

</span>
</KGridItem>

</KGrid>
</div>

<div class="bottom-buttons-style">
<KButton
:primary="true"
text="save & finish"
@click="() => {}"
@click="()=>{ }"
/>
</div>
</div>
Expand All @@ -97,22 +86,31 @@

<script>
import Draggable from 'kolibri.coreVue.components.Draggable';
import DragContainer from 'kolibri.coreVue.components.DragContainer';
import DragHandle from 'kolibri.coreVue.components.DragHandle';
import DragSortWidget from 'kolibri.coreVue.components.DragSortWidget';
import commonCoreStrings from 'kolibri.coreVue.mixins.commonCoreStrings';
import LearningActivityIcon from 'kolibri-common/components/ResourceDisplayAndSearch/LearningActivityIcon.vue';
import bytesForHumans from 'kolibri.utils.bytesForHumans';
export default {
name:'ManageSelectedLessonResources',
components: {
Draggable,
DragContainer,
DragHandle,
DragSortWidget,
LearningActivityIcon
},
mixins:[commonCoreStrings],
props:{
lessonResourceList:{
type: Array,
required:true
},
lessonObject:{
type: Object,
required:true
},
},
data(){
return {
sectionOrderList:[ 1,2,3,4,5]
resources: this.lessonResourceList,
}
},
computed: {
Expand All @@ -123,6 +121,19 @@
marginTop:`0.5em`
};
},
},
methods:{
removeResource(id){
this.resources = this.resources.filter((lesson) => lesson.id !== id);
},
bytesForHumans,
},
$trs:{
sizeLabel:{
message: 'Size',
context: 'Size of the lesson'
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,13 @@
</KPageContainer>

<BottomAppBar>
<KRouterLink
:text="$tr('numbeOfSelectedResourcesLabel', { count: workingResources.length })"
:primary="true"
:to="goToPreviewSelection()"
:style="{ marginRight: '1em' , marginTop: '0.5em' }"
/>

<KRouterLink
:text="bottomBarButtonText"
:primary="true"
Expand Down Expand Up @@ -125,7 +132,7 @@
import CoachAppBarPage from '../../CoachAppBarPage';
import CoachImmersivePage from '../../CoachImmersivePage';
import { LessonsPageNames } from '../../../constants/lessonsConstants';
import { ViewMoreButtonStates } from '../../../constants/index';
import { ViewMoreButtonStates, PageNames } from '../../../constants/index';
import LessonsSearchBox from './SearchTools/LessonsSearchBox';
import LessonsSearchFilters from './SearchTools/LessonsSearchFilters';
import ResourceSelectionBreadcrumbs from './SearchTools/ResourceSelectionBreadcrumbs';
Expand Down Expand Up @@ -555,12 +562,20 @@
topicsLink(topicId) {
return this.topicListingLink({ ...this.$route.params, topicId });
},
goToPreviewSelection(){
return{
name: PageNames.LESSON_PREVIEW_SELECTED_RESOURCES
}
}
},
$trs: {
resources: {
message: '{count} {count, plural, one {resource} other {resources}}',
context: "Only translate 'resource' and 'resources'.",
},
numbeOfSelectedResourcesLabel:{
message:'{count, number, integer} {count, plural, one {resource selected} other {resources selected}} '
},
selectionInformation: {
message:
'{count, number, integer} of {total, number, integer} {total, plural, one {resource selected} other {resources selected}}',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,33 @@
:currentAction="currentAction"
@cancel="currentAction = ''"
/>

<SidePanelModal
v-if="false"
ref="resourcePanel"
alignment="right"
sidePanelWidth="700px"
closeButtonIconType="close"
@closePanel="() => $router.go(-1)"
@shouldFocusFirstEl="() => null"
>
<template #header>
<KIconButton
v-if="true"
icon="back"
@click="$router.go(-1)"
/>
<span :style="{ fontWeight: '600' }">
{{ $tr('numberOfSelectedResource', { count: resourcesTable.length }) }}
</span>
</template>
<router-view @closePanel="() => $router.go(-1)" />
<ManageSelectedLessonResources
:lessonResourceList="resourcesTable"
:lessonObject="currentLesson"
@handleSavingResources="showSidePanel === false"
/>
</SidePanelModal>
</KPageContainer>
</KGridItem>
</KGrid>
Expand All @@ -87,13 +114,15 @@
import sortBy from 'lodash/sortBy';
import { mapState, mapActions, mapMutations } from 'vuex';
import SidePanelModal from 'kolibri-common/components/SidePanelModal';
import commonCoreStrings from 'kolibri.coreVue.mixins.commonCoreStrings';
import useSnackbar from 'kolibri.coreVue.composables.useSnackbar';
import commonCoach from '../../common';
import CoachAppBarPage from '../../CoachAppBarPage';
import ReportsControls from '../../reports/ReportsControls';
import { selectionRootLink } from '../../../routes/planLessonsRouterUtils';
import { LessonsPageNames } from '../../../constants/lessonsConstants';
import ManageSelectedLessonResources from '../LessonResourceSelectionPage/ManageSelectedLessonResource';
import { REPORTS_LESSON_TABS_ID, ReportsLessonTabs } from '../../../constants/tabsConstants';
import ReportsLessonResourcesTable from '../../reports/ReportsLessonResourcesTable';
import ReportsLessonLearnersTable from '../../reports/ReportsLessonLearnersTable';
Expand All @@ -116,6 +145,8 @@
LessonOptionsDropdownMenu,
ReportsLessonLearnersTable,
ReportsLessonResourcesTable,
ManageSelectedLessonResources,
SidePanelModal
},
mixins: [commonCoach, commonCoreStrings],
setup() {
Expand All @@ -130,6 +161,7 @@
ReportsLessonTabs,
workingResourcesBackup,
REPORTS_LESSON_TABS_ID,
showSidePanel:true,
};
},
computed: {
Expand Down Expand Up @@ -326,6 +358,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'
}
},
};
Expand Down

0 comments on commit 8be2963

Please sign in to comment.