fix #26, too big image
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
{
|
||||
"title": "Gancio",
|
||||
"description": "A shared agenda for local communities",
|
||||
"baseurl": "http://localhost:3000",
|
||||
"baseurl": "http://localhost:13120",
|
||||
"server": {
|
||||
"host": "localhost",
|
||||
"port": 3000
|
||||
"port": 13120
|
||||
},
|
||||
"db": {
|
||||
"dialect": "sqlite",
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
FROM node:latest
|
||||
EXPOSE 13120
|
||||
WORKDIR /
|
||||
#COPY config/default.json /data/gancio/config/gancio_config.json
|
||||
RUN yarn global add gancio
|
||||
#ENTRYPOINT ["gancio", "--config", "/gancio/config.json"]
|
||||
#CMD ["gancio", "start", "--config", "/data/gancio/gancio_config.json"]
|
||||
RUN yarn global add gancio
|
||||
@@ -129,7 +129,8 @@ const it = {
|
||||
recurrent_1m_ordinal: 'Il {n} {days} di ogni mese',
|
||||
recurrent_2m_ordinal: 'Il {n} {days} un mese sì e uno no',
|
||||
due: 'alle',
|
||||
from: 'Dalle'
|
||||
from: 'Dalle',
|
||||
image_too_big: 'Immagine troppo grande! Massimo 4M'
|
||||
},
|
||||
|
||||
admin: {
|
||||
|
||||
@@ -102,6 +102,8 @@
|
||||
:limit="1"
|
||||
:auto-upload='false'
|
||||
drag
|
||||
accept='image/*'
|
||||
:on-remove='cleanFile'
|
||||
:on-change='uploadedFile'
|
||||
:multiple='false'
|
||||
:file-list="fileList"
|
||||
@@ -347,7 +349,16 @@ export default {
|
||||
}
|
||||
this.$refs.address.focus()
|
||||
},
|
||||
cleanFile () {
|
||||
this.event.image = null
|
||||
},
|
||||
uploadedFile(file, fileList) {
|
||||
if (file.size / 1024/ 1024 > 4) {
|
||||
Message({ type: 'warning', showClose: true, message: this.$tc('event.image_too_big') })
|
||||
this.fileList = []
|
||||
return false
|
||||
}
|
||||
this.fileList = [{name: file.name, url: file.url}]
|
||||
this.event.image = file
|
||||
},
|
||||
async done () {
|
||||
@@ -414,8 +425,15 @@ export default {
|
||||
this.loading = false
|
||||
Message({ type: 'success', showClose: true, message: this.$auth.loggedIn ? this.$t('event.added') : this.$t('event.added_anon')})
|
||||
} catch (e) {
|
||||
switch(e.request.status) {
|
||||
case 413:
|
||||
Message({ type: 'error', showClose: true, message: this.$t('event.image_too_big') })
|
||||
break;
|
||||
default:
|
||||
console.error(e)
|
||||
Message({ type: 'error', showClose: true, message: e })
|
||||
}
|
||||
this.loading = false
|
||||
Message({ type: 'danger', showClose: true, message: e })
|
||||
console.error(e)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user