From 5a184bfb5099992d820e28a758387ef4837affc6 Mon Sep 17 00:00:00 2001 From: kilo Date: Wed, 30 Aug 2017 07:21:45 +0200 Subject: [PATCH] "Alternating Colors" option in settings (#1440) * Non-bold torrent name when using alternating background colors * Add alternating colors for g.css * Add alternating colors for classic.css * Add alternating colors for tomorreuw * Update classic.css * Add alternating colors to settings page * Add alt-colors class to tbody if enabled * Add GetAltColorsFromRequest() function to get AltColors cookie value * Create AltColors variable for usage in listing * Make settings handle altColors input * Add AltColors in user struct * Returned the wrong variable here * Turn function return value into bool * Condition checks variable like a bool * ditto * better color for g.css * even better color * better * Last change for g.css * Improvement for tomorrow * Update classic.css * add alt-colors class to upload preview * Add alt-colors to user profile * more vivid color for g * Fix typo * Remove browser outline for refine when clicked on * remove browser outline * Fix rules that didn't apply and category icon being way too small on user profile thanks to usage of percentage * Remove show-xs class for search inputs * Turn refine button back into position: absolute to pin at very bottom of refine * Alternating colors for g's trusted, remake & aplus * Update tomorrow.css * attempt at fixing travis * test (will have to rollback that change) * rollback * will have to rollback * will have to rollback * will have to rollback * will have to rollback * add AltColors variable to template test * rollback * rollback * rollback * rollback --- controllers/settings/settings.go | 3 +++ models/user.go | 1 + public/css/classic.css | 4 +++- public/css/g.css | 13 +++++++++++- public/css/main.css | 21 ++++++++++++------- public/css/tomorrow.css | 6 ++++++ .../layouts/partials/helpers/search.jet.html | 2 +- templates/site/torrents/listing.jet.html | 4 ++-- templates/site/torrents/upload.jet.html | 4 ++-- templates/site/user/public/settings.jet.html | 9 +++++++- templates/site/user/torrents.jet.html | 4 ++-- templates/template.go | 1 + templates/template_test.go | 5 ++++- utils/publicSettings/publicSettings.go | 12 +++++++++++ 14 files changed, 71 insertions(+), 18 deletions(-) diff --git a/controllers/settings/settings.go b/controllers/settings/settings.go index d48df2fc..0f4049f7 100644 --- a/controllers/settings/settings.go +++ b/controllers/settings/settings.go @@ -33,6 +33,7 @@ func ChangePublicSettingsHandler(c *gin.Context) { lang := c.PostForm("language") mascot := c.PostForm("mascot") mascotURL := c.PostForm("mascot_url") + altColors := c.PostForm("altColors") messages := msg.GetMessages(c) @@ -59,6 +60,7 @@ func ChangePublicSettingsHandler(c *gin.Context) { user.Theme = theme user.Mascot = mascot user.MascotURL = mascotURL + user.AltColors = altColors user.UpdateRaw() } // Set cookie with http and not gin for expires (maxage not supported in table { diff --git a/public/css/tomorrow.css b/public/css/tomorrow.css index a85de4f4..9dddb736 100644 --- a/public/css/tomorrow.css +++ b/public/css/tomorrow.css @@ -88,6 +88,12 @@ td.tr-le, .error-text { background-color: #cc6666; } +.alt-colors tr:nth-child(even) { + background: hsla(255, 4%, 29%, 0.2); +} +.alt-colors tr:nth-child(odd) { + background: hsla(255, 31%, 6%, 0.2); +} .aplus, .btn-blue { background: hsla(180, 50%, 50%, 0.2) !important; } diff --git a/templates/layouts/partials/helpers/search.jet.html b/templates/layouts/partials/helpers/search.jet.html index 9b22d277..d158fa8c 100644 --- a/templates/layouts/partials/helpers/search.jet.html +++ b/templates/layouts/partials/helpers/search.jet.html @@ -58,7 +58,7 @@ Exclude: - + {{T("sort_by")}} {{ yield errors(name="name")}} - +