diff --git a/handler/routes.go b/handler/routes.go index bca9c77..41207b1 100644 --- a/handler/routes.go +++ b/handler/routes.go @@ -76,7 +76,7 @@ func WireGuardClients() echo.HandlerFunc { } return c.Render(http.StatusOK, "clients.html", map[string]interface{}{ - "name": "Khanh", + "baseData": model.BaseData{""}, "clientDataList": clientDataList, }) } @@ -149,7 +149,6 @@ func RemoveClient() echo.HandlerFunc { // WireGuardServer handler func WireGuardServer() echo.HandlerFunc { return func(c echo.Context) error { - // initialize database directory dir := "./db" db, err := scribble.New(dir, nil) @@ -168,7 +167,7 @@ func WireGuardServer() echo.HandlerFunc { } return c.Render(http.StatusOK, "server.html", map[string]interface{}{ - "name": "Khanh", + "baseData": model.BaseData{"wg-server"}, "serverInterface": serverInterface, "serverKeyPair": serverKeyPair, }) @@ -248,7 +247,7 @@ func GlobalSettings() echo.HandlerFunc { } return c.Render(http.StatusOK, "global_settings.html", map[string]interface{}{ - "name": "Khanh", + "baseData": model.BaseData{"global-settings"}, "globalSettings": globalSettings, }) } diff --git a/model/misc.go b/model/misc.go index 249cb9f..2f3274d 100644 --- a/model/misc.go +++ b/model/misc.go @@ -5,3 +5,8 @@ type Interface struct { Name string `json:"name"` IPAddress string `json:"ip_address"` } + +// BaseData struct to pass value to the base template +type BaseData struct { + Active string +} diff --git a/templates/base.html b/templates/base.html index a010845..d9af34e 100644 --- a/templates/base.html +++ b/templates/base.html @@ -86,7 +86,7 @@