init
This commit is contained in:
50
templates/templates.go
Normal file
50
templates/templates.go
Normal file
@ -0,0 +1,50 @@
|
||||
package templates
|
||||
|
||||
import (
|
||||
"github.com/gobuffalo/packr"
|
||||
"github.com/sirupsen/logrus"
|
||||
"html/template"
|
||||
)
|
||||
|
||||
var box = packr.NewBox("./../static")
|
||||
|
||||
func HomeTemplate() *template.Template {
|
||||
t := template.New("index.html")
|
||||
var err error
|
||||
t, err = t.Parse(box.String("index.html"))
|
||||
if err != nil {
|
||||
logrus.Fatal(err)
|
||||
}
|
||||
t, err = t.Parse(box.String("nav.html"))
|
||||
//t, err = t.ParseFiles("./static/index.html", "./static/nav.html")
|
||||
if err != nil {
|
||||
logrus.Fatal(err)
|
||||
}
|
||||
return t
|
||||
}
|
||||
|
||||
func MovieTemplate() *template.Template {
|
||||
t := template.New("movie.html")
|
||||
var err error
|
||||
t, err = t.Parse(box.String("movie.html"))
|
||||
if err != nil {
|
||||
logrus.Fatal(err)
|
||||
}
|
||||
t, err = t.Parse(box.String("nav.html"))
|
||||
//t, err = t.ParseFiles("./static/movie.html", "./static/nav.html")
|
||||
if err != nil {
|
||||
logrus.Fatal(err)
|
||||
}
|
||||
return t
|
||||
}
|
||||
|
||||
func WatchTemplate() *template.Template {
|
||||
t := template.New(box.String("watch.html"))
|
||||
var err error
|
||||
t, err = t.Parse(box.String("watch.html"))
|
||||
//t, err = t.ParseFiles("./static/watch.html")
|
||||
if err != nil {
|
||||
logrus.Fatal(err)
|
||||
}
|
||||
return t
|
||||
}
|
Reference in New Issue
Block a user