Skip to content
Snippets Groups Projects
Commit fa371794 authored by Jan-Hendrik Willms's avatar Jan-Hendrik Willms
Browse files

show system notification's details as before, fixes #4388

Closes #4388

Merge request studip/studip!3200
parent ae61e7fb
No related branches found
No related tags found
No related merge requests found
......@@ -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(),
];
}
}
......@@ -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() {
......
......@@ -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') {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment