adds Phrasen to the Stundenplan dashboard widget

This commit is contained in:
SimonGschnell
2024-07-31 14:51:43 +02:00
parent 0849e795a0
commit bd7e45547f
2 changed files with 122 additions and 51 deletions
+60 -50
View File
@@ -3,67 +3,77 @@ import BsModal from '../Bootstrap/Modal';
const MAX_LOADED_NEWS = 10;
export default {
name: 'WidgetsNews',
components: { BsModal },
data: () => ({
allNewsList: [],
singleNews: {}
}),
mixins: [
AbstractWidget
],
computed: {
name: "WidgetsNews",
components: { BsModal },
data: () => ({
allNewsList: [],
singleNews: {},
}),
mixins: [AbstractWidget],
computed: {
newsList() {
//Return news amount depending on widget width and size
let quantity = this.width;
if (this.width === 1) {
quantity = this.height === 1 ? 4 : 10;
}
newsList(){
//Return news amount depending on widget width and size
let quantity = this.width;
if (this.width === 1) {
quantity = this.height === 1 ? 4 : 10;
}
return this.allNewsList.slice(0, quantity);
},
placeHolderImgURL: function() {
return FHC_JS_DATA_STORAGE_OBJECT.app_root + 'skin/images/fh_technikum_wien_illustration_klein.png';
}
},
created(){
this.$fhcApi.factory.cms.news(MAX_LOADED_NEWS)
.then(res => { this.allNewsList = res.data })
.catch(err => { console.error('ERROR: ', err.response.data) });
this.$emit('setConfig', false);
},
methods: {
contentURI: function(content_id){
return FHC_JS_DATA_STORAGE_OBJECT.app_root + FHC_JS_DATA_STORAGE_OBJECT.ci_router + '/CisVue/Cms/content/' + content_id;
return this.allNewsList.slice(0, quantity);
},
allNewsURI: function(){
return FHC_JS_DATA_STORAGE_OBJECT.app_root + FHC_JS_DATA_STORAGE_OBJECT.ci_router + '/CisVue/Cms/news';
placeHolderImgURL: function () {
return (
FHC_JS_DATA_STORAGE_OBJECT.app_root +
"skin/images/fh_technikum_wien_illustration_klein.png"
);
},
setSingleNews(singleNews){
this.singleNews = singleNews;
this.$refs.newsModal.show();
}
},
template: /*html*/`<div class="widgets-news w-100 h-100">
},
created() {
this.$fhcApi.factory.cms
.news(MAX_LOADED_NEWS)
.then((res) => {
this.allNewsList = res.data;
})
.catch((err) => {
console.error("ERROR: ", err.response.data);
});
this.$emit("setConfig", false);
},
methods: {
contentURI: function (content_id) {
return (
FHC_JS_DATA_STORAGE_OBJECT.app_root +
FHC_JS_DATA_STORAGE_OBJECT.ci_router +
"/CisVue/Cms/content/" +
content_id
);
},
allNewsURI: function () {
return (
FHC_JS_DATA_STORAGE_OBJECT.app_root +
FHC_JS_DATA_STORAGE_OBJECT.ci_router +
"/CisVue/Cms/news"
);
},
setSingleNews(singleNews) {
this.singleNews = singleNews;
this.$refs.newsModal.show();
},
},
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>
<header><b>{{$p.t('news','topNews')}}</b></header>
<a :href="allNewsURI()" class="ms-auto mb-2">
<i class="fa fa-arrow-up-right-from-square me-1"></i>Alle News</a>
<i class="fa fa-arrow-up-right-from-square me-1"></i>{{$p.t('news','allNews')}}</a>
</div>
<div class="h-100 overflow-scroll" v-if="width == 1">
<div v-for="news in newsList" :key="news.id" class="mt-2">
<div class="card">
<div class=" card-body">
<a :href="contentURI(news.content_id)" class="stretched-link" >{{ news.content_obj.betreff?news.content_obj.betreff:'Kein Betreff vorhanden' }}</a><br>
<a :href="contentURI(news.content_id)" class="stretched-link" >{{ news.content_obj.betreff?news.content_obj.betreff:getDate(news.insertamum) }}</a><br>
<span class="small text-muted">{{ formatDateTime(news.insertamum) }}</span>
</div>
</div>
@@ -85,5 +95,5 @@ export default {
</div>
</div>
</div>
</div>`
}
</div>`,
};
+62 -1
View File
@@ -27489,7 +27489,68 @@ array(
'insertvon' => 'system'
)
)
)
),
// NEWS PHRASEN ---------------------------------------------------------------------------
array(
'app' => 'core',
'category' => 'news',
'phrase' => 'allNews',
'insertvon' => 'system',
'phrases' => array(
array(
'sprache' => 'German',
'text' => 'Alle News',
'description' => '',
'insertvon' => 'system'
),
array(
'sprache' => 'English',
'text' => 'All News',
'description' => '',
'insertvon' => 'system'
)
)
),
array(
'app' => 'core',
'category' => 'news',
'phrase' => 'topNews',
'insertvon' => 'system',
'phrases' => array(
array(
'sprache' => 'German',
'text' => 'Top Nachrichten',
'description' => '',
'insertvon' => 'system'
),
array(
'sprache' => 'English',
'text' => 'Top News',
'description' => '',
'insertvon' => 'system'
)
)
),
array(
'app' => 'core',
'category' => 'news',
'phrase' => 'noSubject',
'insertvon' => 'system',
'phrases' => array(
array(
'sprache' => 'German',
'text' => 'Kein Betreff vorhanden',
'description' => '',
'insertvon' => 'system'
),
array(
'sprache' => 'English',
'text' => 'No Subject available',
'description' => '',
'insertvon' => 'system'
)
)
),
);