Merge pull request #61 from akuma06/master
Re added templates files function for search
Cette révision appartient à :
révision
6002d8b938
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) {
|
||||
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)
|
||||
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) {
|
||||
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)})
|
||||
if err != nil {
|
||||
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) {
|
||||
var templates = template.Must(template.ParseFiles("templates/index.html", "templates/view.html"))
|
||||
templates.ParseGlob("templates/_*.html") // common
|
||||
vars := mux.Vars(r)
|
||||
id := vars["id"]
|
||||
|
||||
|
@ -235,8 +238,9 @@ func viewHandler(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"))
|
||||
vars := mux.Vars(r)
|
||||
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)
|
||||
page := vars["page"]
|
||||
|
||||
// db params url
|
||||
|
|
Référencer dans un nouveau ticket