This commit is contained in:
cangui 2025-05-09 16:57:13 +02:00
parent 3cf5f3f214
commit 0403494f48
4 changed files with 22 additions and 17 deletions

View File

@ -157,8 +157,9 @@ func Dashboard(db *gorm.DB) http.HandlerFunc {
func renderTemplate(w http.ResponseWriter, templ string, data map[string]interface{}) { func renderTemplate(w http.ResponseWriter, templ string, data map[string]interface{}) {
t, err := template.ParseFiles( t, err := template.ParseFiles(
"./frontend/templates/head.pages.tmpl", // Template inclus "./frontend/templates/head.pages.tmpl",
"./frontend/templates/" + templ + ".pages.tmpl", // Template principal "./frontend/templates/sidebar.pages.tmpl",
"./frontend/templates/" + templ + ".pages.tmpl",
) )
if err != nil { if err != nil {

View File

@ -1,7 +1,9 @@
{{ define "dashboard.pages.tmpl" }} {{ define "dashboard.pages.tmpl" }}
{{ template "head" . }} {{ template "head" . }}
<div class="columns">
<!-- Sidebar -->
{{ template "sidebar" . }}
<!-- Main content --> <!-- Main content -->
<div class="column is-10"> <div class="column is-10">

View File

@ -22,20 +22,6 @@
<script src="/frontend/assets/js/function/functions.js"></script> <script src="/frontend/assets/js/function/functions.js"></script>
<title>Login</title> <title>Login</title>
</head> </head>
<div class="columns">
<!-- Sidebar -->
<aside class="menu column is-2">
<p class="menu-label">Navigation</p>
<ul class="menu-list">
<li><a href="/dashboard">🏠 Dashboard</a></li>
{{ if eq .User.Role "ADMIN" }}
<li><a href="/admin/users">👤 Utilisateurs</a></li>
<li><a href="/test/send">📤 Test envoi</a></li>
<li><a href="/test/send2">📤 Test envoi template</a></li>
{{ end }}
<a href="/admin/user/{{ .User.ID }}/conversations">💬 Mes conversations</a>
</ul>
</aside>
{{ end }} {{ end }}

View File

@ -0,0 +1,16 @@
{{ define "sidebar" }}
<aside class="menu column is-2">
<p class="menu-label">Navigation</p>
<ul class="menu-list">
<li><a href="/dashboard">🏠 Dashboard</a></li>
{{ if eq .User.Role "ADMIN" }}
<li><a href="/admin/users">👤 Utilisateurs</a></li>
<li><a href="/test/send">📤 Test envoi</a></li>
<li><a href="/test/send2">📤 Test envoi template</a></li>
{{ end }}
<li><a href="/admin/user/{{ .User.ID }}/conversations">💬 Mes conversations</a></li>
</ul>
</aside>
{{ end }}