Updated search
When in a user page and clicked on more torrents, show a list navigable of the user torrent On that list, we can make advance search (categories, order, ...) Moderation search reimplemented Clicking on user (id) in the torrent list redirect to the list of the user torrents Ability to search within the user torrents
Cette révision appartient à :
Parent
4111c56970
révision
e8774abf21
6 fichiers modifiés avec 18 ajouts et 2 suppressions
|
@ -42,6 +42,7 @@ type SearchParam struct {
|
||||||
Sort SortMode
|
Sort SortMode
|
||||||
Category Category
|
Category Category
|
||||||
Page int
|
Page int
|
||||||
|
UserID uint
|
||||||
Max uint
|
Max uint
|
||||||
Query string
|
Query string
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,6 +31,7 @@
|
||||||
<option value="2" {{if eq .Search.Status 2}}selected{{end}}>{{T "trusted"}}</option>
|
<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>
|
<option value="3" {{if eq .Search.Status 3}}selected{{end}}>A+</option>
|
||||||
</select>
|
</select>
|
||||||
|
<input type="hidden" name="userID" value="{{ .Search.UserID }}">
|
||||||
{{end}}
|
{{end}}
|
||||||
{{define "search_advanced"}}
|
{{define "search_advanced"}}
|
||||||
<select name="sort" class="form-control input-sm">
|
<select name="sort" class="form-control input-sm">
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
<th class="col-xs-1">Action</th>
|
<th class="col-xs-1">Action</th>
|
||||||
</tr>
|
</tr>
|
||||||
{{ range .Torrents}}
|
{{ 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>
|
<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}}
|
{{end}}
|
||||||
</table>
|
</table>
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
|
|
||||||
{{ range .Torrents}}
|
{{ 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>
|
<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}}
|
{{end}}
|
||||||
</table>
|
</table>
|
||||||
|
|
|
@ -57,6 +57,14 @@
|
||||||
<div style="padding-top: 10rem"></div>
|
<div style="padding-top: 10rem"></div>
|
||||||
|
|
||||||
<div class="container" id="container">
|
<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}}
|
{{block "content" .}}{{end}}
|
||||||
</div>
|
</div>
|
||||||
<footer style="text-align: center; padding-bottom: 2rem;font-size: 2rem;font-family: cursive; color: #616161;text-shadow: -1px -1px #999999;">
|
<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.Page = pagenum
|
||||||
search.Query = r.URL.Query().Get("q")
|
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 {
|
switch s := r.URL.Query().Get("s"); s {
|
||||||
case "1":
|
case "1":
|
||||||
|
@ -111,6 +113,10 @@ func searchByQuery(r *http.Request, pagenum int, countAll bool) (
|
||||||
conditions = append(conditions, "category = ?")
|
conditions = append(conditions, "category = ?")
|
||||||
parameters.Params = append(parameters.Params, string(catString[0]))
|
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 {
|
if search.Category.Sub != 0 {
|
||||||
conditions = append(conditions, "sub_category = ?")
|
conditions = append(conditions, "sub_category = ?")
|
||||||
parameters.Params = append(parameters.Params, string(catString[2]))
|
parameters.Params = append(parameters.Params, string(catString[2]))
|
||||||
|
|
Référencer dans un nouveau ticket