diff --git a/package.json b/package.json index f70f5cd..aa1ed42 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,7 @@ "register-service-worker": "^1.7.1", "tiptap-vuetify": "^2.23.0", "vue": "^2.6.11", - "vue-apitator": "^0.0.16", + "vue-apitator": "0.0.17", "vue-class-component": "^7.2.3", "vue-croppa": "^1.3.8", "vue-input-facade": "^1.3.1", diff --git a/src/App.vue b/src/App.vue index f7e024b..1259643 100644 --- a/src/App.vue +++ b/src/App.vue @@ -20,6 +20,9 @@ export default Vue.extend({ created () { console.log('Using ' + process.env.VUE_APP_BASE_URL) + if (window.localStorage.getItem('associations_condorcet_debug') === 'YES') { + this.$store.commit('SET_DEBUG', true) + } }, data: () => ({}) diff --git a/src/components/GlobalSnackbar.vue b/src/components/GlobalSnackbar.vue index e28463e..89c7932 100644 --- a/src/components/GlobalSnackbar.vue +++ b/src/components/GlobalSnackbar.vue @@ -6,7 +6,7 @@ :vertical="$vuetify.breakpoint.mobile" :multi-line="$vuetify.breakpoint.mobile" v-model="$store.state.alert.enabled" - :timeout="500000" + :timeout="2500" > {{ $store.state.alert.text }} diff --git a/src/layouts/Delegate.vue b/src/layouts/Delegate.vue index 5122a7f..5af7d4c 100644 --- a/src/layouts/Delegate.vue +++ b/src/layouts/Delegate.vue @@ -58,7 +58,7 @@ Images/vidéos - + Description @@ -254,7 +254,7 @@ export default { selectRoute (route) { const path = route.path.split('/') const name = path[path.length - 1] - const routes = ['', 'gallery', 'presentation', 'schedule', 'pricing', 'contact'] + const routes = ['', 'gallery', 'description', 'schedule', 'pricing', 'contact'] this.tab = routes.indexOf(name) }, init () { @@ -374,15 +374,22 @@ export default { } }, goToPage () { - window.open(this.publicUrl, '_blank').focus() + window.open(this.$store.state.delegate.publicUrl, '_blank').focus() }, openPublishModal () { // compute if the user can ask approval - this.publishModal = true - const data = this.$store.state.data - this.canPublish = - data.name.length > 0 && - data.descriptionShort.length > 10 + this.$store.commit('VALIDATE_MAIN', isValid => { + if (isValid) { + this.publishModal = true + } else { + this.$store.commit('ADD_ALERT', { + color: 'error', + text: 'Vous devez remplir tout les champs requis afin de publier' + }) + this.publishModal = false + } + this.canPublish = isValid + }) }, askApproval () { this.askingApprovalLoading = true diff --git a/src/router/index.ts b/src/router/index.ts index aac6ed2..78eeb20 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -46,14 +46,14 @@ const routes: Array = [ component: () => import(/* webpackChunkName: "delegateMain" */ '../views/Delegate/Main.vue') }, { - path: 'contact', - name: 'DelegateContact', - component: () => import(/* webpackChunkName: "delegateContact" */ '../views/Delegate/Contact.vue') + path: 'gallery', + name: 'DelegateGallery', + component: () => import(/* webpackChunkName: "delegateGallery" */ '../views/Delegate/Gallery.vue') }, { - path: 'pricing', - name: 'DelegatePricing', - component: () => import(/* webpackChunkName: "delegatePricing" */ '../views/Delegate/Pricing.vue') + path: 'description', + name: 'DelegateDescription', + component: () => import(/* webpackChunkName: "delegateDescription" */ '../views/Delegate/Description.vue') }, { path: 'schedule', @@ -61,16 +61,21 @@ const routes: Array = [ component: () => import(/* webpackChunkName: "delegateSchedule" */ '../views/Delegate/Schedule.vue') }, { - path: 'gallery', - name: 'DelegateGallery', - component: () => import(/* webpackChunkName: "delegateGallery" */ '../views/Delegate/Gallery.vue') + path: 'pricing', + name: 'DelegatePricing', + component: () => import(/* webpackChunkName: "delegatePricing" */ '../views/Delegate/Pricing.vue') }, { - path: 'presentation', - name: 'DelegatePresentation', - component: () => import(/* webpackChunkName: "delegatePresentation" */ '../views/Delegate/Presentation.vue') + path: 'contact', + name: 'DelegateContact', + component: () => import(/* webpackChunkName: "delegateContact" */ '../views/Delegate/Contact.vue') } ] + }, + { + path: '*', + name: 'NotFound', + component: () => import(/* webpackChunkName: "notFound" */ '../views/NotFound.vue') } ] diff --git a/src/store/index.ts b/src/store/index.ts index b06ac16..d226422 100644 --- a/src/store/index.ts +++ b/src/store/index.ts @@ -38,11 +38,18 @@ export default new Vuex.Store({ admiName: '', email: '', publicUrl: '' - } + }, + debug: false, + validateMain: false, + validateMainCallback: () => false }, mutations: { + SET_DEBUG (state, payload) { + state.debug = payload + }, SET_TITLE (state, payload) { state.title = payload + window.document.title = state.title + ' | Panel forum des associations' }, ADD_ALERT (state, payload) { state.alert = { @@ -64,6 +71,13 @@ export default new Vuex.Store({ }, SET_DELEGATE (state, payload) { state.delegate = { ...state.delegate, ...payload } + }, + VALIDATE_MAIN (state, callback) { + state.validateMain = true + state.validateMainCallback = () => { + state.validateMain = false + return callback() + } } }, actions: { diff --git a/src/views/Delegate/Contact.vue b/src/views/Delegate/Contact.vue index 94713c7..d29e885 100644 --- a/src/views/Delegate/Contact.vue +++ b/src/views/Delegate/Contact.vue @@ -1,26 +1,13 @@