Skip to content
Snippets Groups Projects
Commit 11892d1f authored by Julian's avatar Julian
Browse files

Reformat

parent 80358342
No related branches found
No related tags found
2 merge requests!352Draft: Resolve "Add dialog with each lesson's students",!350Resolve "Add simple course book list"
Pipeline #174439 failed
......@@ -37,11 +37,18 @@
/>
</template>
<template #default="{ items }">
<v-list-item v-for="day in groupDocsByDay(items)" two-line>
<v-list-item
v-for="day in groupDocsByDay(items)"
two-line
:key="'day-' + day[0]"
>
<v-list-item-content :id="'documentation_' + day[0].toISODate()">
<v-list-item-title>{{ $d(day[0], "short") }}</v-list-item-title>
<v-list max-width="100%">
<v-list-item v-for="doc in day.slice(1)">
<v-list-item
v-for="doc in day.slice(1)"
:key="'documentation-' + doc.id"
>
<documentation-modal
:documentation="doc"
:affected-query="lastQuery"
......@@ -146,7 +153,9 @@ export default {
objId: this.objId ? Number(this.objId) : null,
objType: this.objType?.toUpperCase(),
dateStart: this.dateStart ?? this.date,
dateEnd: this.dateEnd ?? DateTime.fromISO(this.date).plus({ weeks: 1 }).toISODate(),
dateEnd:
this.dateEnd ??
DateTime.fromISO(this.date).plus({ weeks: 1 }).toISODate(),
};
},
selectable() {
......@@ -205,9 +214,10 @@ export default {
const dateEndParsed = DateTime.fromISO(this.dateEnd);
const dateParsed = DateTime.fromISO(this.date);
const newDate = direction === "prev" ?
dateParsed.minus({ days: 1 }) :
dateParsed.plus({ days: 1 });
const newDate =
direction === "prev"
? dateParsed.minus({ days: 1 })
: dateParsed.plus({ days: 1 });
/*
TODO:
......@@ -234,25 +244,26 @@ export default {
});
// Define the function to find the nearest ID
const ids = Array.from(document.querySelectorAll("[id^='documentation_']")).map((el) => el.id);
const ids = Array.from(
document.querySelectorAll("[id^='documentation_']"),
).map((el) => el.id);
// TODO: This should only be done after loading the new data
const nearestId = this.findNearestId(newDate, direction, ids);
this.$vuetify.goTo("#" + nearestId);
},
findNearestId(targetDate, direction, ids) {
const sortedIds = (ids
const sortedIds = ids
.map((id) => DateTime.fromISO(id.split("_")[1]))
.sort(
(a, b) => a - b,
));
.sort((a, b) => a - b);
if (direction === "prev") {
sortedIds.reverse();
}
const nearestId = sortedIds.find(id =>
direction === "next" ? id >= targetDate : id <= targetDate
const nearestId =
sortedIds.find((id) =>
direction === "next" ? id >= targetDate : id <= targetDate,
) || sortedIds[sortedIds.length - 1];
return "documentation_" + nearestId.toISODate();
......@@ -260,7 +271,9 @@ export default {
},
mounted() {
this.dateStart = this.date;
this.dateEnd = DateTime.fromISO(this.dateStart).plus({ weeks: 1 }).toISODate();
this.dateEnd = DateTime.fromISO(this.dateStart)
.plus({ weeks: 1 })
.toISODate();
},
};
</script>
......@@ -30,7 +30,7 @@ export default {
return {
PREV: "prev",
NEXT: "next",
}
};
},
methods: {
/**
......@@ -40,9 +40,15 @@ export default {
this.$emit("click", direction);
this.$emit(direction);
if (direction === this.PREV) {
this.$emit("input", DateTime.fromISO(this.value).minus({ days: 1 }).toISODate());
this.$emit(
"input",
DateTime.fromISO(this.value).minus({ days: 1 }).toISODate(),
);
} else {
this.$emit("input", DateTime.fromISO(this.value).plus({ days: 1 }).toISODate());
this.$emit(
"input",
DateTime.fromISO(this.value).plus({ days: 1 }).toISODate(),
);
}
},
},
......
<template>
<div>
<v-list-item v-for="_ in 10">
<v-list-item v-for="i in 10" :key="'i-' + i">
<v-list-item-content>
<v-list-item-title>
<v-skeleton-loader type="heading" />
</v-list-item-title>
<v-list max-width="100%">
<v-list-item v-for="_ in 5">
<v-list-item v-for="j in 5" :key="'j-' + j">
<DocumentationLoader />
</v-list-item>
</v-list>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment