Merge pull request 'Ajouter render pour routes principales' (#29) from feature/render-routes into main
Reviewed-on: #29
This commit is contained in:
commit
643100f325
11 changed files with 92 additions and 11 deletions
3
public/css/general.css
Normal file
3
public/css/general.css
Normal file
|
@ -0,0 +1,3 @@
|
|||
h1 {
|
||||
text-align: center;
|
||||
}
|
|
@ -1,3 +0,0 @@
|
|||
h1 {
|
||||
text-align: center;
|
||||
}
|
14
public/html/a-propos.gohtml
Normal file
14
public/html/a-propos.gohtml
Normal 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 }}
|
14
public/html/actualite.gohtml
Normal file
14
public/html/actualite.gohtml
Normal 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 }}
|
14
public/html/documentation.gohtml
Normal file
14
public/html/documentation.gohtml
Normal 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 }}
|
14
public/html/formulaires.gohtml
Normal file
14
public/html/formulaires.gohtml
Normal 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 }}
|
3
public/html/general.gohtml
Normal file
3
public/html/general.gohtml
Normal file
|
@ -0,0 +1,3 @@
|
|||
{{ define "general-html" }}
|
||||
<link rel="stylesheet" href="static/general.css">
|
||||
{{ end }}
|
|
@ -1,4 +1,4 @@
|
|||
{{ define "header" }}
|
||||
{{ define "header-html" }}
|
||||
|
||||
<ul>
|
||||
<li><a href="/">index</a></li>
|
||||
|
|
|
@ -4,10 +4,11 @@
|
|||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>AGECEM</title>
|
||||
{{ template "general-html" }}
|
||||
<link rel="stylesheet" href="static/index.css">
|
||||
</head>
|
||||
<body>
|
||||
{{ template "header" }}
|
||||
{{ template "header-html" }}
|
||||
<h1>Association Générale Étudiante du Cégep Édouard-Montpetit</h1>
|
||||
</body>
|
||||
</html>
|
||||
|
|
14
public/html/vie-etudiante.gohtml
Normal file
14
public/html/vie-etudiante.gohtml
Normal 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 }}
|
19
server.go
19
server.go
|
@ -46,6 +46,8 @@ func Execute() {
|
|||
|
||||
// Static Routes
|
||||
|
||||
e.GET("/static/general.css", handleStaticCSSGeneral)
|
||||
|
||||
e.GET("/static/index.css", handleStaticCSSIndex)
|
||||
|
||||
// HTML Routes
|
||||
|
@ -90,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 {
|
||||
|
@ -102,24 +104,29 @@ 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
|
||||
|
||||
func handleStaticCSSIndex(c echo.Context) error {
|
||||
// TODO Ajouter gestion d'erreurs
|
||||
// TODO Ajouter support pour fichiers SCSS
|
||||
data, _ := embedFS.ReadFile("css/index.css")
|
||||
return c.Blob(http.StatusOK, "text/css", data)
|
||||
}
|
||||
|
||||
func handleStaticCSSGeneral(c echo.Context) error {
|
||||
// TODO Ajouter gestion d'erreurs
|
||||
data, _ := embedFS.ReadFile("css/general.css")
|
||||
return c.Blob(http.StatusOK, "text/css", data)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue