Albirew/nyaa-pantsu
Archivé
1
0
Bifurcation 0

Merge remote-tracking branch 'upstream/master' into extract-strings-for-translation

Cette révision appartient à :
ElegantMonkey 2017-05-08 15:14:28 -03:00
révision f28d95b544
2 fichiers modifiés avec 11 ajouts et 1 suppressions

Voir le fichier

@ -7,7 +7,7 @@
{{ genNav .Navigation .URL 10 }}
</ul>
</nav>
{{ if gt (len .ListTorrents) 0 }}
<div class="table-responsive">
<table class="table custom-table-hover">
<tr>
@ -52,5 +52,8 @@
</ul>
</nav>
</div>
{{else}}
<h2 style="text-align: center;">No Results found</h2>
{{end}}
</div>
{{end}}

Voir le fichier

@ -19,6 +19,7 @@ type SearchParam struct {
Max int
Status string
Sort string
UserId string
}
func SearchByQuery(r *http.Request, pagenum int) (SearchParam, []model.Torrents, int) {
@ -37,6 +38,7 @@ func SearchByQuery(r *http.Request, pagenum int) (SearchParam, []model.Torrents,
search_param.Status = r.URL.Query().Get("s")
search_param.Sort = r.URL.Query().Get("sort")
search_param.Order = r.URL.Query().Get("order")
search_param.UserId = r.URL.Query().Get("userId")
catsSplit := strings.Split(search_param.Category, "_")
// need this to prevent out of index panics
@ -93,6 +95,11 @@ func SearchByQuery(r *http.Request, pagenum int) (SearchParam, []model.Torrents,
}
parameters.Params = append(parameters.Params, search_param.Status)
}
if search_param.UserId != "" {
conditions = append(conditions, "owner_id = ?")
parameters.Params = append(parameters.Params, search_param.UserId)
}
searchQuerySplit := strings.Fields(search_param.Query)
for i, word := range searchQuerySplit {
firstRune, _ := utf8.DecodeRuneInString(word)