From a7334f4e0fee7886ba57e4f8b55797ecd6b13346 Mon Sep 17 00:00:00 2001 From: Victor Lacasse-Beaudoin Date: Fri, 24 Mar 2023 20:00:55 -0400 Subject: [PATCH 1/5] =?UTF-8?q?D=C3=A9placer=20css=20general=20vers=20gene?= =?UTF-8?q?ral.css?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Au lieu de mettre `text-align: center;` dans index.css, le déplacer vers general.css pour avoir un endroit où mettre le css général du site. --- public/css/general.css | 3 +++ public/css/index.css | 3 --- public/html/general.gohtml | 3 +++ public/html/index.gohtml | 1 + 4 files changed, 7 insertions(+), 3 deletions(-) create mode 100644 public/css/general.css create mode 100644 public/html/general.gohtml diff --git a/public/css/general.css b/public/css/general.css new file mode 100644 index 0000000..bbe2663 --- /dev/null +++ b/public/css/general.css @@ -0,0 +1,3 @@ +h1 { + text-align: center; +} diff --git a/public/css/index.css b/public/css/index.css index bbe2663..e69de29 100644 --- a/public/css/index.css +++ b/public/css/index.css @@ -1,3 +0,0 @@ -h1 { - text-align: center; -} diff --git a/public/html/general.gohtml b/public/html/general.gohtml new file mode 100644 index 0000000..ef11275 --- /dev/null +++ b/public/html/general.gohtml @@ -0,0 +1,3 @@ +{{ define "general-html" }} + +{{ end }} diff --git a/public/html/index.gohtml b/public/html/index.gohtml index 8c55116..1ef9920 100644 --- a/public/html/index.gohtml +++ b/public/html/index.gohtml @@ -4,6 +4,7 @@ AGECEM + {{ template "general-html" }} From 0a6961e338208cbd7af0e1c558b5c24ee36cecee Mon Sep 17 00:00:00 2001 From: Victor Lacasse-Beaudoin Date: Fri, 24 Mar 2023 20:02:46 -0400 Subject: [PATCH 2/5] Ajouter route /static/general.css --- server.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/server.go b/server.go index 6c13483..566d22b 100644 --- a/server.go +++ b/server.go @@ -46,6 +46,8 @@ func Execute() { // Static Routes + e.GET("/static/general.css", handleStaticCSSGeneral) + e.GET("/static/index.css", handleStaticCSSIndex) // HTML Routes @@ -123,3 +125,9 @@ func handleStaticCSSIndex(c echo.Context) error { 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) +} From ce387d3028857b165ddc7e39c571bea00a2b9f57 Mon Sep 17 00:00:00 2001 From: Victor Lacasse-Beaudoin Date: Fri, 24 Mar 2023 20:03:31 -0400 Subject: [PATCH 3/5] Retirer TODO pour SCSS MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Il a été décidé de mettre en suspens le support pour transpilage automatique de SCSS et d'utiliser directement CSS pour l'instant. --- server.go | 1 - 1 file changed, 1 deletion(-) diff --git a/server.go b/server.go index 566d22b..3441748 100644 --- a/server.go +++ b/server.go @@ -121,7 +121,6 @@ func handleFormulaires(c echo.Context) error { 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) } From 42ed8bbd7984e3f42386a8d1be572a538091ee7b Mon Sep 17 00:00:00 2001 From: Victor Lacasse-Beaudoin Date: Fri, 24 Mar 2023 20:04:57 -0400 Subject: [PATCH 4/5] Renommer template `header` pour `header-html` Pour suivre la nomenclature du reste du projet --- public/html/header.gohtml | 2 +- public/html/index.gohtml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/public/html/header.gohtml b/public/html/header.gohtml index 7769d51..f5bc28b 100644 --- a/public/html/header.gohtml +++ b/public/html/header.gohtml @@ -1,4 +1,4 @@ -{{ define "header" }} +{{ define "header-html" }}
  • index
  • diff --git a/public/html/index.gohtml b/public/html/index.gohtml index 1ef9920..fdeef06 100644 --- a/public/html/index.gohtml +++ b/public/html/index.gohtml @@ -8,7 +8,7 @@ - {{ template "header" }} + {{ template "header-html" }}

    Association Générale Étudiante du Cégep Édouard-Montpetit

    From d8144c24ff7c92ebf203f7cdb6427961a5f40f66 Mon Sep 17 00:00:00 2001 From: Victor Lacasse-Beaudoin Date: Fri, 24 Mar 2023 20:05:52 -0400 Subject: [PATCH 5/5] Ajouter templates pour routes principales Ajouter templates au lieu de retourner une string de titre de la route. --- public/html/a-propos.gohtml | 14 ++++++++++++++ public/html/actualite.gohtml | 14 ++++++++++++++ public/html/documentation.gohtml | 14 ++++++++++++++ public/html/formulaires.gohtml | 14 ++++++++++++++ public/html/vie-etudiante.gohtml | 14 ++++++++++++++ server.go | 10 +++++----- 6 files changed, 75 insertions(+), 5 deletions(-) create mode 100644 public/html/a-propos.gohtml create mode 100644 public/html/actualite.gohtml create mode 100644 public/html/documentation.gohtml create mode 100644 public/html/formulaires.gohtml create mode 100644 public/html/vie-etudiante.gohtml diff --git a/public/html/a-propos.gohtml b/public/html/a-propos.gohtml new file mode 100644 index 0000000..d4cd169 --- /dev/null +++ b/public/html/a-propos.gohtml @@ -0,0 +1,14 @@ +{{ define "a-propos-html" }} + + + + + AGECEM | À propos + {{ template "general-html" }} + + + {{ template "header-html" }} +

    À propos

    + + +{{ end }} diff --git a/public/html/actualite.gohtml b/public/html/actualite.gohtml new file mode 100644 index 0000000..de6bbb1 --- /dev/null +++ b/public/html/actualite.gohtml @@ -0,0 +1,14 @@ +{{ define "actualite-html" }} + + + + + AGECEM | Actualité + {{ template "general-html" }} + + + {{ template "header-html" }} +

    Actualité

    + + +{{ end }} diff --git a/public/html/documentation.gohtml b/public/html/documentation.gohtml new file mode 100644 index 0000000..813d77e --- /dev/null +++ b/public/html/documentation.gohtml @@ -0,0 +1,14 @@ +{{ define "documentation-html" }} + + + + + AGECEM | Documentation + {{ template "general-html" }} + + + {{ template "header-html" }} +

    Documentation

    + + +{{ end }} diff --git a/public/html/formulaires.gohtml b/public/html/formulaires.gohtml new file mode 100644 index 0000000..eb8dc7e --- /dev/null +++ b/public/html/formulaires.gohtml @@ -0,0 +1,14 @@ +{{ define "formulaires-html" }} + + + + + AGECEM | Formulaires + {{ template "general-html" }} + + + {{ template "header-html" }} +

    Formulaires

    + + +{{ end }} diff --git a/public/html/vie-etudiante.gohtml b/public/html/vie-etudiante.gohtml new file mode 100644 index 0000000..e2a78ba --- /dev/null +++ b/public/html/vie-etudiante.gohtml @@ -0,0 +1,14 @@ +{{ define "vie-etudiante-html" }} + + + + + AGECEM | Vie étudiante + {{ template "general-html" }} + + + {{ template "header-html" }} +

    Vie étudiante

    + + +{{ end }} diff --git a/server.go b/server.go index 3441748..76d5e61 100644 --- a/server.go +++ b/server.go @@ -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