bugs fixes
This commit is contained in:
parent
419e6a1a71
commit
46953da4cc
7 changed files with 131 additions and 62 deletions
|
@ -156,7 +156,7 @@ export default {
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
created () {
|
mounted () {
|
||||||
let peoples = this.$store.state.data.contacts.peoples
|
let peoples = this.$store.state.data.contacts.peoples
|
||||||
if (!Array.isArray(peoples)) {
|
if (!Array.isArray(peoples)) {
|
||||||
peoples = []
|
peoples = []
|
||||||
|
|
|
@ -9,14 +9,15 @@
|
||||||
<v-card-text>
|
<v-card-text>
|
||||||
<v-layout justify-center>
|
<v-layout justify-center>
|
||||||
<croppa
|
<croppa
|
||||||
|
ref="croppa"
|
||||||
class="canvas-container"
|
class="canvas-container"
|
||||||
v-model="plugin"
|
v-model="plugin"
|
||||||
:show-remove-button="false"
|
|
||||||
canvas-color="white"
|
canvas-color="white"
|
||||||
:width="width"
|
|
||||||
:height="height"
|
|
||||||
accept="image/jpeg,image/png"
|
accept="image/jpeg,image/png"
|
||||||
prevent-white-space
|
prevent-white-space
|
||||||
|
:width="width"
|
||||||
|
:height="height"
|
||||||
|
:show-remove-button="false"
|
||||||
:initial-image="imageUrl"
|
:initial-image="imageUrl"
|
||||||
:placeholder-font-size="22"
|
:placeholder-font-size="22"
|
||||||
@file-size-exceed="handleFileSizeExceed"
|
@file-size-exceed="handleFileSizeExceed"
|
||||||
|
@ -108,6 +109,11 @@ export default {
|
||||||
methods: {
|
methods: {
|
||||||
toggle: function () {
|
toggle: function () {
|
||||||
this.enabled = !this.enabled
|
this.enabled = !this.enabled
|
||||||
|
this.$nextTick(() => {
|
||||||
|
if (this.enabled) {
|
||||||
|
this.$refs.croppa.refresh()
|
||||||
|
}
|
||||||
|
})
|
||||||
},
|
},
|
||||||
clear: function () {
|
clear: function () {
|
||||||
this.plugin.remove()
|
this.plugin.remove()
|
||||||
|
|
|
@ -29,6 +29,9 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<v-list>
|
<v-list>
|
||||||
|
<v-list-item @click="openPreviewModal()">
|
||||||
|
<v-list-item-title>Prévisualiser votre page</v-list-item-title>
|
||||||
|
</v-list-item>
|
||||||
<v-list-item @click="goToPage()">
|
<v-list-item @click="goToPage()">
|
||||||
<v-list-item-title>Ouvrir la page publique</v-list-item-title>
|
<v-list-item-title>Ouvrir la page publique</v-list-item-title>
|
||||||
</v-list-item>
|
</v-list-item>
|
||||||
|
@ -205,11 +208,24 @@
|
||||||
</v-card-actions>
|
</v-card-actions>
|
||||||
</v-card>
|
</v-card>
|
||||||
</v-dialog>
|
</v-dialog>
|
||||||
|
<Preview
|
||||||
|
ref="preview"
|
||||||
|
:enabled="previewModal"
|
||||||
|
:id="$store.state.delegate._id"
|
||||||
|
:slug="$store.state.delegate.slug"
|
||||||
|
:dialogTitle="'Prévisualiser votre page publique'"
|
||||||
|
@close="previewModal = false"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import Preview from '../components/Preview'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
components: {
|
||||||
|
Preview
|
||||||
|
},
|
||||||
data: () => ({
|
data: () => ({
|
||||||
enabled: false,
|
enabled: false,
|
||||||
loading: true,
|
loading: true,
|
||||||
|
@ -222,7 +238,8 @@ export default {
|
||||||
publishModal: false,
|
publishModal: false,
|
||||||
askingApprovalLoading: false,
|
askingApprovalLoading: false,
|
||||||
rejectionDetailsModal: false,
|
rejectionDetailsModal: false,
|
||||||
showPassword: false
|
showPassword: false,
|
||||||
|
previewModal: false
|
||||||
}),
|
}),
|
||||||
created () {
|
created () {
|
||||||
this.init()
|
this.init()
|
||||||
|
@ -252,6 +269,14 @@ export default {
|
||||||
// }, 3000)
|
// }, 3000)
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
openPreviewModal () {
|
||||||
|
this.save(false).then(() => {
|
||||||
|
this.$refs.preview.reload()
|
||||||
|
this.previewModal = true
|
||||||
|
}).catch((err) => {
|
||||||
|
console.log(err)
|
||||||
|
})
|
||||||
|
},
|
||||||
selectRoute (route) {
|
selectRoute (route) {
|
||||||
const path = route.path.split('/')
|
const path = route.path.split('/')
|
||||||
const name = path[path.length - 1]
|
const name = path[path.length - 1]
|
||||||
|
@ -295,8 +320,10 @@ export default {
|
||||||
const proposedVersion = res.data.data.organization.proposedVersion
|
const proposedVersion = res.data.data.organization.proposedVersion
|
||||||
const tags = res.data.data.tags
|
const tags = res.data.data.tags
|
||||||
this.$store.commit('SET_DELEGATE', {
|
this.$store.commit('SET_DELEGATE', {
|
||||||
|
_id: organization._id,
|
||||||
adminName: organization.adminName,
|
adminName: organization.adminName,
|
||||||
email: organization.email,
|
email: organization.email,
|
||||||
|
slug: organization.slugs[organization.slugs.length - 1],
|
||||||
publicUrl: process.env.VUE_APP_BASE_URL + '/association/' + organization.slugs[organization.slugs.length - 1],
|
publicUrl: process.env.VUE_APP_BASE_URL + '/association/' + organization.slugs[organization.slugs.length - 1],
|
||||||
validationState: organization.validationState,
|
validationState: organization.validationState,
|
||||||
rejectionDescription: organization.rejectionDescription
|
rejectionDescription: organization.rejectionDescription
|
||||||
|
@ -326,41 +353,47 @@ export default {
|
||||||
window.localStorage.removeItem('delegateToken')
|
window.localStorage.removeItem('delegateToken')
|
||||||
this.$router.push('/')
|
this.$router.push('/')
|
||||||
},
|
},
|
||||||
save () {
|
save (showSuccessAlert = true) {
|
||||||
this.isSaving = true
|
return new Promise((resolve, reject) => {
|
||||||
const data = this.$store.state.data
|
this.isSaving = true
|
||||||
data.pricing = data.pricing.map(i => {
|
const data = this.$store.state.data
|
||||||
delete i._id
|
data.pricing = data.pricing.map(i => {
|
||||||
return i
|
delete i._id
|
||||||
})
|
return i
|
||||||
data.schedule = data.schedule.map(i => {
|
})
|
||||||
delete i._id
|
data.schedule = data.schedule.map(i => {
|
||||||
if (Array.isArray(i.when) && i.when.length > 0) {
|
delete i._id
|
||||||
i.when = i.when.map(w => {
|
if (Array.isArray(i.when) && i.when.length > 0) {
|
||||||
delete w._id
|
i.when = i.when.map(w => {
|
||||||
return w
|
delete w._id
|
||||||
|
return w
|
||||||
|
})
|
||||||
|
}
|
||||||
|
return i
|
||||||
|
})
|
||||||
|
if (Array.isArray(data.contacts.peoples)) {
|
||||||
|
data.contacts.peoples = data.contacts.peoples.map(p => {
|
||||||
|
delete p._id
|
||||||
|
return p
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
return i
|
this.$apitator.put('/delegate', data, { withAuth: true }).then(() => {
|
||||||
})
|
this.isSaving = false
|
||||||
if (Array.isArray(data.contacts.peoples)) {
|
if (showSuccessAlert) {
|
||||||
data.contacts.peoples = data.contacts.peoples.map(p => {
|
this.$store.commit('ADD_ALERT', {
|
||||||
delete p._id
|
color: 'success',
|
||||||
return p
|
text: 'Vos changements ont été sauvegardés !'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
this.$apitator.put('/delegate', data, { withAuth: true }).then(() => {
|
resolve()
|
||||||
this.isSaving = false
|
}).catch(err => {
|
||||||
this.$store.commit('ADD_ALERT', {
|
console.log(err.data)
|
||||||
color: 'success',
|
this.isSaving = false
|
||||||
text: 'Vos changements ont été sauvegardés !'
|
this.$store.commit('ADD_ALERT', {
|
||||||
})
|
color: 'error',
|
||||||
}).catch(err => {
|
text: 'Impossible de sauvegarder vos changements'
|
||||||
console.log(err.data)
|
})
|
||||||
this.isSaving = false
|
reject(err)
|
||||||
this.$store.commit('ADD_ALERT', {
|
|
||||||
color: 'error',
|
|
||||||
text: 'Impossible de sauvegarder vos changements'
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
@ -378,20 +411,34 @@ export default {
|
||||||
window.open(this.$store.state.delegate.publicUrl, '_blank').focus()
|
window.open(this.$store.state.delegate.publicUrl, '_blank').focus()
|
||||||
},
|
},
|
||||||
openPublishModal () {
|
openPublishModal () {
|
||||||
// compute if the user can ask approval
|
const open = () => {
|
||||||
this.$store.commit('VALIDATE_MAIN', isValid => {
|
// compute if the user can ask approval
|
||||||
if (isValid) {
|
this.$store.commit('VALIDATE_MAIN', isValid => {
|
||||||
this.publishModal = true
|
if (isValid) {
|
||||||
this.save()
|
this.publishModal = true
|
||||||
} else {
|
this.save(false).catch((err) => {
|
||||||
this.$store.commit('ADD_ALERT', {
|
console.log(err)
|
||||||
color: 'error',
|
})
|
||||||
text: 'Vous devez remplir tout les champs requis afin de publier'
|
} else {
|
||||||
})
|
this.$store.commit('ADD_ALERT', {
|
||||||
this.publishModal = false
|
color: 'error',
|
||||||
}
|
text: 'Vous devez remplir tout les champs requis afin de publier'
|
||||||
this.canPublish = isValid
|
})
|
||||||
|
this.publishModal = false
|
||||||
|
}
|
||||||
|
this.canPublish = isValid
|
||||||
|
})
|
||||||
|
}
|
||||||
|
this.$store.state.validateMain = false
|
||||||
|
this.$router.push({ name: 'DelegateMain' }, () => {
|
||||||
|
this.$store.commit('ON_MAIN_READY', () => {
|
||||||
|
open()
|
||||||
|
return true
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
if (this.$route.name === 'DelegateMain') {
|
||||||
|
open()
|
||||||
|
}
|
||||||
},
|
},
|
||||||
askApproval () {
|
askApproval () {
|
||||||
this.askingApprovalLoading = true
|
this.askingApprovalLoading = true
|
||||||
|
|
|
@ -18,6 +18,7 @@ interface State {
|
||||||
debug: boolean;
|
debug: boolean;
|
||||||
validateMain: boolean;
|
validateMain: boolean;
|
||||||
validateMainCallback: any;
|
validateMainCallback: any;
|
||||||
|
onMainReady: any;
|
||||||
}
|
}
|
||||||
|
|
||||||
const defaultState: State = {
|
const defaultState: State = {
|
||||||
|
@ -52,6 +53,8 @@ const defaultState: State = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
delegate: {
|
delegate: {
|
||||||
|
_id: '',
|
||||||
|
slug: '',
|
||||||
validationState: 'unaware',
|
validationState: 'unaware',
|
||||||
admiName: '',
|
admiName: '',
|
||||||
email: '',
|
email: '',
|
||||||
|
@ -59,6 +62,7 @@ const defaultState: State = {
|
||||||
},
|
},
|
||||||
debug: false,
|
debug: false,
|
||||||
validateMain: false,
|
validateMain: false,
|
||||||
|
onMainReady: () => false,
|
||||||
validateMainCallback: (d = false) => d
|
validateMainCallback: (d = false) => d
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -99,6 +103,9 @@ export default new Vuex.Store({
|
||||||
state.validateMain = false
|
state.validateMain = false
|
||||||
return callback(d)
|
return callback(d)
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
ON_MAIN_READY (state: State, callback) {
|
||||||
|
state.onMainReady = callback
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
prepend-icon="public"
|
prepend-icon="public"
|
||||||
label="Site web"
|
label="Site web"
|
||||||
outlined
|
outlined
|
||||||
|
:rules="rules.website"
|
||||||
v-model="$store.state.data.contacts.website" />
|
v-model="$store.state.data.contacts.website" />
|
||||||
<v-textarea
|
<v-textarea
|
||||||
prepend-icon="room"
|
prepend-icon="room"
|
||||||
|
@ -94,7 +95,7 @@ export default {
|
||||||
data: () => ({
|
data: () => ({
|
||||||
rules: {
|
rules: {
|
||||||
website: [
|
website: [
|
||||||
v => v === '' || /.+@.+\..+/.test(v) || "L'email doit être valide"
|
v => v === '' || /^(?:http(s)?:\/\/)?[\w.-]+(?:\.[\w.-]+)+[\w\-._~:/?#[\]@!$&'()*+,;=.]+$/gm.test(v) || "L'adresse web doit être valide"
|
||||||
],
|
],
|
||||||
address: [
|
address: [
|
||||||
v => v.length < 200 || 'Maximum 200 caractères'
|
v => v.length < 200 || 'Maximum 200 caractères'
|
||||||
|
|
|
@ -119,8 +119,7 @@
|
||||||
<span>Décaler vers la droite</span>
|
<span>Décaler vers la droite</span>
|
||||||
</v-tooltip>
|
</v-tooltip>
|
||||||
<v-spacer />
|
<v-spacer />
|
||||||
|
<v-tooltip bottom v-if="media.contentType.split('/')[0] === 'image'">
|
||||||
<v-tooltip bottom>
|
|
||||||
<template v-slot:activator="{ on, attrs }">
|
<template v-slot:activator="{ on, attrs }">
|
||||||
<v-btn
|
<v-btn
|
||||||
icon
|
icon
|
||||||
|
@ -351,14 +350,14 @@ export default {
|
||||||
},
|
},
|
||||||
clearCover () {
|
clearCover () {
|
||||||
this.$store.commit('SET_DATA', {
|
this.$store.commit('SET_DATA', {
|
||||||
cover: undefined
|
cover: null
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
openMedia (item) {
|
openMedia (item) {
|
||||||
window.open(item.location, '_blank').focus()
|
window.open(item.location, '_blank').focus()
|
||||||
},
|
},
|
||||||
chooseAsCover (item) {
|
chooseAsCover (item) {
|
||||||
this.coverImage = item.location
|
this.coverImage = process.env.VUE_APP_BASE_URL + '/proxy-s3/' + item.key
|
||||||
this.$refs.avatarEditor.toggle()
|
this.$refs.avatarEditor.toggle()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -127,20 +127,29 @@ export default {
|
||||||
// })
|
// })
|
||||||
// },
|
// },
|
||||||
|
|
||||||
|
mounted () {
|
||||||
|
if (this.$store.state.onMainReady()) {
|
||||||
|
this.validate()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
watch: {
|
watch: {
|
||||||
'$store.state.validateMain' (val) {
|
'$store.state.validateMain' (val) {
|
||||||
if (val) {
|
if (val) {
|
||||||
this.validateLogo = true
|
this.validate()
|
||||||
this.$store.state.validateMainCallback(
|
|
||||||
this.$refs.form.validate() &&
|
|
||||||
this.$store.state.data.thumbnail.location.length > 1
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
handleAvatarEditorSubmitted: function (blob) {
|
validate () {
|
||||||
|
this.validateLogo = true
|
||||||
|
this.$store.state.validateMainCallback(
|
||||||
|
this.$refs.form.validate() &&
|
||||||
|
this.$store.state.data.thumbnail.location.length > 1
|
||||||
|
)
|
||||||
|
},
|
||||||
|
handleAvatarEditorSubmitted (blob) {
|
||||||
const form = new FormData()
|
const form = new FormData()
|
||||||
form.append('file', blob, blob.filename)
|
form.append('file', blob, blob.filename)
|
||||||
this.logoLoading = true
|
this.logoLoading = true
|
||||||
|
|
Loading…
Reference in a new issue