mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-06-01 12:19:28 +00:00
access computed grade phrase defensive; avoid pushing redundant mode changes; replace current state with new params when a different day is selected in the current month -> beforeEnter guard creates redundant navigation history entry which is currently being blocked but produces the possibility to infinitely "rego forward";
This commit is contained in:
@@ -198,6 +198,16 @@ const router = VueRouter.createRouter({
|
||||
]
|
||||
})
|
||||
|
||||
router.beforeEach((to, from) => {
|
||||
// this avoids redundant routing navigation in place due to router.replace on a route with param function and
|
||||
// beforeEnter navigation guard
|
||||
|
||||
// TODO: manage the infinite forward navigation issue somehow
|
||||
if (to.fullPath === from.fullPath) {
|
||||
return false
|
||||
}
|
||||
})
|
||||
|
||||
const app = Vue.createApp({
|
||||
name: 'FhcApp',
|
||||
data: () => ({
|
||||
|
||||
@@ -21,7 +21,9 @@ export default {
|
||||
lvinfo: Boolean,
|
||||
benotung: Boolean,
|
||||
lvnote: String,
|
||||
lvnotebez: Array,
|
||||
znote: String,
|
||||
znotebez: Array,
|
||||
studiengang_kuerzel: String,
|
||||
semester: [String, Number],
|
||||
orgform_kurzbz: String,
|
||||
@@ -67,7 +69,11 @@ export default {
|
||||
},
|
||||
grade() {
|
||||
const languageIndex = this.$p.user_language.value === 'English' ? 1 : 0
|
||||
return this.benotung ? this.znotebez[languageIndex] || this.lvnotebez[languageIndex] || null : null;
|
||||
if(this.benotung && this.znotebez?.length) {
|
||||
return this.znotebez[languageIndex]
|
||||
} else if(this.benotung && this.lvnotebez?.length) {
|
||||
return this.lvnotebez[languageIndex]
|
||||
} else return null
|
||||
},
|
||||
LvHasPruefungenInformation(){
|
||||
return this.pruefungenData && this.pruefungenData.length > 0;
|
||||
|
||||
@@ -11,7 +11,7 @@ const Stundenplan = {
|
||||
data() {
|
||||
return {
|
||||
events: null,
|
||||
calendarMode: DEFAULT_MODE_STUNDENPLAN,
|
||||
calendarMode: this.propsViewData?.mode ?? DEFAULT_MODE_STUNDENPLAN,
|
||||
calendarDate: new CalendarDate(new Date()),
|
||||
eventCalendarDate: new CalendarDate(new Date()),
|
||||
currentlySelectedEvent: null,
|
||||
@@ -60,6 +60,7 @@ const Stundenplan = {
|
||||
if(this.$refs.calendar) this.$refs.calendar.setMode(newVal)
|
||||
},
|
||||
'propsViewData.focus_date'(newVal) {
|
||||
// todo: navigate around with date in current mode
|
||||
this.currentDate = new Date(newVal)
|
||||
}
|
||||
},
|
||||
@@ -119,8 +120,11 @@ const Stundenplan = {
|
||||
String(day.getMonth() + 1).padStart(2, "0") + "-" +
|
||||
String(day.getDate()).padStart(2, "0");
|
||||
const capitalizedMode = this.calendarMode[0].toUpperCase() + this.calendarMode.slice(1);
|
||||
const isMonthMode = capitalizedMode === 'Month'
|
||||
const isInCurrentMonth = day.getMonth() == this.currentDay.getMonth()
|
||||
|
||||
this.$router.push({
|
||||
if(isMonthMode && isInCurrentMonth) {
|
||||
this.$router.replace({
|
||||
name: "Stundenplan",
|
||||
params: {
|
||||
mode: capitalizedMode,
|
||||
@@ -128,6 +132,16 @@ const Stundenplan = {
|
||||
lv_id: this.propsViewData?.lv_id || null
|
||||
}
|
||||
})
|
||||
} else {
|
||||
this.$router.push({
|
||||
name: "Stundenplan",
|
||||
params: {
|
||||
mode: capitalizedMode,
|
||||
focus_date: date,
|
||||
lv_id: this.propsViewData?.lv_id || null
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
this.currentDay = day;
|
||||
},
|
||||
@@ -141,7 +155,7 @@ const Stundenplan = {
|
||||
const date = this.currentDay.getFullYear() + "-" +
|
||||
String(this.currentDay.getMonth() + 1).padStart(2, "0") + "-" +
|
||||
String(this.currentDay.getDate()).padStart(2, "0");
|
||||
|
||||
|
||||
this.$router.push({
|
||||
name: "Stundenplan",
|
||||
params: {
|
||||
@@ -153,10 +167,11 @@ const Stundenplan = {
|
||||
},
|
||||
handleChangeMode(mode) {
|
||||
let m = mode[0].toUpperCase() + mode.slice(1)
|
||||
if(m === this.calendarMode) return
|
||||
const date = this.currentDay.getFullYear() + "-" +
|
||||
String(this.currentDay.getMonth() + 1).padStart(2, "0") + "-" +
|
||||
String(this.currentDay.getDate()).padStart(2, "0");
|
||||
|
||||
|
||||
this.$router.push({
|
||||
name: "Stundenplan",
|
||||
params: {
|
||||
@@ -238,7 +253,7 @@ const Stundenplan = {
|
||||
.then(data=>{
|
||||
this.uid = data.uid;
|
||||
})
|
||||
|
||||
|
||||
},
|
||||
beforeUnmount() {
|
||||
if(this.$refs.lvmodal) this.$refs.lvmodal.hide()
|
||||
@@ -275,7 +290,7 @@ const Stundenplan = {
|
||||
</div>
|
||||
</template>
|
||||
<template #monthPage="{event,day}">
|
||||
<div>
|
||||
<div @click="showModal($event, event)">
|
||||
<span class="fhc-entry">
|
||||
{{event.topic}}
|
||||
</span>
|
||||
|
||||
Reference in New Issue
Block a user