9bb26a7dbe
* Add username search Quite simple, you need to provide ?user=xxxx * Add userID search + Changed name of input field Now ?user=xxx can also search userID. For that you need to prefix it with "#". Example: * ?user=akuma06 would search torrents based on username akuma06 * ?user=#123 would search torrents based on userID 123 (be aware that you have to encode the "#" in url format %23) * Update search.jet.html (#1436) * Update main.css (#1435)
62 lignes
1,9 Kio
Go
62 lignes
1,9 Kio
Go
package templates
|
|
|
|
import (
|
|
"github.com/NyaaPantsu/nyaa/utils/publicSettings"
|
|
"github.com/NyaaPantsu/nyaa/utils/search"
|
|
"github.com/gin-gonic/gin"
|
|
)
|
|
|
|
// LanguagesJSONResponse : Structure containing all the languages to parse it as a JSON response
|
|
type LanguagesJSONResponse struct {
|
|
Current string `json:"current"`
|
|
Languages publicSettings.Languages `json:"language"`
|
|
}
|
|
|
|
// Navigation is used to display navigation links to pages on list view
|
|
type Navigation struct {
|
|
TotalItem int
|
|
MaxItemPerPage int // FIXME: shouldn't this be in SearchForm?
|
|
CurrentPage int
|
|
Route string
|
|
}
|
|
|
|
// SearchForm struct used to display the search form
|
|
type SearchForm struct {
|
|
search.TorrentParam
|
|
Category string
|
|
ShowItemsPerPage bool
|
|
ShowRefine bool
|
|
SizeType string
|
|
DateType string
|
|
MinSize string
|
|
MaxSize string
|
|
FromDate string
|
|
ToDate string
|
|
User string
|
|
}
|
|
|
|
// NewNavigation return a navigation struct with
|
|
// Some Default Values to ease things out
|
|
func NewNavigation() Navigation {
|
|
return Navigation{
|
|
MaxItemPerPage: 50,
|
|
}
|
|
}
|
|
|
|
// NewSearchForm return a searchForm struct with
|
|
// Some Default Values to ease things out
|
|
func NewSearchForm(c *gin.Context) SearchForm {
|
|
sizeType := c.DefaultQuery("sizeType", "m")
|
|
return SearchForm{
|
|
Category: "_",
|
|
ShowItemsPerPage: true,
|
|
ShowRefine: false,
|
|
SizeType: sizeType,
|
|
User: c.Query("user"),
|
|
DateType: c.Query("dateType"),
|
|
MinSize: c.Query("minSize"), // We need to overwrite the value here, since size are formatted
|
|
MaxSize: c.Query("maxSize"), // We need to overwrite the value here, since size are formatted
|
|
FromDate: c.Query("fromDate"), // We need to overwrite the value here, since we can have toDate instead and date are formatted
|
|
ToDate: c.Query("toDate"), // We need to overwrite the value here, since date are formatted
|
|
}
|
|
}
|