From eea581bae9d24f31c8cae7b956b6895a4659b874 Mon Sep 17 00:00:00 2001 From: akuma06 Date: Sat, 26 Aug 2017 03:24:25 +0200 Subject: [PATCH] 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 --- controllers/search/search.go | 6 +--- templates/helpers.go | 4 --- .../layouts/partials/helpers/search.jet.html | 28 ++++++++----------- translations/CHANGELOG.md | 5 +++- translations/en-us.all.json | 8 ++++++ 5 files changed, 24 insertions(+), 27 deletions(-) diff --git a/controllers/search/search.go b/controllers/search/search.go index c451aa9f..f746ca60 100644 --- a/controllers/search/search.go +++ b/controllers/search/search.go @@ -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) } diff --git a/templates/helpers.go b/templates/helpers.go index dbed3ada..cf3bc659 100644 --- a/templates/helpers.go +++ b/templates/helpers.go @@ -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"), } } diff --git a/templates/layouts/partials/helpers/search.jet.html b/templates/layouts/partials/helpers/search.jet.html index 5546296c..f39e149a 100644 --- a/templates/layouts/partials/helpers/search.jet.html +++ b/templates/layouts/partials/helpers/search.jet.html @@ -53,30 +53,24 @@ {{ T("large")}} - {{ T("between")}} - - {{ T("and")}} - - - {{ T("old")}}. + {{ T("from")}} + + {{ T("to")}} + {{T("sort_by")}} diff --git a/translations/CHANGELOG.md b/translations/CHANGELOG.md index 03734c72..37dc2f01 100644 --- a/translations/CHANGELOG.md +++ b/translations/CHANGELOG.md @@ -9,4 +9,7 @@ * + tagvalue_hd * + tagvalue_sd * + tagvalue_bluray -* + tagtype_tags \ No newline at end of file +* + tagtype_tags +##2017/08/25 +* + from +* + to \ No newline at end of file diff --git a/translations/en-us.all.json b/translations/en-us.all.json index 494dd563..09425154 100644 --- a/translations/en-us.all.json +++ b/translations/en-us.all.json @@ -2042,5 +2042,13 @@ { "id": "complement", "translation": "Complement" + }, + { + "id": "from", + "translation": "From" + }, + { + "id": "to", + "translation": "to" } ]