Albirew/nyaa-pantsu
Archivé
1
0
Bifurcation 0

Add "sort by" inputs in refine on low res (#1369)

* Add HTML for sorting by name etc

* Add CSS to hide inputs for sorting in refine

* Set value of SortOrder on true if on true (wew)

* Add SortOrder & SortType variables

* change translation strings

* add translation strings

* forgot a missing { and change ascending value
Cette révision appartient à :
kilo 2017-08-14 07:56:45 +02:00 révisé par ewhal
Parent d51eb1ba60
révision 199d2b3b85
5 fichiers modifiés avec 55 ajouts et 9 suppressions

Voir le fichier

@ -61,6 +61,10 @@ 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)

Voir le fichier

@ -765,6 +765,9 @@ html, body {
.hide-xs {
display: none !important;
}
.show-xs {
display: inline-block!important;
}
}
@media (max-width: 810px) {
@ -1808,10 +1811,16 @@ span.tag {
border-bottom-right-radius: 1rem;
padding: 2px 0.5rem 2px 0.4rem;
display: inline-block;
color: black;
background: #e8f3f7;
color: black;
background: #e8f3f7;
}
.tag.pending a.tag-form {
border-left: 1px solid #d8d8d8;
}
.show-xs {
display: none;
}
.tag.pending a.tag-form { border-left: 1px solid #d8d8d8; }
/* Language specific CSS */

Voir le fichier

@ -32,6 +32,8 @@ type SearchForm struct {
MaxSize string
FromDate string
ToDate string
SortOrder bool
SortType string
}
// NewNavigation return a navigation struct with
@ -56,5 +58,7 @@ 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"),
}
}

Voir le fichier

@ -52,7 +52,7 @@
</select>
{{ T("large")}}
</span>
<span class="form-refine" style="margin-bottom: 2px;">
<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")}}
@ -63,7 +63,24 @@
<option value="y"{{if Search.DateType == "y"}} selected{{end}}>{{ T("years")}}</option>
</select>
{{ T("old")}}.
</div>
</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="0">None</option>
<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"}}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>
</select>
</span>
</div>
<div class="refine-container-2">
<div name="language" class="form-refine form-input language">
{{ yield flagList(languages=GetTorrentLanguages(), selected=Search.Languages, inputname="lang", id="refine-search")}}

Voir le fichier

@ -1623,6 +1623,10 @@
"id": "refine_search",
"translation": "Refine your search"
},
{
"id": "refine",
"translation": "Refine"
},
{
"id": "between",
"translation": "Between"
@ -1643,10 +1647,6 @@
"id": "years",
"translation": "Years"
},
{
"id": "refine",
"translation": "Refine"
},
{
"id": "large",
"translation": "large."
@ -1667,6 +1667,18 @@
"id": "show",
"translation": "Show"
},
{
"id": "sort_by",
"translation": "Sort by"
},
{
"id": "ascending",
"translation": "Ascending"
},
{
"id": "descending",
"translation": "Descending"
},
{
"id": "username_taken",
"translation": "Username already taken, you can choose: %s"