mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-23 18:02:18 +00:00
feature(Cms/Content_types/Raum_contentmittitel.js): wraps the h1 title of the content with a link to the Reservierungen of that room
This commit is contained in:
@@ -53,7 +53,7 @@ export default {
|
||||
},
|
||||
template: /*html*/ `
|
||||
<!-- div that contains the content -->
|
||||
<component :is="computeContentType" v-if="content" :content="content" />
|
||||
<component :is="computeContentType" v-if="content" :content="content" :content_id="content_id" />
|
||||
<p v-else>No content is available to display</p>
|
||||
`,
|
||||
};
|
||||
|
||||
@@ -12,7 +12,7 @@ export default {
|
||||
RaumContent,
|
||||
},
|
||||
props:{
|
||||
contentID:{
|
||||
content_id:{
|
||||
type: Number
|
||||
},
|
||||
ort_kurzbz:{
|
||||
@@ -34,8 +34,8 @@ export default {
|
||||
// this method is always called when the modal is shown
|
||||
modalShown: function(){
|
||||
|
||||
if(this.contentID){
|
||||
this.$fhcApi.factory.cms.content(this.contentID).then(res =>{
|
||||
if(this.content_id){
|
||||
this.$fhcApi.factory.cms.content(this.content_id).then(res =>{
|
||||
this.content = res.data.content;
|
||||
this.type = res.data.type;
|
||||
|
||||
@@ -55,7 +55,7 @@ export default {
|
||||
<span v-else>Raum Informationen</span>
|
||||
</template>
|
||||
<template #default>
|
||||
<RaumContent v-if="content" :content="content"></RaumContent>
|
||||
<RaumContent v-if="content" :content="content" :content_id="content_id"></RaumContent>
|
||||
<div v-else>Der Content für diesen Raum konnte nicht geladen werden</div>
|
||||
</template>
|
||||
<template #footer>
|
||||
|
||||
@@ -5,6 +5,9 @@ export default {
|
||||
type:String,
|
||||
required:true,
|
||||
},
|
||||
content_id:{
|
||||
type:Number,
|
||||
}
|
||||
},
|
||||
mounted(){
|
||||
// replaces the tablesorter with the tabulator
|
||||
@@ -21,6 +24,34 @@ export default {
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// tries to wrap the Raum titel with a link tag that redirects to the Reservierungen of that Raum
|
||||
let title = document.getElementsByTagName("h1");
|
||||
title = title.length ? title[0] : null;
|
||||
if (title)
|
||||
{
|
||||
let room_name = title.innerText;
|
||||
let room_name_reg_exp = new RegExp("\\w*\\s([a-zA-Z][0-9\\.]+)$");
|
||||
let room_name_reg_exp_result = room_name.match(room_name_reg_exp);
|
||||
if(room_name_reg_exp_result)
|
||||
{
|
||||
room_name = room_name_reg_exp_result[0];
|
||||
room_name = room_name.replace(" ","_");
|
||||
let link_element = document.createElement("a");
|
||||
link_element.href = FHC_JS_DATA_STORAGE_OBJECT.app_root + FHC_JS_DATA_STORAGE_OBJECT.ci_router + "/CisVue/Cms/getRoomInformation/" + room_name;
|
||||
link_element.appendChild(title.cloneNode(true));
|
||||
title.replaceWith(link_element);
|
||||
}
|
||||
else
|
||||
{
|
||||
console.error(`the regular expression did not match the room name: ${room_name}`);
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
console.error(`was not able to get the title of the raum_contentmittitel by searching for the first h1 element`);
|
||||
}
|
||||
},
|
||||
template: /*html*/ `
|
||||
<!-- div that contains the content -->
|
||||
|
||||
@@ -188,7 +188,7 @@ export default {
|
||||
template: /*html*/`
|
||||
<div class="dashboard-widget-stundenplan d-flex flex-column h-100">
|
||||
<lv-modal v-if="selectedEvent" ref="lvmodal" :event="selectedEvent" />
|
||||
<content-modal :contentID="roomInfoContentID" dialogClass="modal-lg" ref="contentModal"/>
|
||||
<content-modal :content_id="roomInfoContentID" dialogClass="modal-lg" ref="contentModal"/>
|
||||
<fhc-calendar @change:range="updateRange" :initial-date="currentDay" class="border-0" class-header="p-0" @select:day="selectDay" :widget="true" v-model:minimized="minimized" :events="events" no-week-view :show-weeks="false" >
|
||||
<template #monthPage="{event,day,isSelected}">
|
||||
<span class="fhc-entry" :class="{'selectedEvent':isSelected}" style="color:white" :style="{'background-color': event.color}">
|
||||
|
||||
Reference in New Issue
Block a user