mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-09-28 01:25:00 +00:00
homepage_widget: improve notifications rows
This commit is contained in:
@@ -5,22 +5,24 @@
|
||||
<template v-slot:thead>
|
||||
<th scope="col">#</th>
|
||||
<th scope="col">{{ $t('Date') }}</th>
|
||||
<th scope="col">{{ $t('From') }}</th>
|
||||
<th scope="col">{{ $t('Subject') }}</th>
|
||||
<th scope="col">{{ $t('Entity') }}</th>
|
||||
<th scope="col"></th>
|
||||
</template>
|
||||
<template v-slot:tbody>
|
||||
<tr v-for="(n, i) in notifications.results" :key="`notify-${i}`">
|
||||
<th scope="row">{{ i+1 }}</th>
|
||||
<td>{{ $d(n.date.datetime, 'short') }}</td>
|
||||
<td>{{ $d(n.date.datetime, 'long') }}</td>
|
||||
<td>{{ n.sender.text }}</td>
|
||||
<td>
|
||||
<span class="unread">
|
||||
<i class="fa fa-envelope-o"></i>
|
||||
{{ n.title }}
|
||||
<a :href="getNotificationUrl(n)">{{ n.title }}</a>
|
||||
</span>
|
||||
</td>
|
||||
<td>
|
||||
<a class="btn btn-sm btn-show"
|
||||
:href="linkEntity(n)">
|
||||
:href="getEntityUrl(n)">
|
||||
{{ $t('show_entity', { entity: getEntityName(n) }) }}
|
||||
</a>
|
||||
</td>
|
||||
@@ -56,6 +58,9 @@ export default {
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
getNotificationUrl(n) {
|
||||
return `/fr/notification/${n.id}/show`
|
||||
},
|
||||
getEntityName(n) {
|
||||
switch (n.relatedEntityClass) {
|
||||
case 'Chill\\ActivityBundle\\Entity\\Activity':
|
||||
@@ -66,7 +71,7 @@ export default {
|
||||
throw 'notification type unknown';
|
||||
}
|
||||
},
|
||||
linkEntity(n) {
|
||||
getEntityUrl(n) {
|
||||
switch (n.relatedEntityClass) {
|
||||
case 'Chill\\ActivityBundle\\Entity\\Activity':
|
||||
return `/fr/activity/${n.relatedEntityId}/show`
|
||||
@@ -86,5 +91,8 @@ span.unread {
|
||||
i {
|
||||
margin-right: 0.5em;
|
||||
}
|
||||
a {
|
||||
text-decoration: unset;
|
||||
}
|
||||
}
|
||||
</style>
|
Reference in New Issue
Block a user