Merge branch 'master' of https://github.com/ewhal/nyaa
Cette révision appartient à :
révision
df2f0d9839
6 fichiers modifiés avec 18 ajouts et 2 suppressions
|
@ -42,6 +42,7 @@ type SearchParam struct {
|
|||
Sort SortMode
|
||||
Category Category
|
||||
Page int
|
||||
UserID uint
|
||||
Max uint
|
||||
Query string
|
||||
}
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
<option value="2" {{if eq .Search.Status 2}}selected{{end}}>{{T "trusted"}}</option>
|
||||
<option value="3" {{if eq .Search.Status 3}}selected{{end}}>A+</option>
|
||||
</select>
|
||||
<input type="hidden" name="userID" value="{{ .Search.UserID }}">
|
||||
{{end}}
|
||||
{{define "search_advanced"}}
|
||||
<select name="sort" class="form-control input-sm">
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
<th class="col-xs-1">Action</th>
|
||||
</tr>
|
||||
{{ range .Torrents}}
|
||||
<tr><td><a href="{{ genRoute "mod_tedit" }}?id={{.ID}}">{{ .Name }}</a></td><td><a href="{{ genRoute "mod_tlist" }}?userid={{.UploaderID}}">{{ .UploaderID }}</a></td>
|
||||
<tr><td><a href="{{ genRoute "mod_tedit" }}?id={{.ID}}">{{ .Name }}</a></td><td><a href="{{ genRoute "mod_tlist" }}?userID={{.UploaderID}}">{{ .UploaderID }}</a></td>
|
||||
<td><a href="{{ genRoute "mod_tdelete" }}?id={{ .ID }}" class="btn btn-danger btn-lg" onclick="if (!confirm('Are you sure?')) return false;"><i class="glyphicon glyphicon-trash"></i>{{ T "delete" }}</a></td></tr>
|
||||
{{end}}
|
||||
</table>
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
{{ range .Torrents}}
|
||||
|
||||
<tr><td><a href="{{ genRoute "mod_tedit" }}?id={{.ID}}">{{ .Name }}</a></td><td><a href="{{ genRoute "mod_tlist" }}?userid={{.UploaderID}}">{{ .UploaderID }}</a></td>
|
||||
<tr><td><a href="{{ genRoute "mod_tedit" }}?id={{.ID}}">{{ .Name }}</a></td><td><a href="{{ genRoute "mod_tlist" }}?userID={{.UploaderID}}">{{ .UploaderID }}</a></td>
|
||||
<td><a href="{{ genRoute "mod_tdelete" }}?id={{ .ID }}" class="btn btn-danger btn-lg" onclick="if (!confirm('Are you sure?')) return false;"><i class="glyphicon glyphicon-trash"></i>{{ T "delete" }}</a></td></tr>
|
||||
{{end}}
|
||||
</table>
|
||||
|
|
|
@ -57,6 +57,14 @@
|
|||
<div style="padding-top: 10rem"></div>
|
||||
|
||||
<div class="container" id="container">
|
||||
<form class="navbar-form navbar-right" role="search" action="{{ genRoute "mod_tlist" }}" method="get">
|
||||
<div class="form-group">
|
||||
{{block "search_common" .}}{{end}}
|
||||
</div>
|
||||
<div class="form-group">
|
||||
{{block "search_button" .}}{{end}}
|
||||
</div>
|
||||
</form>
|
||||
{{block "content" .}}{{end}}
|
||||
</div>
|
||||
<footer style="text-align: center; padding-bottom: 2rem;font-size: 2rem;font-family: cursive; color: #616161;text-shadow: -1px -1px #999999;">
|
||||
|
|
|
@ -39,6 +39,8 @@ func searchByQuery(r *http.Request, pagenum int, countAll bool) (
|
|||
|
||||
search.Page = pagenum
|
||||
search.Query = r.URL.Query().Get("q")
|
||||
userID, _ := strconv.Atoi(r.URL.Query().Get("userID"))
|
||||
search.UserID = uint(userID)
|
||||
|
||||
switch s := r.URL.Query().Get("s"); s {
|
||||
case "1":
|
||||
|
@ -111,6 +113,10 @@ func searchByQuery(r *http.Request, pagenum int, countAll bool) (
|
|||
conditions = append(conditions, "category = ?")
|
||||
parameters.Params = append(parameters.Params, string(catString[0]))
|
||||
}
|
||||
if search.UserID != 0 {
|
||||
conditions = append(conditions, "uploader = ?")
|
||||
parameters.Params = append(parameters.Params, search.UserID)
|
||||
}
|
||||
if search.Category.Sub != 0 {
|
||||
conditions = append(conditions, "sub_category = ?")
|
||||
parameters.Params = append(parameters.Params, string(catString[2]))
|
||||
|
|
Référencer dans un nouveau ticket