mirror of
https://github.com/Floriansylvain/RenewCMS.git
synced 2026-08-19 11:43:22 +02:00
feat: Posts page impl and associated routes
Implemented a new 'Posts' page which has been added to the main navigation. This includes: - Adding the 'posts.html' template with basic HTML and related CSS/JS - Updating the 'componentNavbar.html' template to include a link to the new Posts page - Writing the 'GetPostsPage' function in 'api/page.go' to handle requests for the Posts page - Modifying the 'home.html' template to provide a link towards the Posts Page - Adding an associated route in 'api/page.go'.
This commit is contained in:
@@ -16,10 +16,7 @@
|
|||||||
<a class="nav-link" href="/home">Accueil</a>
|
<a class="nav-link" href="/home">Accueil</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link" href="#">Link 2</a>
|
<a class="nav-link" href="/posts">Posts</a>
|
||||||
</li>
|
|
||||||
<li class="nav-item">
|
|
||||||
<a class="nav-link" href="#">Link 3</a>
|
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<ul class="navbar-nav">
|
<ul class="navbar-nav">
|
||||||
|
|||||||
@@ -16,7 +16,9 @@
|
|||||||
<div class="container mt-3 text-black-50">
|
<div class="container mt-3 text-black-50">
|
||||||
<h1>Accueil</h1>
|
<h1>Accueil</h1>
|
||||||
<p>Bienvenue sur GohCMS !</p>
|
<p>Bienvenue sur GohCMS !</p>
|
||||||
<button class="btn btn-outline-primary">Posts »</button>
|
<a href="/posts">
|
||||||
|
<button class="btn btn-outline-primary">Posts »</button>
|
||||||
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -0,0 +1,20 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta content="width=device-width, initial-scale=1.0" name="viewport">
|
||||||
|
<title>GohCMS | Posts</title>
|
||||||
|
|
||||||
|
<link rel="stylesheet" href="/static/bootstrap.min.css" type="text/css">
|
||||||
|
<script src="/static/bootstrap.min.js"
|
||||||
|
type="application/javascript"
|
||||||
|
defer></script>
|
||||||
|
|
||||||
|
</head>
|
||||||
|
<body class="text-dark">
|
||||||
|
{{.Navbar}}
|
||||||
|
<div class="container mt-3 text-black-50">
|
||||||
|
<h1>Posts</h1>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -89,6 +89,7 @@ func NewPageRouter() http.Handler {
|
|||||||
r.Use(IsLoggedInMiddleware)
|
r.Use(IsLoggedInMiddleware)
|
||||||
r.Get("/register-confirm", GetRegisterConfirmPage)
|
r.Get("/register-confirm", GetRegisterConfirmPage)
|
||||||
r.Get("/home", GetHomePage)
|
r.Get("/home", GetHomePage)
|
||||||
|
r.Get("/posts", GetPostsPage)
|
||||||
})
|
})
|
||||||
|
|
||||||
return r
|
return r
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package api
|
||||||
|
|
||||||
|
import (
|
||||||
|
"html/template"
|
||||||
|
"net/http"
|
||||||
|
)
|
||||||
|
|
||||||
|
func GetPostsPage(w http.ResponseWriter, _ *http.Request) {
|
||||||
|
navbarTmpl, _ := Container.GetPageUseCase.GetPage("componentNavbar", nil)
|
||||||
|
postsTmpl, _ := Container.GetPageUseCase.GetPage("posts", map[string]interface{}{
|
||||||
|
"Navbar": template.HTML(navbarTmpl),
|
||||||
|
})
|
||||||
|
_, _ = w.Write(postsTmpl)
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user