fix #17 fix #36 remove notification, rss fix&more

This commit is contained in:
lesion
2019-03-21 22:20:30 +01:00
parent ba0004a89f
commit 58f0d8c9fe
30 changed files with 302 additions and 123 deletions

View File

@@ -48,6 +48,11 @@ export default {
login: (email, password) => post('/login', { email, password }),
register: user => post('/user', user),
// password recovery
forgotPassword: email => post('/user/recover', { email }),
checkRecoverCode: recover_code => post('/user/check_recover_code', { recover_code }),
recoverPassword: (recover_code, password) => post('/user/recover_password', { recover_code, password }),
getAllEvents: (month, year) => get(`/event/${year}/${month}/`),
getUnconfirmedEvents: () => get('/event/unconfirmed'),
@@ -55,6 +60,7 @@ export default {
unconfirmEvent: id => get(`/event/unconfirm/${id}`),
addNotification: notification => post('/event/notification', notification),
delNotification: code => del(`/event/notification/${code}`),
addEvent: event => post('/user/event', event),
updateEvent: event => put('/user/event', event),

View File

@@ -26,5 +26,5 @@ pre {
}
a, a:hover {
color: orange;
color: red;
}

View File

@@ -12,9 +12,9 @@
Dentro gancio puoi trovare e inserire eventi.
Gancio, come tutto <a href='https://cisti.org'>cisti.org</a> è uno strumento
antisessista, antirazzista, antifascista e anticapitalista, riflettici quando
stai pubblicando un evento.
pubblichi un evento.
h5 Ok, ma cosa vuol dire?
h5 Ok, ma cosa vuol dire gancio?
blockquote.
Se vieni a Torino e dici: "ehi, ci diamo un gancio alle 8?" nessuno si presenterà con i guantoni per fare a mazzate.
Darsi un gancio vuol dire beccarsi alle ore X in un posto Y

View File

@@ -0,0 +1,39 @@
<template lang="pug">
b-modal(hide-footer @hidden='$router.replace("/")' :title='$t("Remove notification")'
:visible='true' size='sm' ref='modal')
div( v-loading='loading')
p Vuoi eliminare le notifiche?
el-button.float-right(type='success' @click='remove') {{$t('Yes')}}
el-button.float-right.mr-1(type='danger' @click='$refs.modal.hide()') {{$t('No')}}
</template>
<script>
import api from '@/api'
import { Message } from 'element-ui';
export default {
name: 'DelNotification',
data () {
return {
code: '',
loading: false
}
},
mounted () {
this.code = this.$route.params.code
},
methods: {
async remove () {
this.loading = true
try {
await api.delNotification(this.code)
Message({message: this.$t('Email notification removed'), type: 'success'})
} catch(e) {
Message({message: this.$t('Error removing email notification'), type: 'error'})
}
this.$refs.modal.hide()
this.loading = false
}
}
}
</script>

View File

@@ -14,8 +14,6 @@ import { mapState, mapActions } from 'vuex';
import api from '@/api'
import filters from '@/filters'
console.log(process.env)
export default {
props: ['event'],
computed: {

View File

@@ -11,12 +11,12 @@
el-tab-pane.pt-1(label='email' name='email')
p(v-html='$t(`export_email_explanation`)')
b-form
el-form(@submit.native.prevent='add_notification')
//- el-switch(v-model='notification.notify_on_add' :active-text="$t('notify_on_insert')")
//- br
//- el-switch.mt-2(v-model='notification.send_notification' :active-text="$t('send_notification')")
el-input.mt-2(v-model='notification.email' :placeholder="$t('Insert your address')")
el-button.mt-2.float-right(type='success' @click='add_notification') {{$t('Send')}}
el-input.mt-2(v-model='notification.email' :placeholder="$t('Insert your address')" ref='email')
el-button.mt-2.float-right(native-type= 'submit' type='success' @click='add_notification') {{$t('Send')}}
el-tab-pane.pt-1(label='feed rss' name='feed')
span(v-html='$t(`export_feed_explanation`)')
@@ -59,6 +59,7 @@ import filters from '../filters'
import Calendar from '@/components/Calendar'
import {intersection} from 'lodash'
import api from '@/api'
import { Message } from 'element-ui'
export default {
name: 'Export',
@@ -83,8 +84,13 @@ export default {
},
methods: {
async add_notification () {
if (!this.notification.email){
Message({message:'Inserisci una mail', type: 'error'})
return this.$refs.email.focus()
}
await api.addNotification({ ...this.notification, filters: this.filters})
this.$refs.modal.hide()
Message({message: this.$t('email_notification_activated'), type: 'success'})
},
loadLink () {
const tags = this.filters.tags.join(',')

View File

@@ -1,15 +1,16 @@
<template lang='pug'>
b-modal(@shown="$refs.email.focus()" :title='$t("Login")' hide-footer
@hidden='$router.replace("/")' :visible='true' ref='modal')
el-form
p {{$t('login_explanation')}}
el-form(v-loading='loading')
p(v-html="$t('login_explanation')")
el-input.mb-2(v-model='email' type='email' :placeholder='$t("Email")' autocomplete='email' ref='email')
v-icon(name='user' slot='prepend')
el-input.mb-2(v-model='password' type='password' :placeholder='$t("Password")')
el-input.mb-1(v-model='password' @keyup.enter.native="submit" type='password' :placeholder='$t("Password")')
v-icon(name="lock" slot='prepend')
el-button(plain type="success" icon='el-icon-arrow-right' @click='submit') {{$t('Login')}}
router-link.float-right(to='/register')
a {{$t('Not registered?')}}
el-button.mr-1(plain type="success" @click='submit') {{$t('Login')}}
router-link(to='/register')
el-button.mt-1(plain type="primary") {{$t('Not registered?')}}
a.float-right(href='#' @click='forgot') {{$t('Forgot password?')}}
</template>
<script>
@@ -24,22 +25,37 @@ export default {
return {
password: '',
email: '',
loading: false
}
},
methods: {
...mapActions(['login']),
async forgot () {
if (!this.email) {
Message({ message: this.$t('Insert your email'), type: 'error' })
this.$refs.email.focus()
return
}
this.loading = true
await api.forgotPassword(this.email)
this.loading = false
Message({ message: this.$t('Check your email!'), type: 'success' })
},
async submit (e) {
e.preventDefault()
try {
this.loading = true
const user = await api.login(this.email, this.password)
this.loading = false
if (!user) {
Message({ message: this.$t('login error'), type: 'error' })
Message({ message: this.$t('Login error'), type: 'error' })
return;
}
this.login(user)
Message({ message: this.$t('Logged'), type: 'success' })
} catch (e) {
Message({ message: this.$t('login error'), type: 'error' })
Message({ message: this.$t('Login error'), type: 'error' })
this.loading = false
return
}
this.email = this.password = ''

View File

@@ -0,0 +1,56 @@
<template lang='pug'>
b-modal(@shown="$refs.password.focus()" :title='$t("Password reset")' hide-footer
@hidden='$router.replace("/")' :visible='true' ref='modal')
div(v-loading='loading')
p(v-html="$t('recover_explanation')")
span(v-if='user.email') {{user.email}}
el-input.mb-2(v-model='password' type='password' :placeholder='$t("New password")' ref='password')
v-icon(name='lock' slot='prepend')
el-button.mr-1(plain type="success" @click='change') {{$t('Change')}}
</template>
<script>
import api from '@/api'
import { mapActions } from 'vuex'
import { Message } from 'element-ui'
export default {
name: 'Recover',
data () {
return {
password: '',
loading: true,
user: {}
}
},
async mounted () {
try {
this.user = await api.checkRecoverCode(this.$route.params.recover_code)
console.log(this.user)
} catch (e) {
this.$refs.modal.hide()
Message({message: this.$t('error_recover_code'), type: 'error'})
}
this.loading = false
},
methods: {
async change () {
if (!this.password) return
this.loading = true
try {
await api.recoverPassword(this.$route.params.recover_code, this.password)
} catch (e) {
this.loading = false
Message({ message: this.$t('password_not_changed'), type: 'error'})
return
}
this.loading = false
// this.$refs.modal.hide()
Message({ message: this.$t('password_changed'), type: 'success'})
this.$router.replace('/login')
}
}
}
</script>

View File

@@ -1,8 +1,8 @@
<template lang="pug">
b-modal(ref='modal' @hidden='$router.replace("/")' size='lg' :visible='true'
:title="edit?$t('Edit event'):$t('New event')" hide-footer)
b-container
el-tabs.mb-2(v-model='activeTab' v-loading='sending' @tab-click.native='changeTab')
el-form
el-tabs.mb-2(v-model='activeTab' v-loading='sending')
//- NOT LOGGED EVENT
el-tab-pane(v-if='!logged')
@@ -36,12 +36,13 @@
:picker-options="{start: '00:00', step: '00:30', end: '24:00'}")
el-button.float-right(@click='next' :disabled='!couldProceed') {{$t('Next')}}
//- WHAT
el-tab-pane
span(slot='label') {{$t('What')}} <v-icon name='file-alt'/>
span {{$t('what_explanation')}}
el-input.mb-3(v-model='event.title' ref='title')
span {{$t('description_explanation')}}
el-input.mb-3(v-model='event.description' type='textarea' :rows='3')
el-input.mb-3(v-model='event.description' type='textarea' :rows='9')
span {{$t('tag_explanation')}}
br
el-select(v-model='event.tags' multiple filterable allow-create
@@ -143,9 +144,6 @@ export default {
},
methods: {
...mapActions(['addEvent', 'updateEvent', 'updateMeta']),
changeTab (tab) {
if (this.activeTab === "2") this.$refs.title.focus()
},
next () {
this.activeTab = String(Number(this.activeTab)+1)
if (this.activeTab === "2") {
@@ -171,9 +169,9 @@ export default {
const [ end_hour, end_minute ] = this.time.end.split(':')
if (this.event.multidate) {
start_datetime = moment(this.date.start)
.hour(start_hour).minute(start_minute)
.set('hour', start_hour).set('minute', start_minute)
end_datetime = moment(this.date.end)
.hour(end_hour).minute(end_minute)
.set('hour', end_hour).set('minute', end_minute)
} else {
console.log(this.date)
start_datetime = moment(this.date).set('hour', start_hour).set('minute', start_minute)

View File

@@ -28,7 +28,7 @@ const it = {
<li>Per il computer fisso/portatile consigliamo Feedbro, da installare all'interno <a href="https://addons.mozilla.org/en-GB/firefox/addon/feedbroreader/">di Firefox </a>o <a href="https://chrome.google.com/webstore/detail/feedbro/mefgmmbdailogpfhfblcnnjfmnpnmdfa">di Chrome</a> e compatibile con tutti i principali sistemi operativi.</li>
<br/>
Aggiungendo questo link al tuo lettore di feed, rimarrai aggiornata.`,
export_email_explanation: `Puoi ricevere via mail gli eventi che ti interessano [WIP]`,
export_email_explanation: `Puoi ricevere via mail gli eventi che ti interessano.`,
export_list_explanation: `Se hai un sito web e vuoi mostrare una lista di eventi, puoi usare il seguente codice [WIP]`,
export_calendar_explanation: `Se hai un sito web e vuoi mostrare un calendario di eventi, puoi usare il seguente codice [WIP]`,
export_ical_explanation: `I computer e gli smartphone sono comunemente attrezzati con un'applicazione per gestire un calendario. A questi programmi solitamente è possibile far importare un calendario remoto.`,
@@ -51,6 +51,8 @@ const it = {
Deactivate: 'Disattiva',
Activate: 'Attiva',
'Remove Admin': 'Rimuovi Admin',
'Remove notification': 'Rimuovi notifiche',
Yes: 'Sì',
Users: 'Utenti',
Places: 'Luoghi',
Tags: 'Etichette',
@@ -70,6 +72,7 @@ const it = {
Admin: 'Amministra',
Today: 'Oggi',
Export: 'Esporta',
'Forgot password?': 'Hai dimenticato la password?',
'Mastodon instance': 'Istanza Mastodon',
'admin_mastodon_explanation': 'Puoi associare un account mastodon a questa istanza di gancio, ogni evento verrà pubblicato lì',
Associate: 'Associa',
@@ -91,7 +94,16 @@ const it = {
'Not registered?': `Non sei registrata?`,
new_event_added: `Evento aggiunto.`,
new_anon_event_added: `Evento inserito, verrà confermato quanto prima.`,
login_explanation: ``
login_explanation: `Entrando puoi pubblicare nuovi eventi.`,
recover_explanation: `Inserisci una nuova password:`,
'New password': 'Nuova password',
'Password reset': 'Password reset',
password_changed: 'Password cambiata con successo',
password_not_changed: 'Errore nella modifica della password!',
'Insert your email': 'Inserisci la tua email',
error_recover_code: `Ops, c'è stato un problema, hai richiesto più reset password?`,
email_notification_activated: 'Notifiche via mail attivate. Per disattivarle puoi usare il link in fondo ad ogni email che ricevi.'
}
export default it

View File

@@ -9,6 +9,8 @@ import Register from './components/Register'
import Export from './components/Export'
import Admin from './components/Admin'
import About from './components/About'
import DelNotification from './components/DelNotification'
import Recover from './components/Recover'
Vue.use(Router)
@@ -55,6 +57,14 @@ export default new Router({
{
path: '/about',
components: { modal: About }
},
{
path: '/del_notification/:code',
components: { modal: DelNotification }
},
{
path: '/recover/:recover_code',
components: { modal: Recover }
}
]
})