refactor style, fix #77 #76

This commit is contained in:
les
2020-06-22 19:15:32 +02:00
parent eab90627a3
commit 3f1bf4cc4a
8 changed files with 152 additions and 72 deletions

View File

@@ -1,5 +1,5 @@
<template lang="pug">
.card.announcement.event.mt-1.text-white(body-style='padding: 0px;')
.card.announcement.announcement.mt-1.text-white(body-style='padding: 0px;')
nuxt-link(:to='`/announcement/${announcement.id}`')
.title <i class='el-icon-info'/> {{announcement.title}}
@@ -17,7 +17,7 @@ export default {
computed: {
...mapState(['announcements']),
description () {
return this.announcement.announcement.slice(0, 500)
return this.announcement.announcement.replace(/(<br>)+/g, '<br>')
}
}
}

View File

@@ -38,7 +38,7 @@
</template>
<script>
import _ from 'lodash'
import { Editor, EditorContent, EditorMenuBar, EditorMenuBubble } from 'tiptap'
import { Editor, EditorContent, EditorMenuBar, EditorMenuBubble, Extension } from 'tiptap'
import {
Blockquote,
BulletList,
@@ -101,7 +101,21 @@ export default {
new Bold(),
new Italic(),
new Strike(),
new Underline()
new Underline(),
new class extends Extension {
keys () {
return {
Enter (state, dispatch, view) {
const { schema, doc, tr } = view.state
const hard_break = schema.nodes.hard_break
const transaction = tr.replaceSelectionWith(hard_break.create()).scrollIntoView()
view.dispatch(transaction)
return true
}
}
}
}()
]
})
},

View File

@@ -1,24 +1,23 @@
<template lang="pug">
.card.event.h-event.mt-1.text-white(body-style='padding: 0px;')
.card.event.h-event.mt-1.text-white
nuxt-link(:to='`/event/${event.id}`')
el-image(v-if='showImage && event.image_path'
lazy :src='`/media/thumb/${event.image_path}`')
.float-right
i.text-danger.el-icon-refresh(v-if='event.parentId')
.badge.text-info(v-if='settings.enable_resources && event.resources && event.resources.length') {{event.resources.length}}
//- title
.p-name.p-summary.title {{event.title}}
.card-body
//- when
div
i.el-icon-date
time.dt-start(:datetime='event.start_datetime|unixFormat("YYYY-MM-DD HH:mm")') {{event|when}}
//- place
el-button.p-location.mt-1.bg-dark.text-warning.float-right(plain size='mini' round type='text' icon='el-icon-location-outline' @click='addPlace') {{event.place.name}}
div.d-flex.justify-content-between
//- when
time.dt-start.mt-0(:datetime='event.start_datetime|unixFormat("YYYY-MM-DD HH:mm")') <i class='el-icon-date'/> {{event|when}}
//- place
el-button.p-location.mt-1.bg-dark.text-warning.float-right(plain size='mini' round type='text' icon='el-icon-location-outline' @click='addPlace') {{event.place.name}}
//- description
.description.p-description.mt-3(v-if='!event.image_path || !event.tags.length' v-html='description')
.p-description.description.mt-3(v-html='description')
.card-footer(v-if='event.tags.length')
el-button.ml-1.bg-dark(type='text' plain round size='mini' v-for='tag in event.tags' :key='tag' @click='addTag(tag)') {{tag}}
@@ -41,7 +40,7 @@ export default {
computed: {
...mapState(['settings', 'filters']),
description () {
return this.event.description.slice(0, 500)
return this.event.description.replace(/(<br>)+/g, '<br>')
},
show_footer () {
return (this.event.tags.length || this.event.resources.length)
@@ -67,55 +66,3 @@ export default {
}
}
</script>
<style lang='less'>
.event {
width: 320px;
max-width: 450px;
flex-grow: 1;
margin: .2em;
background-color: #202020;
a:hover {
text-decoration: none;
.title {
border-bottom: 1px solid #888;
color: white;
}
}
.title {
margin-left: 1rem;
margin-top: 1rem;
margin-right: 1rem;
border-bottom: 1px solid #333;
transition: border-color .5s;
font-size: 1.2em;
max-height: 3em;
overflow: hidden;
color: #fea;
}
.card-footer {
max-height: 4.5em;
overflow: hidden;
padding: .25rem 0.5rem;
line-height: 1.8rem;
min-height: 2.2rem;
}
.description {
color: #999;
font-size: 0.8em;
p {
margin: 0px;
}
}
.el-image { width: 100% }
img {
width: 100%;
max-height: 250px;
object-fit: cover;
object-position: top;
}
}
</style>