From 9156fa7162d47ebc6cf2bee22477a3587993967b Mon Sep 17 00:00:00 2001 From: Emi Matchu Date: Thu, 29 Feb 2024 11:22:12 -0800 Subject: [PATCH] Bold the Terms of Use link when it's been changed recently --- app/assets/stylesheets/_layout.sass | 3 +++ app/helpers/application_helper.rb | 12 ++++++++++++ app/views/layouts/application.html.haml | 4 +++- config/locales/en.yml | 2 +- 4 files changed, 19 insertions(+), 2 deletions(-) diff --git a/app/assets/stylesheets/_layout.sass b/app/assets/stylesheets/_layout.sass index c26f7a4d..3b319d31 100644 --- a/app/assets/stylesheets/_layout.sass +++ b/app/assets/stylesheets/_layout.sass @@ -123,6 +123,9 @@ ul.buttons margin: 0 .5em #locale-form float: right + .terms + &[data-updated-recently] + font-weight: bold =flash margin-bottom: 1em diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 746c19ea..84f7dfe1 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -200,6 +200,18 @@ module ApplicationHelper def md(text) RDiscount.new(text).to_html.html_safe end + + def terms_updated_at + Date.new(2024, 2, 29) + end + + def terms_updated_timestamp + terms_updated_at.strftime("%b %Y") + end + + def terms_updated_recently + terms_updated_at >= 2.months.ago + end def translate_markdown(key, options={}) md translate("#{key}_markdown", **options) diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index 7a71cab7..96ab47e2 100644 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -61,7 +61,9 @@ %ul %li= link_to t('.footer.source_code'), 'https://github.com/openneo/impress' - %li= link_to t('.footer.terms'), terms_path + %li.terms{"data-updated-recently": terms_updated_recently } + = link_to t('.footer.terms', date: terms_updated_timestamp), + terms_path %div #{t('.footer.contact')}: diff --git a/config/locales/en.yml b/config/locales/en.yml index e210df5a..1294e3e0 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -33,7 +33,7 @@ en: footer: blog: Blog source_code: Source Code - terms: Terms of Use (updated Feb 2024) + terms: Terms of Use (updated %{date}) contact: Contact suggestions: Suggestions email: Questions, comments, bugs