2022-03-17 16:59:10 +00:00
|
|
|
<template>
|
|
|
|
<div class="announcement">
|
2022-03-17 18:01:45 +00:00
|
|
|
<div class="heading">
|
|
|
|
<h4>{{ $t('announcements.title') }}</h4>
|
|
|
|
</div>
|
|
|
|
<div class="body">
|
|
|
|
<rich-content
|
2022-03-17 20:51:32 +00:00
|
|
|
v-if="!editing"
|
2022-03-17 18:01:45 +00:00
|
|
|
:html="content"
|
|
|
|
:emoji="announcement.emojis"
|
|
|
|
:handle-links="true"
|
|
|
|
/>
|
2022-03-17 20:51:32 +00:00
|
|
|
<announcement-editor
|
|
|
|
v-else
|
2022-03-20 17:49:26 +00:00
|
|
|
:announcement="editedAnnouncement"
|
2022-03-17 20:51:32 +00:00
|
|
|
/>
|
2022-03-17 18:01:45 +00:00
|
|
|
</div>
|
|
|
|
<div class="footer">
|
2022-03-17 21:11:53 +00:00
|
|
|
<div
|
|
|
|
v-if="!editing"
|
|
|
|
class="times"
|
|
|
|
>
|
2022-07-14 22:42:28 +00:00
|
|
|
<span v-if="publishedAt">
|
|
|
|
{{ $t('announcements.published_time_display', { time: publishedAt }) }}
|
|
|
|
</span>
|
2022-03-17 20:51:32 +00:00
|
|
|
<span v-if="startsAt">
|
|
|
|
{{ $t('announcements.start_time_display', { time: startsAt }) }}
|
|
|
|
</span>
|
|
|
|
<span v-if="endsAt">
|
|
|
|
{{ $t('announcements.end_time_display', { time: endsAt }) }}
|
|
|
|
</span>
|
|
|
|
</div>
|
2022-03-17 21:11:53 +00:00
|
|
|
<div
|
|
|
|
v-if="!editing"
|
|
|
|
class="actions"
|
|
|
|
>
|
2022-03-17 20:51:32 +00:00
|
|
|
<button
|
|
|
|
v-if="currentUser"
|
|
|
|
class="btn button-default"
|
|
|
|
:class="{ toggled: isRead }"
|
2022-03-17 21:32:16 +00:00
|
|
|
:disabled="inactive"
|
|
|
|
:title="inactive ? $t('announcements.inactive_message') : ''"
|
2022-03-17 20:51:32 +00:00
|
|
|
@click="markAsRead"
|
|
|
|
>
|
|
|
|
{{ $t('announcements.mark_as_read_action') }}
|
|
|
|
</button>
|
2022-03-17 21:11:53 +00:00
|
|
|
<button
|
2022-12-24 17:17:09 +00:00
|
|
|
v-if="canEditAnnouncement"
|
2022-03-17 21:11:53 +00:00
|
|
|
class="btn button-default"
|
|
|
|
@click="enterEditMode"
|
|
|
|
>
|
|
|
|
{{ $t('announcements.edit_action') }}
|
|
|
|
</button>
|
2022-03-17 20:51:32 +00:00
|
|
|
<button
|
2022-12-24 17:17:09 +00:00
|
|
|
v-if="canEditAnnouncement"
|
2022-03-17 20:51:32 +00:00
|
|
|
class="btn button-default"
|
|
|
|
@click="deleteAnnouncement"
|
|
|
|
>
|
|
|
|
{{ $t('announcements.delete_action') }}
|
|
|
|
</button>
|
|
|
|
</div>
|
2022-03-17 21:11:53 +00:00
|
|
|
<div
|
|
|
|
v-else
|
|
|
|
class="actions"
|
|
|
|
>
|
|
|
|
<button
|
|
|
|
class="btn button-default"
|
|
|
|
@click="submitEdit"
|
|
|
|
>
|
|
|
|
{{ $t('announcements.submit_edit_action') }}
|
|
|
|
</button>
|
|
|
|
<button
|
|
|
|
class="btn button-default"
|
|
|
|
@click="cancelEdit"
|
|
|
|
>
|
|
|
|
{{ $t('announcements.cancel_edit_action') }}
|
|
|
|
</button>
|
|
|
|
<div
|
|
|
|
v-if="editing && editError"
|
|
|
|
class="alert error"
|
|
|
|
>
|
|
|
|
{{ $t('announcements.edit_error', { error }) }}
|
|
|
|
<button
|
|
|
|
class="button-unstyled"
|
|
|
|
@click="clearError"
|
|
|
|
>
|
|
|
|
<FAIcon
|
|
|
|
class="fa-scale-110 fa-old-padding"
|
|
|
|
icon="times"
|
|
|
|
:title="$t('announcements.close_error')"
|
|
|
|
/>
|
|
|
|
</button>
|
|
|
|
</div>
|
|
|
|
</div>
|
2022-03-17 18:01:45 +00:00
|
|
|
</div>
|
2022-03-17 16:59:10 +00:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script src="./announcement.js"></script>
|
|
|
|
|
|
|
|
<style lang="scss">
|
|
|
|
.announcement {
|
2024-03-04 17:45:42 +00:00
|
|
|
border-bottom: 1px solid var(--border);
|
2022-03-17 16:59:10 +00:00
|
|
|
border-radius: 0;
|
2024-03-04 17:45:42 +00:00
|
|
|
padding: var(--status-margin);
|
2022-03-17 18:01:45 +00:00
|
|
|
|
2023-01-09 18:02:16 +00:00
|
|
|
.heading,
|
|
|
|
.body {
|
2024-03-04 17:45:42 +00:00
|
|
|
margin-bottom: var(--status-margin);
|
2022-03-17 18:01:45 +00:00
|
|
|
}
|
2022-03-17 19:07:04 +00:00
|
|
|
|
|
|
|
.footer {
|
2022-03-17 20:51:32 +00:00
|
|
|
display: flex;
|
|
|
|
flex-direction: column;
|
2023-01-09 18:02:16 +00:00
|
|
|
|
2022-03-17 20:51:32 +00:00
|
|
|
.times {
|
|
|
|
display: flex;
|
|
|
|
flex-direction: column;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
.footer .actions {
|
2022-03-17 19:07:04 +00:00
|
|
|
display: flex;
|
|
|
|
flex-direction: row;
|
2022-07-15 23:30:32 +00:00
|
|
|
justify-content: space-evenly;
|
2022-03-17 19:07:04 +00:00
|
|
|
|
|
|
|
.btn {
|
2022-07-15 23:30:32 +00:00
|
|
|
flex: 1;
|
|
|
|
margin: 1em;
|
2022-07-15 23:31:30 +00:00
|
|
|
max-width: 10em;
|
2022-03-17 19:07:04 +00:00
|
|
|
}
|
|
|
|
}
|
2022-03-17 16:59:10 +00:00
|
|
|
}
|
|
|
|
</style>
|