Re added templates files function for search
Removed them when I've resolved the conflicts
Cette révision appartient à :
Parent
6e3fbeb15e
révision
663b07bdb2
1 fichiers modifiés avec 6 ajouts et 2 suppressions
8
main.go
8
main.go
|
@ -82,6 +82,7 @@ func apiViewHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
|
|
||||||
func searchHandler(w http.ResponseWriter, r *http.Request) {
|
func searchHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
var templates = template.Must(template.New("home").Funcs(funcMap).ParseFiles("templates/index.html", "templates/home.html"))
|
var templates = template.Must(template.New("home").Funcs(funcMap).ParseFiles("templates/index.html", "templates/home.html"))
|
||||||
|
templates.ParseGlob("templates/_*.html") // common
|
||||||
vars := mux.Vars(r)
|
vars := mux.Vars(r)
|
||||||
page := vars["page"]
|
page := vars["page"]
|
||||||
|
|
||||||
|
@ -174,6 +175,7 @@ func searchByQuery(r *http.Request, pagenum int) (SearchParam, []model.Torrents,
|
||||||
|
|
||||||
func faqHandler(w http.ResponseWriter, r *http.Request) {
|
func faqHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
var templates = template.Must(template.New("FAQ").Funcs(funcMap).ParseFiles("templates/index.html", "templates/FAQ.html"))
|
var templates = template.Must(template.New("FAQ").Funcs(funcMap).ParseFiles("templates/index.html", "templates/FAQ.html"))
|
||||||
|
templates.ParseGlob("templates/_*.html") // common
|
||||||
err := templates.ExecuteTemplate(w, "index.html", FaqTemplateVariables{Navigation{}, NewSearchForm(), r.URL, mux.CurrentRoute(r)})
|
err := templates.ExecuteTemplate(w, "index.html", FaqTemplateVariables{Navigation{}, NewSearchForm(), r.URL, mux.CurrentRoute(r)})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||||
|
@ -220,6 +222,7 @@ func rssHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
|
|
||||||
func viewHandler(w http.ResponseWriter, r *http.Request) {
|
func viewHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
var templates = template.Must(template.ParseFiles("templates/index.html", "templates/view.html"))
|
var templates = template.Must(template.ParseFiles("templates/index.html", "templates/view.html"))
|
||||||
|
templates.ParseGlob("templates/_*.html") // common
|
||||||
vars := mux.Vars(r)
|
vars := mux.Vars(r)
|
||||||
id := vars["id"]
|
id := vars["id"]
|
||||||
|
|
||||||
|
@ -235,8 +238,9 @@ func viewHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func rootHandler(w http.ResponseWriter, r *http.Request) {
|
func rootHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
var templates = template.Must(template.New("home").Funcs(funcMap).ParseFiles("templates/index.html", "templates/home.html"))
|
var templates = template.Must(template.New("home").Funcs(funcMap).ParseFiles("templates/index.html", "templates/home.html"))
|
||||||
vars := mux.Vars(r)
|
templates.ParseGlob("templates/_*.html") // common
|
||||||
|
vars := mux.Vars(r)
|
||||||
page := vars["page"]
|
page := vars["page"]
|
||||||
|
|
||||||
// db params url
|
// db params url
|
||||||
|
|
Référencer dans un nouveau ticket