This commit is contained in:
lesion
2019-06-09 00:45:50 +02:00
parent ccaf53aa24
commit 792bc64ce5
16 changed files with 144 additions and 105 deletions

View File

@@ -18,14 +18,14 @@ html, body {
.el-form-item { .el-form-item {
margin-bottom: 5px; margin-bottom: 5px;
} }
.el-divider__text { // .el-divider__text {
background-color: @background; // background-color: @background;
color: white; // color: white;
border-radius: 5px; // border-radius: 5px;
} // }
.el-card { .el-card {
max-width: 600px; max-width: 650px;
margin: 30px auto; margin: 30px auto;
} }
@@ -64,10 +64,14 @@ pre {
word-break: normal; word-break: normal;
} }
@media only screen and (min-width: 768px) { @media only screen and (max-width: 768px) {
.el-dialog { .el-card {
margin-top: 10vh !important; margin-top: 0px !important;
width: 700px; border-radius: 0px;
border-radius: 3px; padding: 0px;
}
.el-menu-item {
padding: 0px 17px;
} }
} }

View File

@@ -44,19 +44,18 @@ export default {
order: event.start_datetime, order: event.start_datetime,
} }
const day = moment(event.start_datetime).date() const day = moment(event.start_datetime).date()
let color = event.past ? 'rgba(200,200,200,0.5)' : get(event, 'tags[0].color') || 'rgba(170,170,250,0.7)' // let color = event.past ? 'rgba(200,200,200,0.5)' : get(event, 'tags[0].color') || 'rgba(170,170,250,0.7)'
console.error(color)
if (event.multidate) { if (event.multidate) {
e.dates = { e.dates = {
start: event.start_datetime, end: event.end_datetime start: event.start_datetime, end: event.end_datetime
} }
e.highlight = { e.highlight = {
color: sample(['purple', 'red', 'green', 'blue']), color: sample(['purple', 'yellow', 'orange', 'red', 'green', 'blue']),
} }
} else { } else {
e.dates = event.start_datetime e.dates = event.start_datetime
e.dot = { color: sample(['purple', 'red', 'green', 'blue']) } e.dot = { color: sample(['purple', 'red', 'orange', 'yellow', 'green', 'blue']) }
} }
return e return e
} }
@@ -85,11 +84,11 @@ export default {
align-self: center; align-self: center;
} }
.vc-highlight { /* .vc-highlight {
/* color: red; */ color: red;
height: 22px !important; height: 22px !important;
opacity: 0.4; opacity: 0.4;
border-radius: 15px; border-radius: 15px;
} } */
</style> </style>

View File

@@ -74,7 +74,7 @@ export default {
img { img {
width: 100%; width: 100%;
max-height: 200px; max-height: 250px;
object-fit: cover; object-fit: cover;
object-position: top; object-position: top;
} }
@@ -107,7 +107,7 @@ export default {
} }
.date { .date {
font-weight: 300; font-weight: 400;
font-size: 12px; font-size: 12px;
font-size: 0.95rem; font-size: 0.95rem;
color: #ff917a; color: #ff917a;
@@ -126,7 +126,7 @@ export default {
background: #1B1F21; background: #1B1F21;
display: inline-block; display: inline-block;
padding: 2px 10px; padding: 2px 10px;
color: rgba(255,255,255,0.7); color: rgba(255,255,255,0.9);
margin: 1px; margin: 1px;
text-align: center; text-align: center;
flex-grow: 1; flex-grow: 1;

View File

@@ -1,24 +1,17 @@
<template lang="pug"> <template lang="pug">
el-menu.d-grid.nav(mode='horizontal' router background-color="#222C32") el-menu.d-flex.nav(mode='horizontal' router background-color="#222C32")
nuxt-link(to='/about')
el-menu-item(:title="$t('common.info')")
img#logo(src='/favicon.ico')
nuxt-link(to='/login') nuxt-link(to='/login')
el-menu-item(v-if='!$auth.loggedIn' index='/login' :title="$t('common.login')") el-menu-item(v-if='!$auth.loggedIn' :title="$t('common.login')")
v-icon(color='lightgreen' name='user') v-icon(color='lightgreen' name='user')
el-menu-item(index='/add' :title="$t('common.add_event')") nuxt-link(to='/add')
v-icon(color='lightgreen' name='plus') el-menu-item(:title="$t('common.add_event')")
v-icon(color='lightgreen' name='plus')
el-menu-item(v-if='$auth.loggedIn' index='/settings' :title="$t('common.settings')")
v-icon(color='orange' name='cog')
el-menu-item(v-if='$auth.user && $auth.user.is_admin' index='/admin' :title="$t('common.admin')")
v-icon(color='lightblue' name='tools')
el-menu-item(index='/export' :title="$t('common.share')")
v-icon(name='share' color='yellow')
el-menu-item(v-if='$auth.loggedIn' @click='logout' :title="$t('common.logout')")
v-icon(color='red' name='sign-out-alt')
el-popover( el-popover(
placement="bottom" placement="bottom"
@@ -27,9 +20,20 @@
el-menu-item(slot='reference') el-menu-item(slot='reference')
v-icon(color='lightblue' name='search') v-icon(color='lightblue' name='search')
el-menu-item.float-right(index='/about' :title="$t('common.info')") nuxt-link(to='/settings')
img#logo(src='/favicon.ico') el-menu-item(v-if='$auth.loggedIn' :title="$t('common.settings')")
v-icon(color='orange' name='cog')
nuxt-link(to='/admin')
el-menu-item(v-if='$auth.user && $auth.user.is_admin' :title="$t('common.admin')")
v-icon(color='lightblue' name='tools')
nuxt-link(to='/export')
el-menu-item(:title="$t('common.share')")
v-icon(name='share' color='yellow')
el-menu-item(v-if='$auth.loggedIn' @click='logout' :title="$t('common.logout')")
v-icon(color='red' name='sign-out-alt')
</template> </template>
<script> <script>

View File

@@ -27,7 +27,6 @@ export default {
data () { data () {
return { return {
onlyMine: false, onlyMine: false,
withPast: true,
} }
}, },
name :'Search', name :'Search',
@@ -45,7 +44,7 @@ export default {
this.showPastEvents(value) this.showPastEvents(value)
}, },
get () { get () {
return this.show_past_events return this.filters.show_past_events
} }
}, },
filter: { filter: {

18
layouts/error.vue Normal file
View File

@@ -0,0 +1,18 @@
<template lang='pug'>
.container
#error
h1(v-if="error.statusCode === 404") Page not found
h1(v-else) An error occurred
</template>
<script>
export default {
props: ['error'],
}
</script>
<style lang="less">
#error {
margin-top: 20px;
color: orange;
}
</style>

View File

@@ -1,6 +1,6 @@
{ {
"registration_email": "registration_email",
"recover_email": "recover_email", "recover_email": "recover_email",
"press here": "press here", "press here": "press here",
"register.request": "register.request" "register.request": "register.request",
"email.registration": "porcodio"
} }

View File

@@ -105,7 +105,8 @@ const it = {
added: 'Evento aggiunto', added: 'Evento aggiunto',
added_anon: 'Evento aggiunto, verrà confermato quanto prima.', added_anon: 'Evento aggiunto, verrà confermato quanto prima.',
where_description: `Dov'è il gancio? Se il posto non è presente, scrivilo e <b>premi invio</b>. `, where_description: `Dov'è il gancio? Se il posto non è presente, scrivilo e <b>premi invio</b>. `,
confirmed: 'Evento confermato' confirmed: 'Evento confermato',
not_found: 'Evento non trovato'
}, },
admin: { admin: {
@@ -126,14 +127,16 @@ const it = {
err: { err: {
register_error: 'Errore nella registrazione' register_error: 'Errore nella registrazione'
},
firstrun: {
basic: `Inserisci titolo e descrizione della tua istanza di gancio.`,
database: `Gancio ha bisogno di un database postgresql!`,
smtp: `Inserisci un account SMTP relativo a questa istanza di gancio.`
} }
// firstrun: {
// basic: `Inserisci titolo e descrizione della tua istanza di gancio.`,
// database: `Gancio ha bisogno di un database postgresql!`,
// smtp: `Inserisci un account SMTP relativo a questa istanza di gancio.`
// },
// email: {
// registration: `Abbiamo ricevuto la richiesta di registrazione. La confermeremo quanto prima.\n Ciao`
// }
} }
export default it export default it

View File

@@ -269,9 +269,9 @@ export default {
await this.addEvent(formData) await this.addEvent(formData)
} }
this.updateMeta() this.updateMeta()
this.loading = false
this.$router.replace('/') this.$router.replace('/')
Message({ type: 'success', message: this.$auth.loggedIn ? this.$t('event.added') : this.$t('event.added_anon')}) Message({ type: 'success', message: this.$auth.loggedIn ? this.$t('event.added') : this.$t('event.added_anon')})
this.loading = false
} catch (e) { } catch (e) {
this.loading = false this.loading = false
console.error(e) console.error(e)

View File

@@ -5,46 +5,50 @@
nuxt-link.float-right(to='/') nuxt-link.float-right(to='/')
el-button(circle icon='el-icon-close' type='danger' size='small' plain) el-button(circle icon='el-icon-close' type='danger' size='small' plain)
//- title, where, when div(v-if='!event')
h5.text-center {{event.title}} h5 {{$t('event.not_found')}}
div.nextprev
nuxt-link(v-if='prev' :to='`/event/${prev.id}`')
el-button(icon='el-icon-arrow-left' round type='success')
nuxt-link.float-right(v-if='next' :to='`/event/${next.id}`')
el-button(icon='el-icon-arrow-right' round type='success')
//- image
img(:src='imgPath' v-if='event.image_path')
.info div(v-else)
div {{event|event_when}} //- title, where, when
div {{event.place.name}} - {{event.place.address}} h5.text-center {{event.title}}
div.nextprev
nuxt-link(v-if='prev' :to='`/event/${prev.id}`')
el-button(icon='el-icon-arrow-left' round type='success')
nuxt-link.float-right(v-if='next' :to='`/event/${next.id}`')
el-button(icon='el-icon-arrow-right' round type='success')
//- image
img(:src='imgPath' v-if='event.image_path')
//- description and tags .info
div(v-if='event.description || event.tags') div {{event|event_when}}
pre(v-html='event.description') div {{event.place.name}} - {{event.place.address}}
el-tag.mr-1(v-for='tag in event.tags'
size='mini' :key='tag.tag') {{tag.tag}}
//- show hide, confirm, delete, edit buttons when allowed //- description and tags
div(v-if='mine') div(v-if='event.description || event.tags')
hr pre(v-html='event.description')
el-button(v-if='event.is_visible' size='mini' plain type='warning' @click.prevents='toggle' icon='el-icon-view') {{$t('common.hide')}} el-tag.mr-1(v-for='tag in event.tags'
el-button(v-else plain type='success' size='mini' @click.prevents='toggle' icon='el-icon-view') {{$t('common.confirm')}} size='mini' :key='tag.tag') {{tag.tag}}
el-button(plain type='danger' size='mini' @click.prevent='remove' icon='el-icon-remove') {{$t('common.remove')}}
el-button(plain type='primary' size='mini' @click='$router.replace(`/add/${event.id}`)' icon='el-icon-edit') {{$t('common.edit')}}
//- comments //- show hide, confirm, delete, edit buttons when allowed
.card-body(v-if='event.activitypub_id') div(v-if='mine')
strong {{$t('common.related')}} - hr
a(:href='`https://mastodon.cisti.org/web/statuses/${event.activitypub_id}`') {{$t('common.add')}} el-button(v-if='event.is_visible' size='mini' plain type='warning' @click.prevents='toggle' icon='el-icon-view') {{$t('common.hide')}}
.card-header(v-for='comment in event.comments' :key='comment.id') el-button(v-else plain type='success' size='mini' @click.prevents='toggle' icon='el-icon-view') {{$t('common.confirm')}}
img.avatar(:src='comment.data.last_status.account.avatar') el-button(plain type='danger' size='mini' @click.prevent='remove' icon='el-icon-remove') {{$t('common.remove')}}
strong {{comment.author}} el-button(plain type='primary' size='mini' @click='$router.replace(`/add/${event.id}`)' icon='el-icon-edit') {{$t('common.edit')}}
a.float-right(:href='comment.data.last_status.url')
small {{comment.data.last_status.created_at|datetime}} //- comments
div.mt-1(v-html='comment_filter(comment.text)') .card-body(v-if='event.activitypub_id')
img(v-for='img in comment.data.last_status.media_attachments' :src='img.preview_url') strong {{$t('common.related')}} -
a(:href='`https://mastodon.cisti.org/web/statuses/${event.activitypub_id}`') {{$t('common.add')}}
.card-header(v-for='comment in event.comments' :key='comment.id')
img.avatar(:src='comment.data.last_status.account.avatar')
strong {{comment.author}}
a.float-right(:href='comment.data.last_status.url')
small {{comment.data.last_status.created_at|datetime}}
div.mt-1(v-html='comment_filter(comment.text)')
img(v-for='img in comment.data.last_status.media_attachments' :src='img.preview_url')
</template> </template>
<script> <script>
@@ -64,12 +68,13 @@ export default {
// }, // },
head () { head () {
if (!this.event) return {}
return { return {
title: this.event.title, title: this.event.title,
meta: [ meta: [
// hid is used as unique identifier. Do not use `vmid` for it as it will not work // hid is used as unique identifier. Do not use `vmid` for it as it will not work
// { hid: 'description', name: 'description', content: this.event.description }, { hid: 'description', name: 'description', content: this.event.description.slice(0, 1000) },
// { hid: 'og-description', name: 'og:description', content: this.event.description }, { hid: 'og-description', name: 'og:description', content: this.event.description.slice(0, 100) },
{ hid: 'og-title', property: 'og:title', content: this.event.title }, { hid: 'og-title', property: 'og:title', content: this.event.title },
{ hid: 'og-url', property: 'og:url', content: `event/${this.event.id}` }, { hid: 'og-url', property: 'og:url', content: `event/${this.event.id}` },
{ property: 'og:type', content: 'event'}, { property: 'og:type', content: 'event'},
@@ -77,6 +82,10 @@ export default {
] ]
} }
}, },
async asyncData ( { $axios, params }) {
const event = await $axios.$get(`/event/${params.id}`)
return { event, id: params.id}
},
computed: { computed: {
...mapGetters(['filteredEvents']), ...mapGetters(['filteredEvents']),
next () { next () {
@@ -102,10 +111,6 @@ export default {
return this.event.userId === this.$auth.user.id || this.$auth.user.is_admin return this.event.userId === this.$auth.user.id || this.$auth.user.is_admin
}, },
}, },
async asyncData ( { $axios, params }) {
const event = await $axios.$get(`/event/${params.id}`)
return { event, id: params.id}
},
methods: { methods: {
...mapActions(['delEvent']), ...mapActions(['delEvent']),
comment_filter (value) { comment_filter (value) {

View File

@@ -5,9 +5,9 @@ moment.locale('it')
function short_hour(datetime) { function short_hour(datetime) {
if (datetime.minute() === 0) { if (datetime.minute() === 0) {
return 'h' + datetime.format('HH') return datetime.format('HH')
} else { } else {
return 'h' + datetime.format('HH:mm') return datetime.format('HH:mm')
} }
} }
@@ -24,7 +24,7 @@ export default (a) => {
if (event.multidate) { if (event.multidate) {
return `${start.format('ddd, D MMMM')} (${short_hour(start)}) - ${end.format('ddd, D MMMM')} (${short_hour(end)})` return `${start.format('ddd, D MMMM')} (${short_hour(start)}) - ${end.format('ddd, D MMMM')} (${short_hour(end)})`
} else if (event.end_datetime && event.end_datetime !== event.start_datetime) } else if (event.end_datetime && event.end_datetime !== event.start_datetime)
return `${start.format('ddd, D MMMM')} (${short_hour(start)}-${short_hour(end)}` return `${start.format('ddd, D MMMM')} (${short_hour(start)}-${short_hour(end)})`
else else
return `${start.format('dddd, D MMMM')} (${short_hour(start)})` return `${start.format('dddd, D MMMM')} (${short_hour(start)})`
}) })

View File

@@ -28,4 +28,4 @@ module.exports = (sequelize, DataTypes) => {
// associations can be defined here // associations can be defined here
} }
return event return event
}; }

View File

@@ -6,14 +6,18 @@ module.exports = {
references: { references: {
model: 'events', model: 'events',
key: 'id' key: 'id'
} },
onDelete: 'cascade',
onUpdate: 'cascade'
}, },
notificationId: { notificationId: {
type: Sequelize.INTEGER, type: Sequelize.INTEGER,
references: { references: {
model: 'notifications', model: 'notifications',
key: 'id' key: 'id'
} },
onDelete: 'cascade',
onUpdate: 'cascade'
}, },
status: { status: {
type: Sequelize.ENUM, type: Sequelize.ENUM,

View File

@@ -7,14 +7,18 @@ module.exports = {
references: { references: {
model: 'events', model: 'events',
key: 'id' key: 'id'
} },
onDelete: 'cascade',
onUpdate: 'cascade'
}, },
tagTag: { tagTag: {
type: Sequelize.STRING, type: Sequelize.STRING,
references: { references: {
model: 'tags', model: 'tags',
key: 'tag' key: 'tag'
} },
onDelete: 'cascade',
onUpdate: 'cascade'
}, },
createdAt: { createdAt: {
allowNull: false, allowNull: false,

View File

@@ -31,7 +31,6 @@ async function sendNotification(notification, event, eventNotification) {
} }
async function notify() { async function notify() {
console.error('dentro il loop di notify')
settings = await settingsController.settings() settings = await settingsController.settings()
// get all event notification in queue // get all event notification in queue
const eventNotifications = await EventNotification.findAll({ where: { status: 'new' } }) const eventNotifications = await EventNotification.findAll({ where: { status: 'new' } })

View File

@@ -40,7 +40,7 @@ export const getters = {
}) })
} }
if (!state.show_past_events) { if (!state.filters.show_past_events) {
events = events.filter(e => !e.past) events = events.filter(e => !e.past)
} }
@@ -91,7 +91,7 @@ export const mutations = {
state.filters.places = places state.filters.places = places
}, },
showPastEvents(state, show) { showPastEvents(state, show) {
state.show_past_events = show state.filters.show_past_events = show
}, },
setSettings(state, settings) { setSettings(state, settings) {
state.settings = settings state.settings = settings