Skip to content

Commit

Permalink
updates branch with lastest code
Browse files Browse the repository at this point in the history
  • Loading branch information
AllanOXDi committed Nov 20, 2024
1 parent dd354ca commit 3648fc5
Show file tree
Hide file tree
Showing 9 changed files with 265 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
>
<div class="move-handle">
<DragSortWidget
:moveUpText="()=>$tr('moveResourceUpButtonDescription')"
:moveDownText="()=> $tr('moveResourceDownButtonDescription')"
:moveUpText="()=>moveResourceUpButtonDescription$()"
:moveDownText="()=>moveResourceDownButtonDescription$()"
:isFirst="index === 0"
:isLast="index === resourceListItems.length - 1"
@moveUp="moveUpOne(index)"
Expand Down Expand Up @@ -112,6 +112,7 @@
import useSnackbar from 'kolibri/composables/useSnackbar';
import { coachStrings } from '../../common/commonCoachStrings';
import { PageNames } from '../../../constants';
import { searchAndFilterStrings } from 'kolibri-common/strings/searchAndFilterStrings';
// This is a simplified version of ResourceListTable that is supposed to work
// outside of the LessonSummaryPage workflow.
Expand All @@ -129,11 +130,15 @@
setup() {
const { createSnackbar, clearSnackbar } = useSnackbar();
const { noResourcesInLessonLabel$ } = coachStrings;
const { moveResourceUpButtonDescription$, moveResourceDownButtonDescription$ } =
searchAndFilterStrings;
return {
PageNames,
noResourcesInLessonLabel$,
createSnackbar,
clearSnackbar,
moveResourceUpButtonDescription$,
moveResourceDownButtonDescription$
};
},
props: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
<!-- Mousedown.prevent is needed to avoid user selection -->
<DragSortWidget
class="sort-widget"
:moveUpText="()=>$tr('moveResourceUpButtonDescription')"
:moveDownText="()=>$tr('moveResourceDownButtonDescription')"
:moveUpText="()=>moveResourceUpButtonDescription$()"
:moveDownText="()=>moveResourceDownButtonDescription$()"
:isFirst="index === 0"
:isLast="index === entries.length - 1"
@moveUp="moveUpOne(index)"
Expand Down Expand Up @@ -94,6 +94,7 @@
import DragContainer from 'kolibri-common/components/sortable/DragContainer';
import DragHandle from 'kolibri-common/components/sortable/DragHandle';
import DragSortWidget from 'kolibri-common/components/sortable/DragSortWidget';
import { searchAndFilterStrings } from 'kolibri-common/strings/searchAndFilterStrings';
import Draggable from 'kolibri-common/components/sortable/Draggable';
import CSVExporter from '../../../../csv/exporter';
import * as csvFields from '../../../../csv/fields';
Expand All @@ -112,6 +113,15 @@
Draggable,
},
mixins: [coachStringsMixin, commonCoreStrings],
setup() {
const { moveResourceUpButtonDescription$, moveResourceDownButtonDescription$ } =
searchAndFilterStrings;
return {
moveResourceUpButtonDescription$,
moveResourceDownButtonDescription$
}
},
props: {
title: {
type: String,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,179 @@
<template>

<div>
<p>{{ coreString('lessonsLabel') }} : {{ lessonObject.title }} </p>

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

<div
v-for="(lesson , index) in resources"
:key="index"
>
<KGrid :style="lessonOrderListButtonBorder">
<KGridItem :layout12="{ span: 6 }">
<div style="display:flex;">
<div>
<DragSortWidget
:moveUpText="()=> upLabel$()"
:moveDownText="()=> downLabel$()"
: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>
<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="()=>{ }"
/>
</div>
</div>

</template>


<script>
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';
import { searchAndFilterStrings } from 'kolibri-common/strings/searchAndFilterStrings';
export default {
name:'ManageSelectedLessonResources',
components: {
DragSortWidget,
LearningActivityIcon
},
mixins:[commonCoreStrings],
setup(){
const {
upLabel$,
downLabel$,
} = searchAndFilterStrings;
return {
upLabel$,
downLabel$,
}
},
props:{
lessonResourceList:{
type: Array,
required:true
},
lessonObject:{
type: Object,
required:true
},
},
data(){
return {
resources: this.lessonResourceList,
}
},
computed: {
lessonOrderListButtonBorder(){
return {
borderBottom: `1px solid ${this.$themePalette.grey.v_200}`,
height:`4em`,
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'
}
}
}
</script>


<style scoped>
.add-minus-button{
float:right;
}
.arrange-item-block{
display:block;
}
.icon-style{
font-size:24px;
}
.bottom-buttons-style {
position: absolute;
right: 0;
bottom: 0;
left: 0;
padding: 1em;
margin-top: 1em;
text-align: right;
background-color: #ffffff;
border-top: 1px solid black;
}
</style>
Original file line number Diff line number Diff line change
Expand Up @@ -245,8 +245,8 @@
<div>
<DragSortWidget
class="sort-widget"
:moveUpText="()=> upLabel()"
:moveDownText="()=> downLabel()"
:moveUpText="()=> upLabel$()"
:moveDownText="()=>downLabel$()"
:noDrag="true"
:isFirst="index === 0"
:isLast="index === activeQuestions.length - 1"
Expand Down Expand Up @@ -327,6 +327,7 @@
import { MAX_QUESTIONS_PER_QUIZ_SECTION } from 'kolibri/constants';
import AccordionItem from 'kolibri-common/components/accordion/AccordionItem';
import AccordionContainer from 'kolibri-common/components/accordion/AccordionContainer';
import { searchAndFilterStrings } from 'kolibri-common/strings/searchAndFilterStrings';
import useSnackbar from 'kolibri/composables/useSnackbar';
import { injectQuizCreation } from '../../../composables/useQuizCreation';
import commonCoach from '../../common';
Expand Down Expand Up @@ -371,6 +372,8 @@
questionDeletionConfirmation$,
} = enhancedQuizManagementStrings;
const { upLabel$, downLabel$ } = searchAndFilterStrings;
const {
// Methods
updateSection,
Expand Down Expand Up @@ -446,6 +449,8 @@
selectedActiveQuestions,
createSnackbar,
upLabel$,
downLabel$
};
},
data() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
>
<DragSortWidget
class="drag-title"
:moveUpText="()=> upLabel()"
:moveDownText="()=> downLabel()"
:moveUpText="()=> upLabel$()"
:moveDownText="()=> downLabel$()"
:noDrag="true"
:isFirst="index === 0"
:isLast="index === sectionOrderList.length - 1"
Expand Down Expand Up @@ -100,6 +100,7 @@
import DragSortWidget from 'kolibri-common/components/sortable/DragSortWidget';
import { PageNames } from '../../../constants/index';
import { injectQuizCreation } from '../../../composables/useQuizCreation';
import { searchAndFilterStrings } from 'kolibri-common/strings/searchAndFilterStrings';
import useDrag from './useDrag.js';
export default {
Expand Down Expand Up @@ -146,6 +147,11 @@
updateQuiz,
} = injectQuizCreation();
const {
upLabel$,
downLabel$,
} = searchAndFilterStrings;
const { moveDownOne, moveUpOne } = useDrag();
const showCloseConfirmation = ref(false);
Expand Down Expand Up @@ -230,6 +236,8 @@
randomizedLabel$,
randomizedOptionDescription$,
fixedLabel$,
upLabel$,
downLabel$,
fixedOptionDescription$,
};
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@
>
<DragSortWidget
class="sort-widget"
:moveUpText="()=>$tr('upLabel', { name: channel.name })"
:moveDownText="()=>$tr('downLabel', { name: channel.name })"
:moveUpText="() => moveChannelUpLabel$({ name: channel.name })"
:moveDownText="() => moveChanneldownLabel$({ name: channel.name })"
:isFirst="index === 0"
:isLast="index === channels.length - 1"
@moveUp="shiftOne(index, -1)"
Expand Down Expand Up @@ -72,6 +72,7 @@
import DeviceChannelResource from '../apiResources/deviceChannel';
import useContentTasks from '../composables/useContentTasks';
import { PageNames } from '../constants';
import { searchAndFilterStrings } from 'kolibri-common/strings/searchAndFilterStrings';
export default {
name: 'RearrangeChannelsPage',
Expand All @@ -91,10 +92,16 @@
useContentTasks();
const { canManageContent } = useUser();
const { createSnackbar } = useSnackbar();
const{
moveChannelUpLabel$,
moveChanneldownLabel$
} = searchAndFilterStrings;
return {
canManageContent,
createSnackbar,
moveChannelUpLabel$,
moveChanneldownLabel$
};
},
data() {
Expand Down
Loading

0 comments on commit 3648fc5

Please sign in to comment.