Removing SearchType and SearchOrder + Move to new date search behaviour (#1395)
* Update search.go * Update helpers.go * Update search.jet.html * Update search.jet.html * Removing SortOrder and SortType from template's Search struct. Since we already have them in main torrentParam search struct and we don't need to overwrite them. * Replaced old date search filter behaviour
Cette révision appartient à :
Parent
c49fba015c
révision
eea581bae9
5 fichiers modifiés avec 24 ajouts et 27 suppressions
|
@ -61,10 +61,6 @@ func SearchHandler(c *gin.Context) {
|
|||
searchForm.ShowRefine = true
|
||||
}
|
||||
|
||||
if c.Query("order") == "true" {
|
||||
searchForm.SortOrder = true
|
||||
}
|
||||
|
||||
maxPages := math.Ceil(float64(nbTorrents) / float64(searchParam.Max))
|
||||
if pagenum > int(maxPages) {
|
||||
variables := templates.Commonvariables(c)
|
||||
|
@ -72,6 +68,6 @@ func SearchHandler(c *gin.Context) {
|
|||
templates.Render(c, "errors/no_results.jet.html", variables)
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
templates.ModelList(c, "site/torrents/listing.jet.html", models.TorrentsToJSON(torrents), nav, searchForm)
|
||||
}
|
||||
|
|
|
@ -32,8 +32,6 @@ type SearchForm struct {
|
|||
MaxSize string
|
||||
FromDate string
|
||||
ToDate string
|
||||
SortOrder bool
|
||||
SortType string
|
||||
}
|
||||
|
||||
// NewNavigation return a navigation struct with
|
||||
|
@ -58,7 +56,5 @@ func NewSearchForm(c *gin.Context) SearchForm {
|
|||
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
|
||||
SortOrder: false,
|
||||
SortType: c.Query("sort"),
|
||||
}
|
||||
}
|
||||
|
|
|
@ -53,30 +53,24 @@
|
|||
{{ T("large")}}
|
||||
</span>
|
||||
<span class="form-refine">
|
||||
<span class="spacing">{{ T("between")}}</span>
|
||||
<input class="form-input" size="7" name="fromDate" type="text" value="{{Search.FromDate}}"/>
|
||||
{{ T("and")}}
|
||||
<input class="form-input" size="7" name="toDate" type="text" value="{{Search.ToDate}}"/>
|
||||
<select name="dateType" class="form-input">
|
||||
<option value="d"{{if Search.DateType == "d"}} selected{{end}}>{{ T("days")}}</option>
|
||||
<option value="m"{{if Search.DateType == "m"}} selected{{end}}>{{ T("months")}}</option>
|
||||
<option value="y"{{if Search.DateType == "y"}} selected{{end}}>{{ T("years")}}</option>
|
||||
</select>
|
||||
{{ T("old")}}.
|
||||
<span class="spacing">{{ T("from")}}</span>
|
||||
<input class="form-input" size="7" name="fromDate" type="text" value="{{Search.FromDate}}" placeholder="YYYY/MM/DD"/>
|
||||
{{ T("to")}}
|
||||
<input class="form-input" size="7" name="toDate" type="text" value="{{Search.ToDate}}" placeholder="YYYY/MM/DD"/>
|
||||
</span>
|
||||
<span class="form-refine show-xs" style="margin-bottom: 2px;">
|
||||
<span class="spacing">{{T("sort_by")}}</span>
|
||||
<select name="sort" class="form-input">
|
||||
<option value="1"{{if Search.SortType == "1"}}selected{{end}}>{{T("name")}}</option>
|
||||
<option value="4"{{if Search.SortType == "4"}}selected{{end}}>{{T("size")}}</option>
|
||||
<option value="5"{{if Search.SortType == "5"}}selected{{end}}>{{T("seeders")}}</option>
|
||||
<option value="6"{{if Search.SortType == "6"}}selected{{end}}>{{T("leechers")}}</option>
|
||||
<option value="7"{{if Search.SortType == "7"}}selected{{end}}>{{T("completed")}}</option>
|
||||
<option value="2"{{if Search.SortType == "2" || Search.SortType == "0" }}selected{{end}}>{{T("date")}}</option>
|
||||
<option value="1"{{if Search.Sort == 1}}selected{{end}}>{{T("name")}}</option>
|
||||
<option value="4"{{if Search.Sort == 4}}selected{{end}}>{{T("size")}}</option>
|
||||
<option value="5"{{if Search.Sort == 5}}selected{{end}}>{{T("seeders")}}</option>
|
||||
<option value="6"{{if Search.Sort == 6}}selected{{end}}>{{T("leechers")}}</option>
|
||||
<option value="7"{{if Search.Sort == 7}}selected{{end}}>{{T("completed")}}</option>
|
||||
<option value="2"{{if Search.Sort == 2 || Search.Sort == 0}}selected{{end}}>{{T("date")}}</option>
|
||||
</select>
|
||||
<select name="order" class="form-input">
|
||||
<option value="true">{{T("ascending")}}</option>
|
||||
<option value="false"{{if !Search.SortOrder}}selected{{end}}>{{T("descending")}}</option>
|
||||
<option value="false"{{if !Search.Order}}selected{{end}}>{{T("descending")}}</option>
|
||||
</select>
|
||||
</span>
|
||||
</div>
|
||||
|
|
|
@ -9,4 +9,7 @@
|
|||
* + tagvalue_hd
|
||||
* + tagvalue_sd
|
||||
* + tagvalue_bluray
|
||||
* + tagtype_tags
|
||||
* + tagtype_tags
|
||||
##2017/08/25
|
||||
* + from
|
||||
* + to
|
|
@ -2042,5 +2042,13 @@
|
|||
{
|
||||
"id": "complement",
|
||||
"translation": "Complement"
|
||||
},
|
||||
{
|
||||
"id": "from",
|
||||
"translation": "From"
|
||||
},
|
||||
{
|
||||
"id": "to",
|
||||
"translation": "to"
|
||||
}
|
||||
]
|
||||
|
|
Référencer dans un nouveau ticket