From 870b72f1e9ff0f741fa18e07c72093c949fb9c6e Mon Sep 17 00:00:00 2001 From: kilo Date: Mon, 11 Sep 2017 19:45:39 +0200 Subject: [PATCH] "No comments" message, avatar in comments, classic theme improvements, some other changes, Old Navigation (#1545) * Update view.jet.html * Update en-us.all.json * Update view.jet.html * Update CHANGELOG.md * fix travis * Update classic.css * Update view.jet.html * Update main.css * Update classic.css * Update classic.css * Update classic.css * add link to user page & avatar in comment * stylisation for avatar in main.css * Update classic.css * Fix wrongly placed ::before * Add rule list to terms of service * import rules on register * fix refine-container-2's inputs * Update base.jet.html * Update en-us.all.json * Update CHANGELOG.md * GenNav changes to constantly put HTML for nav arrows regardless of page * css changes for website nav etc etc * add OldNav global variable * Add OldNav to test.go * Update publicSettings.go * change OldNav's value type * Old navigation in settings * add OldNav in user variables * add oldNav input handler in settings.go * Change OldNav's default value into false * Create OldNav.jet.html * Update search.jet.html * remove character that had nothing to do here * fix wrong variable name * fix worng variable name and travis * Update classic.css * Add sort order & type to old nav * add toString() function in test * add toString() function * translation string for oldnav setting * Use translation string in settings.jet.html * fix few html errors * ditto * travis fix test * remove useless charset * remove useless things * add spaces before attributes * attempt at fixing travis 2 * fix wrong variable name * Update classic.css * fix travis plsss --- controllers/settings/settings.go | 4 +- models/user.go | 1 + public/css/classic.css | 122 +++++++++++++++++- public/css/main.css | 10 ++ templates/layouts/partials/base.jet.html | 6 +- .../layouts/partials/helpers/OldNav.jet.html | 24 ++++ .../layouts/partials/helpers/search.jet.html | 27 ++-- templates/site/torrents/listing.jet.html | 2 +- templates/site/torrents/view.jet.html | 9 +- templates/site/user/public/settings.jet.html | 10 ++ templates/site/user/register.jet.html | 2 + templates/template.go | 1 + templates/template_functions.go | 24 +++- templates/template_functions_test.go | 18 +++ templates/template_test.go | 3 +- translations/CHANGELOG.md | 3 + translations/en-us.all.json | 14 +- utils/publicSettings/publicSettings.go | 13 ++ 18 files changed, 260 insertions(+), 33 deletions(-) create mode 100644 templates/layouts/partials/helpers/OldNav.jet.html diff --git a/controllers/settings/settings.go b/controllers/settings/settings.go index 0f4049f7..22f961ed 100644 --- a/controllers/settings/settings.go +++ b/controllers/settings/settings.go @@ -34,6 +34,7 @@ func ChangePublicSettingsHandler(c *gin.Context) { mascot := c.PostForm("mascot") mascotURL := c.PostForm("mascot_url") altColors := c.PostForm("altColors") + oldNav := c.PostForm("oldNav") messages := msg.GetMessages(c) @@ -61,6 +62,7 @@ func ChangePublicSettingsHandler(c *gin.Context) { user.Mascot = mascot user.MascotURL = mascotURL user.AltColors = altColors + user.OldNav = oldNav user.UpdateRaw() } // Set cookie with http and not gin for expires (maxage not supported in
{{ adId = Sukebei() ? 634159 : 634157 }} - +
- {{ if !EUCookieLaw }}{{ end }} - + {{ if !EUCookieLaw && URL.String() == ""}}{{ end }} + {{block footer_js()}}{{end}} diff --git a/templates/layouts/partials/helpers/OldNav.jet.html b/templates/layouts/partials/helpers/OldNav.jet.html new file mode 100644 index 00000000..c73669c5 --- /dev/null +++ b/templates/layouts/partials/helpers/OldNav.jet.html @@ -0,0 +1,24 @@ +
+ + + + + + + + +
+ {{ if Search.Sort != 2 && Search.Sort != 0}}Date{{else}}Date{{end}} / + {{ if Search.Sort != 5}}Seeders{{else}}Seeders{{end}} / + {{ if Search.Sort != 6}}Leechers{{else}}Leechers{{end}} / + {{ if Search.Sort != 7}}Downloads{{else}}Downloads{{end}} / + {{ if Search.Sort != 4}}Size{{else}}Size{{end}} / + {{ if Search.Sort != 1}}Name{{else}}Name{{end}} + | + {{ if Search.Order}}Ascending{{else}}Ascending{{end}} / + {{ if !Search.Order}}Descending{{else}}Descending{{end}} +
+ +
diff --git a/templates/layouts/partials/helpers/search.jet.html b/templates/layouts/partials/helpers/search.jet.html index fd899e44..0f35b354 100644 --- a/templates/layouts/partials/helpers/search.jet.html +++ b/templates/layouts/partials/helpers/search.jet.html @@ -12,8 +12,10 @@ {{end}} {{block search_refine(url="") }} +{{ if OldNav && (URL.String() == "/" || kilo_strcmp(URL.String(), "/search", 7, 1) )}} + {{ include "layouts/partials/helpers/oldNav" }} +{{ else }}
-

{{ T("refine_search") }}

@@ -44,10 +46,10 @@ {{ T("and")}} {{ T("large")}} @@ -61,16 +63,16 @@ {{T("sort_by")}}
@@ -100,3 +102,4 @@
{{end}} +{{end}} diff --git a/templates/site/torrents/listing.jet.html b/templates/site/torrents/listing.jet.html index 9c033531..ea194747 100644 --- a/templates/site/torrents/listing.jet.html +++ b/templates/site/torrents/listing.jet.html @@ -69,7 +69,7 @@ - + {{.Name}} diff --git a/templates/site/torrents/view.jet.html b/templates/site/torrents/view.jet.html index 1a7d248b..d12d6fa0 100644 --- a/templates/site/torrents/view.jet.html +++ b/templates/site/torrents/view.jet.html @@ -177,13 +177,16 @@ {{range index, element := Torrent.Comments}}
- #{{index}} + {{index}} {{formatDateRFC(element.Date)}} -

{{element.Username}}

-

{{element.Content|raw}}

+

{{element.Username}}

+

{{element.Content|raw}}

{{end}} + {{ if len(Torrent.Comments) == 0 }} +

{{ T("torrent_no_comments") }}

+ {{ end }}
{{ yield csrf_field()}} diff --git a/templates/site/user/public/settings.jet.html b/templates/site/user/public/settings.jet.html index 2bd53561..40f13d78 100644 --- a/templates/site/user/public/settings.jet.html +++ b/templates/site/user/public/settings.jet.html @@ -42,6 +42,7 @@

{{ T("alternating_color") }}

+

{{ T("old_nav_explanation") }}

+ + + +
+
+

{{ T("cookies")}}

diff --git a/templates/site/user/register.jet.html b/templates/site/user/register.jet.html index 26a81e42..c295b96f 100644 --- a/templates/site/user/register.jet.html +++ b/templates/site/user/register.jet.html @@ -2,6 +2,7 @@ {{ import "layouts/partials/helpers/csrf" }} {{ import "layouts/partials/helpers/captcha" }} {{ import "layouts/partials/helpers/errors" }} +{{ import "layouts/partials/helpers/rules" }} {{block title()}}{{ T("register_title") }}{{end}} {{block content_body()}}
@@ -44,6 +45,7 @@

{{ T("terms_conditions") }}