From 4b7419a3ee7a84be46f5aaec23ef96024893d087 Mon Sep 17 00:00:00 2001 From: Li Xuan Tan <67103317+matho-o@users.noreply.github.com> Date: Sun, 27 Feb 2022 19:08:25 -0500 Subject: [PATCH 1/4] fix date formatting --- app/views/frontend/article.haml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/views/frontend/article.haml b/app/views/frontend/article.haml index 7c614195..c0f6c919 100644 --- a/app/views/frontend/article.haml +++ b/app/views/frontend/article.haml @@ -10,7 +10,10 @@ - elsif @draft.attribution.present? && !@draft.attribution.match(/unknown/i) %span.byline By #{@draft.attribution} %span.timestamp - = link_to @article.published_at.strftime('%b. %-d, %Y'), frontend_path(@article.issue) + - if @article.published_at.strftime('%B').length > 5 + = link_to @article.published_at.strftime('%b. %-d, %Y'), frontend_path(@article.issue) + - else + = link_to @article.published_at.strftime('%B %-d, %Y'), frontend_path(@article.issue) %ul.article-social - %li.article-social-fb From a61a8b6dc18981934859711fcd8c645d36969666 Mon Sep 17 00:00:00 2001 From: AnirudhRahul Date: Sun, 13 Mar 2022 15:53:02 -0400 Subject: [PATCH 2/4] Added formatting for below the fold --- app/views/frontend/homepage/_below_fold.haml | 2 +- app/views/frontend/homepage/_below_fold_article.haml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/views/frontend/homepage/_below_fold.haml b/app/views/frontend/homepage/_below_fold.haml index 868e4f9f..204cfe97 100644 --- a/app/views/frontend/homepage/_below_fold.haml +++ b/app/views/frontend/homepage/_below_fold.haml @@ -27,7 +27,7 @@ - elsif draft.attribution.present? && !draft.attribution.match(/unknown/i) %span.byline By #{draft.attribution} - %span.timestamp= a.published_at.strftime('%b. %-d, %Y') + %span.timestamp= a.published_at.strftime('%B').length > 5 ? a.published_at.strftime('%b. %-d, %Y') : a.published_at.strftime('%B %-d, %Y') %li = link_to "Read more in #{s.name} ยป", frontend_path(s), class: 'btf-section-link' - if has_ad diff --git a/app/views/frontend/homepage/_below_fold_article.haml b/app/views/frontend/homepage/_below_fold_article.haml index 3e171e7c..6ea290a8 100644 --- a/app/views/frontend/homepage/_below_fold_article.haml +++ b/app/views/frontend/homepage/_below_fold_article.haml @@ -22,7 +22,7 @@ - elsif draft.attribution.present? && !draft.attribution.match(/unknown/i) %span.byline By #{draft.attribution} - %span.timestamp= article.published_at.strftime('%b. %-d, %Y') + %span.timestamp= article.published_at.strftime('%B').length > 5 ? article.published_at.strftime('%b. %-d, %Y') : article.published_at.strftime('%B %-d, %Y') - else .btf-article.btf-article-noimg %h1.headline @@ -34,5 +34,5 @@ - elsif draft.attribution.present? && !draft.attribution.match(/unknown/i) %span.byline By #{draft.attribution} - %span.timestamp= article.published_at.strftime('%b. %-d, %Y') + %span.timestamp= article.published_at.strftime('%B').length > 5 ? article.published_at.strftime('%b. %-d, %Y') : article.published_at.strftime('%B %-d, %Y') %p.lede= lede From fba820e57deeaab0b97393fdc21143957e6027fa Mon Sep 17 00:00:00 2001 From: AnirudhRahul Date: Sun, 13 Mar 2022 15:53:23 -0400 Subject: [PATCH 3/4] Added date formatting for article list --- app/views/frontend/_article_list.haml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/views/frontend/_article_list.haml b/app/views/frontend/_article_list.haml index f0fa419e..b765c279 100644 --- a/app/views/frontend/_article_list.haml +++ b/app/views/frontend/_article_list.haml @@ -23,7 +23,8 @@ #{draft.attribution} - else Authored by Group - %span.timestamp= article.published_at.strftime('%b. %-d, %Y') + %span.timestamp= article.published_at.strftime('%B').length > 5 ? article.published_at.strftime('%b. %-d, %Y') : article.published_at.strftime('%B %-d, %Y') + %p.lede= draft.lede - else %h1.list-empty No results found. From 7286eba96e931e2e1a11cc643206496e279018f7 Mon Sep 17 00:00:00 2001 From: AnirudhRahul Date: Sun, 13 Mar 2022 15:53:43 -0400 Subject: [PATCH 4/4] More formatting passes --- app/views/frontend/homepage/_nameplate.haml | 2 +- app/views/frontend/homepage/modules/fragments/_article.haml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/frontend/homepage/_nameplate.haml b/app/views/frontend/homepage/_nameplate.haml index 20750c75..40bf0569 100644 --- a/app/views/frontend/homepage/_nameplate.haml +++ b/app/views/frontend/homepage/_nameplate.haml @@ -5,7 +5,7 @@ .nameplate-top %h1 The Tech %ul - %li= Date.today.strftime('%b. %-d, %Y') + %li= Date.today.strftime('%B').length > 5 ? Date.today.strftime('%b. %-d, %Y') : Date.today.strftime('%B %-d, %Y') %li = link_to frontend_path(@latest_issue) do This Week's Issue#{icon('newspaper-o', '', class: 'fa-fw')} diff --git a/app/views/frontend/homepage/modules/fragments/_article.haml b/app/views/frontend/homepage/modules/fragments/_article.haml index 8f23eb62..9de6d6a0 100644 --- a/app/views/frontend/homepage/modules/fragments/_article.haml +++ b/app/views/frontend/homepage/modules/fragments/_article.haml @@ -17,5 +17,5 @@ = author_links draft - elsif draft.attribution.present? && !draft.attribution.match(/unknown/i) = draft.attribution - %span.timestamp= article.published_at.strftime('%b. %-d, %Y') + %span.timestamp= article.published_at.strftime('%B').length > 5 ? article.published_at.strftime('%b. %-d, %Y') : article.published_at.strftime('%B %-d, %Y') %p.lede= draft.lede