mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-20 00:12:15 +00:00
Merge branch 'feature-53416/stundenplan_eine_lva' into feature-25999/C4_cleanup
This commit is contained in:
@@ -6,19 +6,63 @@ export default {
|
||||
required:true,
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
sanitizeLegacyTables(table) {
|
||||
|
||||
// find nested tables and replace with p element
|
||||
const tt = table.querySelectorAll('table')
|
||||
tt.forEach(t => {
|
||||
const textContent = t.textContent.trim();
|
||||
const pElement = document.createElement('p');
|
||||
pElement.textContent = textContent;
|
||||
t.parentNode.replaceChild(pElement, t);
|
||||
})
|
||||
|
||||
// find unordered lists, traverse li childs and replace with p element -> more readable than 1 p tag for ul
|
||||
const ul = table.querySelectorAll('ul')
|
||||
ul.forEach(u => {
|
||||
Array.from(u.children).forEach(li => {
|
||||
const p = document.createElement('p');
|
||||
p.textContent = li.textContent
|
||||
u.parentNode.appendChild(p)
|
||||
})
|
||||
u.parentNode.removeChild(u)
|
||||
|
||||
})
|
||||
|
||||
// find bare text nodes and put into p element
|
||||
const td = Array.from(table.querySelectorAll('td')).filter(el => el.scrollWidth > 200)
|
||||
td.forEach(element => {
|
||||
if (element.firstChild?.nodeType === Node.TEXT_NODE && element.firstChild.length > 10) {
|
||||
const div = document.createElement('p');
|
||||
div.appendChild(element.firstChild)
|
||||
element.appendChild(div);
|
||||
}
|
||||
});
|
||||
|
||||
// let p elements wrap on overflow
|
||||
const p = table.querySelectorAll('p')
|
||||
p.forEach(p => {
|
||||
p.style.setProperty('word-wrap', 'break-word');
|
||||
p.style.setProperty('white-space', 'normal');
|
||||
})
|
||||
}
|
||||
},
|
||||
mounted(){
|
||||
|
||||
// replaces the tablesorter with the tabulator
|
||||
let tables = document.getElementsByClassName("tablesorter");
|
||||
|
||||
|
||||
for (let table of tables) {
|
||||
this.sanitizeLegacyTables(table)
|
||||
new Tabulator(table, {
|
||||
layout: "fitDataStretch",
|
||||
layout: "fitDataFill",
|
||||
|
||||
columnDefaults: {
|
||||
formatter: "html",
|
||||
resizable: false,
|
||||
resizable: true,
|
||||
minWidth: "100px",
|
||||
maxWidth: "400px"
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -124,7 +124,7 @@ export default {
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
<fhc-searchbar @showSettings="toggleCollapsibles" ref="searchbar" id="nav-search" class="fhc-searchbar w-100" :searchoptions="searchbaroptions" :searchfunction="searchfunction" :selectedtypes="selectedtypes"></fhc-searchbar>
|
||||
<a id="nav-logo" class="d-none d-sm-block" :href="rootUrl">
|
||||
<a id="nav-logo" class="d-none d-lg-block" :href="rootUrl">
|
||||
<img :src="logoUrl" alt="Logo">
|
||||
</a>
|
||||
<div id="nav-user">
|
||||
|
||||
@@ -30,13 +30,14 @@ export default {
|
||||
},
|
||||
computed: {
|
||||
allEventsGrouped() {
|
||||
// groups all events of all days until end of week together
|
||||
// groups all events of the next 7 days together
|
||||
const currentCalendarDate = new CalendarDate(this.currentDay)
|
||||
const mapArr = currentCalendarDate.wholeWorkWeek.map((d) => [new CalendarDate(d), []])
|
||||
const mapArr = currentCalendarDate.nextSevenDays.map((d) => [new CalendarDate(d), []])
|
||||
|
||||
return new Map((this.events || []).filter(evt => evt.end < currentCalendarDate.lastDayOfWeek && evt.start >= currentCalendarDate.firstDayOfWeek).reduce((acc, cur) => {
|
||||
return new Map((this.events || []).filter(evt => evt.start >= this.currentDay).reduce((acc, cur) => {
|
||||
const date = new CalendarDate(new Date(cur.datum))
|
||||
const arr = acc.find(el => el[0].compare(date))
|
||||
if(!arr) return acc
|
||||
arr[1].push(cur)
|
||||
|
||||
return acc
|
||||
@@ -54,7 +55,7 @@ export default {
|
||||
return this.calendarDateToString(this.calendarDate.cdFirstDayOfCalendarMonth);
|
||||
},
|
||||
monthLastDay: function () {
|
||||
return this.calendarDateToString(this.calendarDate.cdLastDayOfCalendarMonth);
|
||||
return this.calendarDateToString(this.calendarDate.cdLastDayOfNextCalendarMonth);
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
|
||||
@@ -96,6 +96,18 @@ class CalendarDate {
|
||||
let lastDayOfMonth = new Date(this.y, this.m+1, 0);
|
||||
return new CalendarDate(lastDayOfMonth.getFullYear(), lastDayOfMonth.getMonth(), lastDayOfMonth.getDate()+6-(lastDayOfMonth.getDay() + 7 - this.weekStart)%7);
|
||||
}
|
||||
get cdLastDayOfNextCalendarMonth() {
|
||||
let lastDayOfMonth = new Date(this.y, this.m+1, 0);
|
||||
return new CalendarDate(lastDayOfMonth.getFullYear(), lastDayOfMonth.getMonth() + 1, lastDayOfMonth.getDate()+6-(lastDayOfMonth.getDay() + 7 - this.weekStart)%7);
|
||||
}
|
||||
get nextSevenDays() {
|
||||
const days = []
|
||||
|
||||
for(let i = 0; i < 7; i++) {
|
||||
days[i] = new Date(this.y, this.m, this.d + i)
|
||||
}
|
||||
return days
|
||||
}
|
||||
get numWeeks() {
|
||||
return (new CalendarDate(this.y+1,0,this.weekStart == 1 ? -3 : 0)).w;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user