Ajouter templates pour routes principales

Ajouter templates au lieu de retourner une string de titre de la route.
This commit is contained in:
Victor Lacasse-Beaudoin 2023-03-24 20:05:52 -04:00
parent 42ed8bbd79
commit d8144c24ff
6 changed files with 75 additions and 5 deletions

View file

@ -0,0 +1,14 @@
{{ define "a-propos-html" }}
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="utf-8">
<title>AGECEM | À propos</title>
{{ template "general-html" }}
</head>
<body>
{{ template "header-html" }}
<h1>À propos</h1>
</body>
</html>
{{ end }}

View file

@ -0,0 +1,14 @@
{{ define "actualite-html" }}
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="utf-8">
<title>AGECEM | Actualité</title>
{{ template "general-html" }}
</head>
<body>
{{ template "header-html" }}
<h1>Actualité</h1>
</body>
</html>
{{ end }}

View file

@ -0,0 +1,14 @@
{{ define "documentation-html" }}
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="utf-8">
<title>AGECEM | Documentation</title>
{{ template "general-html" }}
</head>
<body>
{{ template "header-html" }}
<h1>Documentation</h1>
</body>
</html>
{{ end }}

View file

@ -0,0 +1,14 @@
{{ define "formulaires-html" }}
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="utf-8">
<title>AGECEM | Formulaires</title>
{{ template "general-html" }}
</head>
<body>
{{ template "header-html" }}
<h1>Formulaires</h1>
</body>
</html>
{{ end }}

View file

@ -0,0 +1,14 @@
{{ define "vie-etudiante-html" }}
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="utf-8">
<title>AGECEM | Vie étudiante</title>
{{ template "general-html" }}
</head>
<body>
{{ template "header-html" }}
<h1>Vie étudiante</h1>
</body>
</html>
{{ end }}

View file

@ -92,11 +92,11 @@ func handleIndex(c echo.Context) error {
}
func handleAPropos(c echo.Context) error {
return c.String(http.StatusOK, "À Propos")
return c.Render(http.StatusOK, "a-propos-html", nil)
}
func handleActualite(c echo.Context) error {
return c.String(http.StatusOK, "Actualité")
return c.Render(http.StatusOK, "actualite-html", nil)
}
func handleActualiteArticle(c echo.Context) error {
@ -104,17 +104,17 @@ func handleActualiteArticle(c echo.Context) error {
return c.String(http.StatusOK, fmt.Sprintf("Article: %s", article))
}
func handleVieEtudiante(c echo.Context) error {
return c.String(http.StatusOK, "Vie Étudiante")
return c.Render(http.StatusOK, "vie-etudiante-html", nil)
}
func handleVieEtudianteOrganisme(c echo.Context) error {
organisme := c.Param("organisme")
return c.String(http.StatusOK, fmt.Sprintf("Organisme: %s", organisme))
}
func handleDocumentation(c echo.Context) error {
return c.String(http.StatusOK, "Documentation")
return c.Render(http.StatusOK, "documentation-html", nil)
}
func handleFormulaires(c echo.Context) error {
return c.String(http.StatusOK, "Formulaires")
return c.Render(http.StatusOK, "formulaires-html", nil)
}
// CSS Handlers