Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vocalise correctement le nom de la procédure avec un lecteur d'écran sur le tableau de bord #883

Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion confiture-web-app/src/pages/FeedbackPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,10 @@ const router = useRouter();

const { route, url } = usePreviousRoute();
const previousPageUrl = url ?? router.resolve({ name: "home" }).href;
const previousPageName = route?.meta.name ?? "précédente";
const previousPageName =
(typeof route?.meta.name === "function"
? route?.meta.name()
: route?.meta.name) ?? "précédente";
</script>

<template>
Expand Down
10 changes: 6 additions & 4 deletions confiture-web-app/src/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import { useAccountStore, useAuditStore } from "./store";
declare module "vue-router" {
interface RouteMeta {
// add a `meta.name` property to have the route's name appear in "go back to [name]" prompts
name: string;
name: string | (() => string);
hideHomeLink?: boolean;
authRequired?: boolean;
}
Expand All @@ -46,7 +46,7 @@ export const history = createWebHistory();
*/
function getProcedureName() {
const auditStore = useAuditStore();
return auditStore.currentAudit?.procedureName ?? "Mon audit";
return auditStore.currentAudit?.procedureName ?? "de mon audit";
}

const router = createRouter({
Expand Down Expand Up @@ -238,7 +238,7 @@ const router = createRouter({
name: "audit-overview",
component: AuditOverviewPage,
meta: {
name: `Synthèse ${getProcedureName}`
name: () => `Synthèse ${getProcedureName()}`
}
},
// Report pages
Expand Down Expand Up @@ -368,7 +368,9 @@ router.afterEach(async (to, from) => {
if (from.path !== to.path) {
const pageTitleAlert = document.querySelector("#page-title-alert");
if (pageTitleAlert) {
pageTitleAlert.innerHTML = `<p>${to.meta.name}</p>`;
pageTitleAlert.innerHTML = `<p>${
typeof to.meta.name === "function" ? to.meta.name() : to.meta.name
}</p>`;

setTimeout(() => {
pageTitleAlert.innerHTML = "";
Expand Down
Loading