diff --git a/lib/classes/MessageBox.php b/lib/classes/MessageBox.php index 8c203a5843f0f54ebe1bfa37b0dc5dbc4226906b..b2854d89b51a92822c0351001d6637c50ee921f7 100644 --- a/lib/classes/MessageBox.php +++ b/lib/classes/MessageBox.php @@ -178,10 +178,11 @@ class MessageBox implements LayoutMessage, JsonSerializable public function jsonSerialize(): mixed { return [ - 'type' => $this->class, - 'message' => $this->message, - 'details' => $this->details, - 'closeable' => $this->isCloseable(), + 'type' => $this->class, + 'message' => $this->message, + 'details' => $this->details, + 'close_details' => $this->close_details, + 'closeable' => $this->isCloseable(), ]; } } diff --git a/resources/vue/components/SystemNotification.vue b/resources/vue/components/SystemNotification.vue index 60cefd729c09a581a2beb8386db0bcb1ec91af4a..d4793367dd3b13e49038d3f18c1fb77004eab41e 100644 --- a/resources/vue/components/SystemNotification.vue +++ b/resources/vue/components/SystemNotification.vue @@ -20,8 +20,10 @@ {{ $gettext('Strg+Alt+T hält das automatische Ausblenden der Meldung an bzw. setzt es wieder fort.') }} </p> <details v-if="notification.details?.length > 0" - class="system-notification-details"> - <summary> + class="system-notification-details" + :open="showDetails" + > + <summary @click="toggleDetails()"> {{ $gettext('Details') }} </summary> <template v-if="Array.isArray(notification.details)"> @@ -76,6 +78,7 @@ export default { }, data() { return { + showDetails: !this.notification.close_details, stopTimeout: false, timeout: null, windowIsBlurred: false, @@ -135,6 +138,9 @@ export default { this.visibleFor ); } + }, + toggleDetails() { + this.showDetails = !this.showDetails; } }, mounted() { diff --git a/resources/vue/components/SystemNotificationManager.vue b/resources/vue/components/SystemNotificationManager.vue index 0acef248002e9506d38e4f335e303d84b56b2216..1753915ba0b08a0b1f2fbe009ab3c4ad869c357f 100644 --- a/resources/vue/components/SystemNotificationManager.vue +++ b/resources/vue/components/SystemNotificationManager.vue @@ -41,24 +41,25 @@ export default { } }, methods: { + addNotification(notification) { + this.allNotifications.push({ + key: this.counter++, + ...notification + }); + }, destroyNotification(notification) { this.allNotifications = this.allNotifications.filter(n => n !== notification); } }, created() { if (Array.isArray(this.notifications)) { - this.allNotifications = [...this.notifications]; + this.notifications.map(this.addNotification); } else { - this.allNotifications = Object.values(this.notifications); + Object.values(this.notifications).map(this.addNotification); } }, mounted() { - this.globalOn('push-system-notification', notification => { - this.allNotifications.push({ - key: this.counter++, - ...notification - }); - }); + this.globalOn('push-system-notification', this.addNotification); window.addEventListener('keydown', evt => { if (evt.altKey && evt.ctrlKey && evt.code === 'KeyT') {