improve announcement management

This commit is contained in:
les
2021-05-31 00:08:13 +02:00
parent 54c5d2aa41
commit 91311b49ef
8 changed files with 36 additions and 55 deletions

View File

@@ -14,6 +14,9 @@ export default {
try {
const id = Number(params.id)
const announcement = store.state.announcements.find(a => a.id === id)
if (!announcement) {
error({ statusCode: 404, message: 'Announcement not found' })
}
return { announcement }
} catch (e) {
error({ statusCode: 404, message: 'Announcement not found' })
@@ -22,50 +25,14 @@ export default {
data () {
return { announcement: { title: '' } }
},
computed: mapState(['announcements']),
methods: {
showResource (resource) {
this.showResources = true
this.selectedResource = resource
document.getElementById('resourceDialog').focus()
head () {
if (!this.announcement) {
return {}
}
}
return {
title: `${this.settings.title} - ${this.announcement.title}`
}
},
computed: mapState(['announcements', 'settings'])
}
</script>
<style lang='less'>
// .announcement-page {
// .el-header {
// height: auto !important;
// padding-top: 1em;
// border-bottom: 1px solid lightgray;
// }
// .title {
// max-width: 80%;
// max-height: 0.1rem;
// overflow: hidden;
// font-size: 1.6rem;
// line-height: 1;
// padding-right: 40px;
// }
// pre {
// white-space: pre-line;
// word-break: break-word;
// color: #aaa;
// font-size: 1.2em;
// font-family: inherit;
// }
// }
// @media only screen and (max-width: 768px) {
// #eventDetail {
// .title {
// font-size: 1em;
// font-weight: bold;
// }
// }
// }
</style>

View File

@@ -2,7 +2,7 @@
v-container#home(fluid)
//- Announcements
#announcements.mr-1
#announcements.mx-1.mt-1(v-if='announcements.length')
Announcement(v-for='announcement in announcements' :key='`a_${announcement.id}`' :announcement='announcement')
//- Calendar and search bar