Albirew/nyaa-pantsu
Archivé
1
0
Bifurcation 0

Hide advanced search on FAQ page

Cette révision appartient à :
sfan5 2017-05-05 18:02:18 +02:00
Parent b8fa4524d1
révision 19d6a53b7d
4 fichiers modifiés avec 11 ajouts et 3 suppressions

Voir le fichier

@ -108,6 +108,7 @@ func searchHandler(w http.ResponseWriter, r *http.Request) {
search_param.Category,
search_param.Sort,
search_param.Order,
false,
}
htv := HomeTemplateVariables{b, torrentService.GetAllCategories(false), searchForm, navigationTorrents, r.URL, mux.CurrentRoute(r)}
@ -176,7 +177,10 @@ 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)})
searchForm := NewSearchForm()
searchForm.HideAdvancedSearch = true
err := templates.ExecuteTemplate(w, "index.html", FaqTemplateVariables{Navigation{}, searchForm, r.URL, mux.CurrentRoute(r)})
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
}

Voir le fichier

@ -53,6 +53,7 @@ type SearchForm struct {
Category string
Sort string
Order string
HideAdvancedSearch bool
}
// Some Default Values to ease things out
@ -74,4 +75,4 @@ func NewSearchForm(params ...string) SearchForm {
searchForm.Order = "DESC"
}
return searchForm
}
}

Voir le fichier

@ -43,7 +43,7 @@
<option value="desc" {{if eq .Search.Order "desc"}}selected{{end}}>Descending</option>
<option value="asc" {{if eq .Search.Order "asc"}}selected{{end}}>Ascending</option>
</select>
<select name="max" class="form-control input-sm" value>
<select name="max" class="form-control input-sm">
<option value="5" {{if eq .Navigation.MaxItemPerPage 5}}selected{{end}}>5</option>
<option value="10" {{if eq .Navigation.MaxItemPerPage 10}}selected{{end}}>10</option>
<option value="15" {{if eq .Navigation.MaxItemPerPage 15}}selected{{end}}>15</option>

Voir le fichier

@ -54,6 +54,7 @@
<div style="padding-top: 10rem"></div>
<div class="container" id="container">
{{if not .Search.HideAdvancedSearch}}
<div class="blockBody" style="text-align:center">
<font size="4.5">Advanced Search</font><br />
<form class="navbar-form" role="search" action="/search" method="get">
@ -66,6 +67,8 @@
<div style="clear:both"></div>
</div>
<div style="margin:0.5em"></div>
{{end}}
{{block "content" .}}Nothing Here.{{end}}
</div>