Adaptions FHC-Alert

- restructure plugins Api, FhcAlert ans Phrasen to use Phrasen in Fhc-Alert
– fix behaviour alert warning: show always clossing cross, and symbol
- fix behaviour alert error: add scrolling to Text MessageError
- phrases alerts
This commit is contained in:
ma0068
2025-07-07 15:36:12 +02:00
parent 4937c1190a
commit ddea3afde4
6 changed files with 97 additions and 11 deletions
+11
View File
@@ -5249,6 +5249,8 @@
}
.p-toast .p-toast-message .p-toast-message-content .p-toast-message-text {
margin: 0 0 0 1rem;
flex: 1 0 0%;
word-break: break-word;
}
.p-toast .p-toast-message .p-toast-message-content .p-toast-message-icon {
font-size: 2rem;
@@ -5314,6 +5316,15 @@
.p-toast .p-toast-message.p-toast-message-error .p-toast-icon-close {
color: #721c24;
}
.p-toast.p-component.p-toast-top-right.fhc-alert {
max-height: calc(100vh - 20px - 1rem);
overflow: auto;
}
.p-toast-message-text .alertCollapseText {
overflow: auto;
max-height: 30rem;
}
.p-galleria .p-galleria-close {
margin: 0.5rem;
@@ -192,6 +192,8 @@ export default {
.catch(this.$fhcAlert.handleSystemError);
},
mounted() {
//Test manu Systemerror
//FHC_JS_DATA_STORAGE_OBJECT.systemerror_mailto = 'ma0068@technikum-wien.at';this.$fhcAlert.handleSystemError(1);
if (this.$route.params.id) {
this.$refs.stvList.updateUrl(
ApiStv.students.uid(this.$route.params.id),
+3 -1
View File
@@ -6,7 +6,9 @@ export default {
if (app.config.globalProperties.$api) {
return;
}
app.use(FhcAlert);
if (!app.config.globalProperties.$fhcAlert)
app.use(FhcAlert);
function _get_config(form, uri, data, config) {
if (typeof form == 'string' && config === undefined) {
+15 -8
View File
@@ -96,6 +96,7 @@ import PvConfig from "../../../index.ci.php/public/js/components/primevue/config
import PvToast from "../../../index.ci.php/public/js/components/primevue/toast/toast.esm.min.js";
import PvConfirm from "../../../index.ci.php/public/js/components/primevue/confirmdialog/confirmdialog.esm.min.js";
import PvConfirmationService from "../../../index.ci.php/public/js/components/primevue/confirmationservice/confirmationservice.esm.min.js";
import FhcPhrasen from "./Phrasen.js";
import {CoreRESTClient} from '../RESTClient.js';
@@ -138,7 +139,7 @@ const helperApp = Vue.createApp({
return FHC_JS_DATA_STORAGE_OBJECT.systemerror_mailto !== '';
}
},
template: `
template: /* html */`
<pv-toast ref="toast" class="fhc-alert" :base-z-index="99999"></pv-toast>
<pv-toast ref="alert" class="fhc-alert" :base-z-index="99999" position="center">
<template #message="slotProps">
@@ -168,7 +169,7 @@ const helperApp = Vue.createApp({
</a>
</div>
<div ref="messageCard" :id="'fhcAlertCollapseMessageCard' + slotProps.message.id" class="collapse mt-3">
<div class="card card-body text-body small">
<div class="card card-body text-body small alertCollapseText">
{{slotProps.message.detail}}
</div>
</div>
@@ -180,6 +181,7 @@ const helperApp = Vue.createApp({
helperApp.use(PvConfig);
helperApp.use(PvConfirmationService);
//helperApp.use(FhcPhrasen);
const helperAppInstance = helperApp.mount(helperAppContainer);
@@ -188,6 +190,9 @@ document.body.appendChild(helperAppContainer);
export default {
install: (app, options) => {
if (!app.config.globalProperties.$p)
app.use(FhcPhrasen);
const $fhcAlert = {
alertSuccess(message) {
if (Array.isArray(message))
@@ -210,6 +215,8 @@ export default {
helperAppInstance.$refs.toast.add({ severity: 'error', summary: 'Achtung', detail: message });
},
alertSystemError(message) {
//TODO(Manu) for translation of content of template: restructure in data
//and update definitions with translations
if (Array.isArray(message))
return message.forEach(this.alertSystemError);
helperAppInstance.$refs.alert.add({ severity: 'error', summary: 'Systemfehler', detail: message});
@@ -218,11 +225,11 @@ export default {
return new Promise((resolve, reject) => {
helperAppInstance.$confirm.require({
group: 'fhcAlertConfirm',
header: 'Achtung',
message: 'Möchten Sie sicher löschen?',
acceptLabel: 'Löschen',
header: Vue.computed(() => app.config.globalProperties.$p.t('alert/attention')),
message: Vue.computed(() => app.config.globalProperties.$p.t('alert/confirm_delete')),
acceptLabel: Vue.computed(() => app.config.globalProperties.$p.t('ui/loeschen')),
acceptClass: 'p-button-danger',
rejectLabel: 'Abbrechen',
rejectLabel: Vue.computed(() => app.config.globalProperties.$p.t('ui/abbrechen')),
rejectClass: 'p-button-secondary',
accept() {
resolve(true);
@@ -237,11 +244,11 @@ export default {
return new Promise((resolve, reject) => {
helperAppInstance.$confirm.require({
group: options?.group ?? 'fhcAlertConfirm',
header: options?.header ?? 'Achtung',
header: options?.header ?? Vue.computed(() => app.config.globalProperties.$p.t('alert/attention')),
message: options?.message ?? '',
acceptLabel: options?.acceptLabel ?? 'Ok',
acceptClass: options?.acceptClass ?? 'btn btn-primary',
rejectLabel: options?.rejectLabel ?? 'Abbrechen',
rejectLabel: options?.rejectLabel ?? Vue.computed(() => app.config.globalProperties.$p.t('ui/abbrechen')),
rejectClass: options?.rejectClass ?? 'btn btn-outline-secondary',
accept() {
resolve(true);
+4 -2
View File
@@ -87,8 +87,10 @@ const phrasen = {
export default {
install(app, options) {
app.use(OldFhcApi); // TODO(chris): remove at some point
app.use(PluginsApi);
if (!app.config.globalProperties.$fhcApi)
app.use(OldFhcApi); // TODO(chris): remove at some point
if (!app.config.globalProperties.$api)
app.use(PluginsApi);
app.config.globalProperties.$p = {
t: phrasen.t,
loadCategory: cat => phrasen.loadCategory.call(app, cat),
+62
View File
@@ -44414,6 +44414,68 @@ and represent the current state of research on the topic. The prescribed citatio
)
)
),
// FHC-4 Studierendenverwaltung FHC-ALERTS START
array(
'app' => 'core',
'category' => 'alert',
'phrase' => 'attention',
'insertvon' => 'system',
'phrases' => array(
array(
'sprache' => 'German',
'text' => 'Achtung',
'description' => '',
'insertvon' => 'system'
),
array(
'sprache' => 'English',
'text' => 'Attention',
'description' => '',
'insertvon' => 'system'
)
)
),
array(
'app' => 'core',
'category' => 'alert',
'phrase' => 'confirm_delete',
'insertvon' => 'system',
'phrases' => array(
array(
'sprache' => 'German',
'text' => 'Möchten Sie wirklich löschen?',
'description' => '',
'insertvon' => 'system'
),
array(
'sprache' => 'English',
'text' => 'Do you really want to delete?',
'description' => '',
'insertvon' => 'system'
)
)
),
array(
'app' => 'core',
'category' => 'alert',
'phrase' => 'attention',
'insertvon' => 'system',
'phrases' => array(
array(
'sprache' => 'German',
'text' => 'Achtung',
'description' => '',
'insertvon' => 'system'
),
array(
'sprache' => 'English',
'text' => 'Attention',
'description' => '',
'insertvon' => 'system'
)
)
),
// FHC-4 Studierendenverwaltung FHC-ALERTS END
);