Albirew/nyaa-pantsu
Archivé
1
0
Bifurcation 0
Cette révision appartient à :
akuma06 2017-05-09 04:12:32 +02:00
Parent c5b22ff496
révision c830f8ec71
3 fichiers modifiés avec 7 ajouts et 10 suppressions

Voir le fichier

@ -1,20 +1,12 @@
package router
import (
"html/template"
"net/http"
"github.com/ewhal/nyaa/util/languages"
"github.com/gorilla/mux"
)
var notFoundTemplate = template.Must(template.New("NotFound").Funcs(FuncMap).ParseFiles("templates/index.html", "templates/404.html"))
func init() {
// common
template.Must(notFoundTemplate.ParseGlob("templates/_*.html"))
}
func NotFoundHandler(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusNotFound)

Voir le fichier

@ -7,7 +7,7 @@ import (
var TemplateDir = "templates"
var homeTemplate, searchTemplate, faqTemplate, uploadTemplate, viewTemplate, viewRegisterTemplate, viewLoginTemplate, viewRegisterSuccessTemplate, viewVerifySuccessTemplate, viewProfileTemplate *template.Template
var homeTemplate, searchTemplate, faqTemplate, uploadTemplate, viewTemplate, viewRegisterTemplate, viewLoginTemplate, viewRegisterSuccessTemplate, viewVerifySuccessTemplate, viewProfileTemplate, notFoundTemplate *template.Template
type templateLoader struct {
templ **template.Template
@ -68,6 +68,11 @@ func ReloadTemplates() {
name: "user_profile",
file: "user/profile.html",
},
templateLoader{
templ: &notFoundTemplate,
name: "404",
file: "404.html",
},
}
for _, templ := range templs {
t := template.Must(template.New(templ.name).Funcs(FuncMap).ParseFiles(filepath.Join(TemplateDir, "index.html"), filepath.Join(TemplateDir, templ.file)))

Voir le fichier

@ -1,6 +1,6 @@
{{define "profile_content"}}
{{with .UserProfile}}
{{ if gt (len .ListTorrents) 0 }}
{{ if gt (len .Torrents) 0 }}
<div class="table-responsive">
<table class="table custom-table-hover">
<tr>