Skip to content

Commit

Permalink
clean ups importations
Browse files Browse the repository at this point in the history
  • Loading branch information
AllanOXDi committed Nov 22, 2024
1 parent e18471f commit 4fa945b
Show file tree
Hide file tree
Showing 6 changed files with 198 additions and 197 deletions.
20 changes: 10 additions & 10 deletions kolibri/plugins/coach/assets/src/routes/planLessonsRoutes.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,33 +74,6 @@
: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 Down Expand Up @@ -288,9 +261,6 @@
}
},
},
mounted(){
console.log(this.route.params);
},
methods: {
...mapActions('lessonSummary', [
'saveLessonResources',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,83 +7,19 @@
@shouldFocusFirstEl="() => null"
>
<template #header>
<h4 class="side-panel-title"> {{ $tr('numberOfSelectedResource',{ count : resourcesTable.length })}}</h4>
<router-view @closePanel="() => $router.go(-1)" />
<KIconButton
v-if="true"
icon="back"
@click="$router.go(-1)"
/>
<span :style="{ fontWeight: '600' }" class="side-panel-title"> {{ $tr('numberOfSelectedResource',{ count : fetchResources.length })}}</span>
</template>

<div v-if="resourcesTable.length === 0">
<KCircularLoader />
</div>

<div v-else>
<p>{{ coreString('lessonsLabel') }} : {{ currentLesson.title }} </p>
<p>{{ $tr('sizeLabel') }} : {{ bytesForHumans(currentLesson.size) }}</p>

<div
v-for="(lesson , index) in resourcesTable"
:key="index"
>
<KGrid :style="lessonOrderListButtonBorder">
<KGridItem :layout12="{ span: 6 }">
<div style="display:flex;">
<div>
<DragSortWidget
moveUpText="up"
moveDownText="down"
:noDrag="true"
:isFirst="index === 0"
:isLast="index === resourcesTable.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>
<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>
<SelectedResource
:resourceList="fetchResources"
:currentLesson="currentLesson"
:loading="fetchResources.length === 0"
/>


<template #bottomNavigation>
Expand All @@ -102,37 +38,26 @@

<script>
import DragSortWidget from 'kolibri-common/components/sortable/DragSortWidget';
import commonCoreStrings from 'kolibri/uiText/commonCoreStrings';
import LearningActivityIcon from 'kolibri-common/components/ResourceDisplayAndSearch/LearningActivityIcon.vue';
import bytesForHumans from 'kolibri/uiText/bytesForHumans';
import SidePanelModal from 'kolibri-common/components/SidePanelModal';
import { mapState } from 'vuex';
import SelectedResource from './SelectedResource';
export default {
name:'ManageSelectedLessonResources',
components: {
DragSortWidget,
LearningActivityIcon,
SidePanelModal
},
mixins:[commonCoreStrings],
data(){
return {
resources: [],
isLoading:false,
}
SidePanelModal,
SelectedResource
},
computed: {
...mapState('lessonSummary', ['currentLesson', 'workingResources','resourceCache']),
lessonOrderListButtonBorder(){
return {
borderBottom: `1px solid ${this.$themePalette.grey.v_200}`,
borderBottom: `1px solid ${this.$themePalette.grey.v_200}`,
height:`4em`,
marginTop:`0.5em`
};
},
resourcesTable(){
fetchResources(){
return this.workingResources.map(resource => {
const content = this.resourceCache[resource.contentnode_id];
if (!content) {
Expand All @@ -149,23 +74,21 @@
}
return tableRow;
})
});
},
},
mounted(){
setTimeout(() => {
console.log(this.currentLesson);
}, 1000);
},
methods:{
removeResource(id){
this.resources = this.resources.filter((lesson) => lesson.id !== id);
},
closeSidePanel() {
this.$router.go(-2);
},
bytesForHumans,
},
$trs:{
sizeLabel:{
message: 'Size',
context: 'Size of the lesson'
},
numberOfSelectedResource: {
message: '{count, number, integer} {count, plural, one {resource selected} other {resources selected}}',
context:'Indicates the number of resources selected'
Expand All @@ -178,15 +101,6 @@

<style scoped>
.add-minus-button{
float:right;
}
.arrange-item-block{
display:block;
}
.icon-style{
font-size:24px;
}
.bottom-buttons-style {
position: absolute;
right: 0;
Expand Down
Loading

0 comments on commit 4fa945b

Please sign in to comment.