blob: 6a1c8975103cb555c7193d60408e4caabe5fea5b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
// miscellaneous utility functions used for the about pages
package about
import (
"html/template"
"net/http"
"soko/pkg/app/utils"
"soko/pkg/models"
)
// renderAboutTemplate renders a specific about template
func renderAboutTemplate(w http.ResponseWriter, r *http.Request, page string){
templates := template.Must(
template.Must(
template.New(page).
ParseGlob("web/templates/layout/*.tmpl")).
ParseGlob("web/templates/about/" + page + ".tmpl"))
templates.ExecuteTemplate(w, page + ".tmpl", getPageData())
}
// getPageData returns the data used
// in all about templates
func getPageData() interface{}{
return struct {
Page string
Application models.Application
}{
Page: "about",
Application: utils.GetApplicationData(),
}
}
|