adds the content of the news to the dashboard items and makes them scrollable through css classes

This commit is contained in:
SimonGschnell
2024-06-25 14:18:11 +02:00
parent 27287bd07a
commit f4176ebcda
4 changed files with 57 additions and 6 deletions
@@ -118,6 +118,7 @@ class Cms extends FHCAPI_Controller
$this->load->model('content/news_model', 'NewsModel');
$news_content_ids = $this->NewsModel->getNewsContentIDs($limit);
$this->addMeta("content_ids",$news_content_ids);
$news_content = array();
if(isError($news_content_ids))
+2
View File
@@ -1,4 +1,6 @@
@import './calendar.css';
@import './dashboard/news.css';
.empty-tile-hover {
height: 100%;
width: 100%;
+24
View File
@@ -0,0 +1,24 @@
/* .widgets-news .card-header {
flex-direction: column;
align-items: flex-start !important;
} */
:root{
--news-widget-height: 1;
}
.widgets-news .news-content > div,
.widgets-news .news-content .row:nth-child(1),
.widgets-news .news-content .news-list,
.widgets-news .news-content .news-list-item,
.widgets-news .news-content .card-body
{
height: 100%;
}
.widgets-news .card-body{
/*max-height: calc(var(--news-widget-height)*var(--fhc-dg-row-height)); */
overflow:scroll;
}
+30 -6
View File
@@ -36,6 +36,23 @@ export default {
this.$emit('setConfig', false);
},
mounted(){
this.$nextTick(() =>{
console.log(this.$refs.htmlContent,"this is the html content");
/* //console.log(this.$refs.htmlContent,"this is the refs content");
let newsItems = document.getElementsByClassName("news-list");
console.log(newsItems,"i am printing something");
for(let item of newsItems){
//console.log(item,"this is the item");
item.style.maxHeight = "100px";
item.style.overflow = "scroll";
} */
});
},
methods: {
setSingleNews(singleNews){
this.singleNews = singleNews;
@@ -43,6 +60,7 @@ export default {
}
},
template: /*html*/`<div class="widgets-news w-100 h-100">
<div class="d-flex flex-column h-100">
<div class="d-flex">
<header><b>Top News</b></header>
@@ -60,31 +78,37 @@ export default {
</div>
</div>
<div v-else-if="width > 1 && height === 1" class="h-100" :class="'row row-cols-' + width">
<div v-for="news in newsList" :key="news.id">
<div class="h-100" v-for="news in newsList" :key="news.id">
<div class="card h-100">
<div class="card-body">
<div class="news-content h-100" :style="'--news-widget-height: '+height" ref="htmlContent" ><div v-html="news.content"></div></div>
<!--<div class="card-body">
<a href="#newsModal" class="card-title h5 stretched-link" @click="setSingleNews(news)">{{ news.betreff }}</a><br>
<span class="small text-muted">{{ formatDateTime(news.insertamum) }} </span>
<p class="card-text pt-3" style="overflow: hidden; display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical;">{{ news.text }}</p>
</div>
</div>-->
</div>
</div>
</div>
<div v-else class="h-100" :class="'row row-cols-' + width">
<div v-for="news in newsList" :key="news.id">
<div class="h-100" v-for="news in newsList" :key="news.id">
<div class="card h-100">
<img :src="placeHolderImgURL" class="card-img-top">
<!-- alte variante um die News anzuzeigen
<img :src="placeHolderImgURL" class="card-img-top">
<div class="card-footer"><span class="card-subtitle small text-muted">{{ formatDateTime(news.insertamum) }}</span></div>
<div class="card-body">
<a href="#newsModal" class="card-title h5 stretched-link" @click="setSingleNews(news)">{{ news.betreff }}</a><br>
<p>this is a test</p>
<a href="#newsModal" class="card-title h5 stretched-link" @click="setSingleNews(news)">{{ news.betreff }}</a><br>
<p class="card-text pt-3">{{ news.text }}</p>
</div>
-->
<div class="news-content h-100" :style="'--news-widget-height: '+height" ref="htmlContent" v-html="news.content"></div>
</div>
</div>
</div>
</div>
</div>
<!-- News Modal -->
<BsModal ref="newsModal" id="newsModal" dialog-class="modal-lg">
<template #title>