Browse Source

various fixes

Olivier Massot 2 years ago
parent
commit
e3517459a9

+ 1 - 1
components/Layout/Alert/Content.vue

@@ -55,7 +55,7 @@ const pageStore = usePageStore()
  * Retire l'alerte après `time` (en ms)
  * @param time
  */
-const clearAlert = (time: number = 2000) => {
+const clearAlert = (time: number = 4000) => {
   timeout = setTimeout(() => {
     show.value = false
     pageStore.removeSlowlyAlert()

+ 3 - 3
components/Layout/Parameters/Website.vue

@@ -16,7 +16,7 @@
           </div>
 
           <div class="mb-6">
-            <div>{{ $t('subdomains_history') }} : </div>
+            <div>{{ $t('your_subdomains') }} : </div>
             <UiLoadingPanel v-if="subdomainsPending" />
             <div v-else>
               <v-table class="my-2">
@@ -105,14 +105,14 @@ const canAddNewSubdomain: ComputedRef<boolean> = computed(() => subdomains.value
 
 
 const goToEditPage = (id: number) => {
-  router.push(`parameters/subdomains/${id}`)
+  navigateTo(`parameters/subdomains/${id}`)
 }
 
 const onAddSubdomainClick = () => {
   if (!canAddNewSubdomain) {
     throw new Error('Max number of subdomains reached')
   }
-
+  navigateTo('/parameters/subdomains/new')
 
 }
 

+ 6 - 8
components/Ui/Form.vue

@@ -254,9 +254,9 @@ const afterSubmissionAction = (action: string | null, updatedEntity: AnyJson) =>
   const actionArgs = props.submitActions[action]
 
   if (action === SUBMIT_TYPE.SAVE) {
-    afterSaveAction(actionArgs, updatedEntity.id, router)
+    afterSaveAction(actionArgs, updatedEntity.id)
   } else if (action === SUBMIT_TYPE.SAVE_AND_BACK) {
-    afterSaveAndQuitAction(actionArgs, router)
+    afterSaveAndQuitAction(actionArgs)
   }
 }
 
@@ -268,12 +268,11 @@ const afterSubmissionAction = (action: string | null, updatedEntity: AnyJson) =>
  *
  * @param route
  * @param id
- * @param router
  */
-function afterSaveAction(route: Route, id: number, router: any){
+function afterSaveAction(route: Route, id: number){
   if (useFormStore().formFunction === FORM_FUNCTION.CREATE) {
     route.path += id
-    router.push(route)
+    navigateTo(route)
   }
 }
 
@@ -283,10 +282,9 @@ function afterSaveAction(route: Route, id: number, router: any){
  * On redirige vers la route donnée
  *
  * @param route
- * @param router
  */
-function afterSaveAndQuitAction(route: Route, router: any){
-  router.push(route)
+function afterSaveAndQuitAction(route: Route){
+  navigateTo(route)
 }
 
 /**

+ 2 - 2
lang/fr.json

@@ -606,7 +606,7 @@
   "an_error_happened": "Une erreur s'est produite",
   "your_opentalent_website_address_is": "L'adresse de votre site Opentalent est",
   "record_a_new_subdomain": "Enregistrer un nouveau sous-domaine",
-  "subdomains_history": "Historique de vos sous-domaine(s)",
+  "your_subdomains": "Vos sous-domaines",
   "desactivateOpentalentSiteWeb": "Désactiver le site Opentalent",
   "Not Found": "Données non trouvée",
   "subdomains_breadcrumbs": "Sous-domaines",
@@ -617,5 +617,5 @@
   "This organization can not register new subdomains": "Nombre maximum de sous-domaines enregistrés atteint",
   "This subdomain is not available": "Ce sous-domaine n'est pas disponible",
   "This subdomain is already registered": "Ce sous-domaine est déjà enregistré",
-  "subdomain_activated": "Le sous-domaine a bien été activé"
+  "subdomain_activated_and_available_in_a_few_minutes": "Le sous-domaine a bien été activé, et sera accessible d'ici quelques minutes"
 }

+ 1 - 1
pages/parameters/subdomains/[id].vue

@@ -74,7 +74,7 @@
     pageStore.loading = true
     await em.patch(Subdomain, id, { active: true} )
     await refreshProfile()
-    usePageStore().addAlert(TYPE_ALERT.SUCCESS, ['subdomain_activated'])
+    usePageStore().addAlert(TYPE_ALERT.SUCCESS, ['subdomain_activated_and_available_in_a_few_minutes'])
     quit()
   }
 

+ 4 - 2
pages/parameters/subdomains/new.vue

@@ -40,7 +40,7 @@
         </v-container>
 
         <template #form.button>
-          <NuxtLink :to="{ path: '/parameters#website'}" class="no-decoration">
+          <NuxtLink :to="goBackRoute" class="no-decoration">
             <v-btn class="mr-4 theme-neutral">
               {{ $t('back') }}
             </v-btn>
@@ -70,9 +70,11 @@ const { subdomainValidation } = useSubdomainValidation()
 //@ts-ignore
 const subdomain: Ref<Subdomain> = ref(em.newInstance(Subdomain) as Subdomain)
 
+const goBackRoute = { path: `/parameters`, query: { tab: 'website' } }
+
 const submitActions = computed(() => {
   let actions: AnyJson = {}
-  actions[SUBMIT_TYPE.SAVE_AND_BACK] = { path: `/parameters/communication` }
+  actions[SUBMIT_TYPE.SAVE_AND_BACK] = goBackRoute
   return actions
 })