From a84ac778adf57d6446eef6577e617a80d4c6bb8e Mon Sep 17 00:00:00 2001 From: Quentin Dufour Date: Tue, 19 Jul 2022 15:39:49 +0200 Subject: Ease packaging by making resource path configurable --- admin.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'admin.go') diff --git a/admin.go b/admin.go index a2c70c5..3d6674e 100644 --- a/admin.go +++ b/admin.go @@ -48,7 +48,7 @@ type AdminUsersTplData struct { } func handleAdminUsers(w http.ResponseWriter, r *http.Request) { - templateAdminUsers := template.Must(template.ParseFiles("templates/layout.html", "templates/admin_users.html")) + templateAdminUsers := template.Must(template.ParseFiles(config.Resources[0]+"/templates/layout.html", config.Resources[0]+"/templates/admin_users.html")) login := checkAdminLogin(w, r) if login == nil { @@ -87,7 +87,7 @@ type AdminGroupsTplData struct { } func handleAdminGroups(w http.ResponseWriter, r *http.Request) { - templateAdminGroups := template.Must(template.ParseFiles("templates/layout.html", "templates/admin_groups.html")) + templateAdminGroups := template.Must(template.ParseFiles(config.Resources[0]+"/templates/layout.html", config.Resources[0]+"/templates/admin_groups.html")) login := checkAdminLogin(w, r) if login == nil { @@ -165,7 +165,7 @@ type PropValues struct { } func handleAdminLDAP(w http.ResponseWriter, r *http.Request) { - templateAdminLDAP := template.Must(template.ParseFiles("templates/layout.html", "templates/admin_ldap.html")) + templateAdminLDAP := template.Must(template.ParseFiles(config.Resources[0]+"/templates/layout.html", config.Resources[0]+"/templates/admin_ldap.html")) login := checkAdminLogin(w, r) if login == nil { @@ -551,7 +551,7 @@ type CreateData struct { } func handleAdminCreate(w http.ResponseWriter, r *http.Request) { - templateAdminCreate := template.Must(template.ParseFiles("templates/layout.html", "templates/admin_create.html")) + templateAdminCreate := template.Must(template.ParseFiles(config.Resources[0]+"/templates/layout.html", config.Resources[0]+"/templates/admin_create.html")) login := checkAdminLogin(w, r) if login == nil { -- cgit v1.2.3