Skip to content

Commit

Permalink
Explicitly define page title
Browse files Browse the repository at this point in the history
  • Loading branch information
nas-tabchiche committed Dec 20, 2024
1 parent 88db7d0 commit 3bd7c68
Show file tree
Hide file tree
Showing 17 changed files with 43 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ import type { Actions } from '@sveltejs/kit';
import { fail } from 'assert';
import { setFlash } from 'sveltekit-flash-message/server';
import * as m from '$paraglide/messages';
import type { PageServerLoad } from './$types';

export const load: PageServerLoad = async (event) => {
return { title: m.backupRestore() };
};

export const actions: Actions = {
default: async (event) => {
Expand Down
6 changes: 6 additions & 0 deletions frontend/src/routes/(app)/(internal)/my-profile/+page.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import type { PageLoad } from './$types';
import * as m from '$paraglide/messages';

export const load: PageLoad = async () => {
return { title: m.myProfile() };
};
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export const load: PageServerLoad = async (event) => {

const activateTOTPForm = await superValidate(zod(activateTOTPSchema));

return { authenticators, totp, activateTOTPForm, recoveryCodes };
return { authenticators, totp, activateTOTPForm, recoveryCodes, title: m.settings() };
};

export const actions: Actions = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,5 @@ export const load: PageServerLoad = async (event) => {
meta: revData
};

return { data, table };
return { data, table, title: data.name };
};
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ export const load: LayoutServerLoad = async ({ fetch, params }) => {
scenarioDeleteForm,
scenarioCreateForm,
riskAssessmentDuplicateForm,
riskAssessmentModel
riskAssessmentModel,
title: risk_assessment.name
};
};
Original file line number Diff line number Diff line change
Expand Up @@ -91,5 +91,5 @@ export const load: LayoutServerLoad = async ({ fetch, params }) => {
})
);
}
return { data, relatedModels };
return { data, relatedModels, title: data.name };
};
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,8 @@ export const load: PageServerLoad = async ({ params, fetch }) => {
strengthOfKnowledgeChoices: strengthOfKnowledgeChoices,
tables,
measureModel,
measureCreateForm
measureCreateForm,
title: m.edit()
};
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { superValidate } from 'sveltekit-superforms';
import { zod } from 'sveltekit-superforms/adapters';
import type { PageServerLoad, Actions } from '../$types';
import { defaultWriteFormAction } from '$lib/utils/actions';
import * as m from '$paraglide/messages';

export const load: PageServerLoad = async (event) => {
const URLModel = 'ro-to';
Expand Down Expand Up @@ -57,7 +58,7 @@ export const load: PageServerLoad = async (event) => {
}
model.foreignKeys = foreignKeys;
model.selectOptions = selectOptions;
return { form, model, object, foreignKeys, selectOptions, URLModel };
return { form, model, object, foreignKeys, selectOptions, URLModel, title: m.edit() };
};

export const actions: Actions = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { BASE_API_URL } from '$lib/utils/constants';
import type { RiskMatrix, RiskMatrixJsonDefinition } from '$lib/utils/types';
import type { PageServerLoad } from './$types';
import { error } from '@sveltejs/kit';
import * as m from '$paraglide/messages';

export const load: PageServerLoad = async ({ fetch }) => {
const req = await fetch(`${BASE_API_URL}/risk-matrices/`);
Expand All @@ -15,6 +15,7 @@ export const load: PageServerLoad = async ({ fetch }) => {
);

return {
risk_matrices
risk_matrices,
title: m.scoringAssistant()
};
};
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ export const load: PageServerLoad = async ({ fetch }) => {
ssoModel,
generalSettings,
generalSettingForm,
generalSettingModel
generalSettingModel,
title: m.settings()
};
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,8 @@ export const load: LayoutServerLoad = async (event) => {
selectOptions,
URLModel,
measureCreateForm,
measureModel
measureModel,
title: m.edit()
};
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export const load: PageServerLoad = async ({ params, fetch }) => {

model.foreignKeys = foreignKeys;

return { form, model, object };
return { form, model, object, title: m.edit() };
};

export const actions: Actions = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { zod } from 'sveltekit-superforms/adapters';
export const load: PageServerLoad = async (event) => {
const form = await superValidate(event.request, zod(SetPasswordSchema));

return { form };
return { form, title: m.setPassword() };
};

export const actions: Actions = {
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/routes/(app)/(internal)/x-rays/+page.server.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { BASE_API_URL } from '$lib/utils/constants';

import * as m from '$paraglide/messages';
import type { PageServerLoad } from './$types';

export const load = (async ({ fetch }) => {
Expand All @@ -8,5 +8,5 @@ export const load = (async ({ fetch }) => {
const res = await fetch(endpoint);
const data = await res.json().then((res) => res.results);

return { data };
return { data, title: m.xRays() };
}) satisfies PageServerLoad;
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { BASE_API_URL } from '$lib/utils/constants';

import * as m from '$paraglide/messages';
import type { PageServerLoad } from './$types';

export const load = (async ({ fetch }) => {
Expand All @@ -8,5 +8,5 @@ export const load = (async ({ fetch }) => {
const res = await fetch(endpoint);
const data = await res.json();

return { data };
return { data, title: m.inspect() };
}) satisfies PageServerLoad;
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ export const load = (async ({ fetch, params }) => {
requirement_assessments,
requirements,
evidenceModel,
deleteForm
deleteForm,
title: m.tableMode()
};
}) satisfies PageServerLoad;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,12 @@ export const load = (async ({ fetch, params }) => {
}
}

return { requirementAssessment, complianceAssessmentScore, requirement, parent, tables };
return {
requirementAssessment,
complianceAssessmentScore,
requirement,
parent,
tables,
title: requirementAssessment.name
};
}) satisfies PageServerLoad;

0 comments on commit 3bd7c68

Please sign in to comment.