Fixed
Cette révision appartient à :
Parent
c5b22ff496
révision
c830f8ec71
3 fichiers modifiés avec 7 ajouts et 10 suppressions
|
@ -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)
|
||||
|
||||
|
|
|
@ -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: ¬FoundTemplate,
|
||||
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)))
|
||||
|
|
|
@ -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>
|
||||
|
|
Référencer dans un nouveau ticket