* Add new followers directly to user.Followers * Update user.go * Remove useless condition * Query an update of user followers if at 0 when looking at his profile * Fix comment not appearing until you refreshed the torrent page * call ViewHandler so that comments visually update properly * Remove now useless imports * Add "uploader" userstatus in comment * GetLikings() & GetFollowers() now return count too * Don't update follower count here * Update follower count directly here * show liking count * Update user.go * Update profile.jet.html * Update torrentParam.go * Fix locked torrents that were shown even when they should not * Update torrentParam_test.go * remove inline styling * Update main.css * Update upload.jet.html * Update main.css * Update tomorrow.css * Update classic.css * Update classic_colors.css * Update index_site.jet.html * Make announcements support markdown * Add markdown form to announcement creation * fix "report" text position * Add exclude search option to exclude words * Make sure the "NameLike" value is the search query because we edit it during a search * Show search content in page title for /feed too * rollback * Add "Search" variable that shows exactly what is being searched * Use "Search.Search" variable here instead of NameLike because NameLike is edited * Update torrentParam_test.go * Update torrentParam.go * remove redundant spaces from NameLike * Update torrentParam.go * Update torrentParam.go * Update torrentParam.go * Update torrentParam.go * turn date input into type date * bigger date inputs * add support for YYYY-MM-DD dates * rollback this change * rollback * Update search.jet.html * Update helpers.go * Update template_functions.go * Update torrentParam.go * only uploader & staff can comment on locked torrents * Add "Upload to Nyaa/Sukebei" button for mods * Update torrentlist.jet.html * Update view.jet.html * Update view.jet.html * fix wrong page title for notifications page
67 lignes
2 Kio
Go
67 lignes
2 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
|
|
UserName string
|
|
SearchURL 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"),
|
|
UserName: "",
|
|
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
|
|
SearchURL: "/search",
|
|
}
|
|
}
|