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

View file

@ -44,19 +44,18 @@ export default {
order: event.start_datetime,
}
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) {
e.dates = {
start: event.start_datetime, end: event.end_datetime
}
e.highlight = {
color: sample(['purple', 'red', 'green', 'blue']),
color: sample(['purple', 'yellow', 'orange', 'red', 'green', 'blue']),
}
} else {
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
}
@ -85,11 +84,11 @@ export default {
align-self: center;
}
.vc-highlight {
/* color: red; */
/* .vc-highlight {
color: red;
height: 22px !important;
opacity: 0.4;
border-radius: 15px;
}
} */
</style>

View file

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

View file

@ -1,24 +1,17 @@
<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')
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')
el-menu-item(index='/add' :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')
nuxt-link(to='/add')
el-menu-item(:title="$t('common.add_event')")
v-icon(color='lightgreen' name='plus')
el-popover(
placement="bottom"
@ -27,9 +20,20 @@
el-menu-item(slot='reference')
v-icon(color='lightblue' name='search')
el-menu-item.float-right(index='/about' :title="$t('common.info')")
img#logo(src='/favicon.ico')
nuxt-link(to='/settings')
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>
<script>

View file

@ -27,7 +27,6 @@ export default {
data () {
return {
onlyMine: false,
withPast: true,
}
},
name :'Search',
@ -45,7 +44,7 @@ export default {
this.showPastEvents(value)
},
get () {
return this.show_past_events
return this.filters.show_past_events
}
},
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",
"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_anon: 'Evento aggiunto, verrà confermato quanto prima.',
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: {
@ -126,14 +127,16 @@ const it = {
err: {
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

View file

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

View file

@ -5,46 +5,50 @@
nuxt-link.float-right(to='/')
el-button(circle icon='el-icon-close' type='danger' size='small' plain)
//- title, where, when
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')
div(v-if='!event')
h5 {{$t('event.not_found')}}
//- image
img(:src='imgPath' v-if='event.image_path')
div(v-else)
//- title, where, when
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')
.info
div {{event|event_when}}
div {{event.place.name}} - {{event.place.address}}
//- image
img(:src='imgPath' v-if='event.image_path')
//- description and tags
div(v-if='event.description || event.tags')
pre(v-html='event.description')
el-tag.mr-1(v-for='tag in event.tags'
size='mini' :key='tag.tag') {{tag.tag}}
.info
div {{event|event_when}}
div {{event.place.name}} - {{event.place.address}}
//- show hide, confirm, delete, edit buttons when allowed
div(v-if='mine')
hr
el-button(v-if='event.is_visible' size='mini' plain type='warning' @click.prevents='toggle' icon='el-icon-view') {{$t('common.hide')}}
el-button(v-else plain type='success' size='mini' @click.prevents='toggle' icon='el-icon-view') {{$t('common.confirm')}}
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')}}
//- description and tags
div(v-if='event.description || event.tags')
pre(v-html='event.description')
el-tag.mr-1(v-for='tag in event.tags'
size='mini' :key='tag.tag') {{tag.tag}}
//- comments
.card-body(v-if='event.activitypub_id')
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')
//- show hide, confirm, delete, edit buttons when allowed
div(v-if='mine')
hr
el-button(v-if='event.is_visible' size='mini' plain type='warning' @click.prevents='toggle' icon='el-icon-view') {{$t('common.hide')}}
el-button(v-else plain type='success' size='mini' @click.prevents='toggle' icon='el-icon-view') {{$t('common.confirm')}}
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
.card-body(v-if='event.activitypub_id')
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>
<script>
@ -64,12 +68,13 @@ export default {
// },
head () {
if (!this.event) return {}
return {
title: this.event.title,
meta: [
// 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: 'og-description', name: 'og: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.slice(0, 100) },
{ hid: 'og-title', property: 'og:title', content: this.event.title },
{ hid: 'og-url', property: 'og:url', content: `event/${this.event.id}` },
{ 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: {
...mapGetters(['filteredEvents']),
next () {
@ -102,10 +111,6 @@ export default {
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: {
...mapActions(['delEvent']),
comment_filter (value) {

View file

@ -5,9 +5,9 @@ moment.locale('it')
function short_hour(datetime) {
if (datetime.minute() === 0) {
return 'h' + datetime.format('HH')
return datetime.format('HH')
} else {
return 'h' + datetime.format('HH:mm')
return datetime.format('HH:mm')
}
}
@ -24,7 +24,7 @@ export default (a) => {
if (event.multidate) {
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)
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
return `${start.format('dddd, D MMMM')} (${short_hour(start)})`
})

View file

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

View file

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

View file

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

View file

@ -31,7 +31,6 @@ async function sendNotification(notification, event, eventNotification) {
}
async function notify() {
console.error('dentro il loop di notify')
settings = await settingsController.settings()
// get all event notification in queue
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)
}
@ -91,7 +91,7 @@ export const mutations = {
state.filters.places = places
},
showPastEvents(state, show) {
state.show_past_events = show
state.filters.show_past_events = show
},
setSettings(state, settings) {
state.settings = settings