From bcb02ea4a4e2df473d918ebfe5c51400fc6229f6 Mon Sep 17 00:00:00 2001 From: Torsten Date: Sun, 8 Jan 2023 21:22:09 +0200 Subject: [PATCH] improve the news section --- app/helpers/merged/pages_helper.rb | 8 +++++--- app/views/merged/view/_section_news.haml | 15 ++++++++++----- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/app/helpers/merged/pages_helper.rb b/app/helpers/merged/pages_helper.rb index 7ff05ff..efec41e 100644 --- a/app/helpers/merged/pages_helper.rb +++ b/app/helpers/merged/pages_helper.rb @@ -4,10 +4,12 @@ module Merged sections = Section.all.select{|s| s.page.type == "blog"} sorted = sections.sort_by(&:updated_at) last = sorted.pop + puts last.template.class puts last.template - return last unless last&.template == "blog_header" - return last unless last&.template == "section_news" - sorted.last + if (last&.template == "blog_header") or (last&.template == "section_news") + return sorted.last + end + return last end def header_list diff --git a/app/views/merged/view/_section_news.haml b/app/views/merged/view/_section_news.haml index a92ad4f..3d1d42c 100644 --- a/app/views/merged/view/_section_news.haml +++ b/app/views/merged/view/_section_news.haml @@ -1,11 +1,16 @@ - if blog = last_blog %section.border.border-xl.mt-20{ options(section , :background )} - .flex.mx-20.justify-between.items-center + .flex.my-5.mx-20.justify-between.items-center .text-2xl.font-bold.tracking-tight.sm:text-4xl = section.header .text-lg - = section.text - - template = find_template(last_blog) - = render( template , section: last_blog) - .mr-20.text-lg + = distance_of_time_in_words_to_now last_blog.updated_at + %hr.mt-2.border.border-4.border-gray-600 + - template = find_template(last_blog) + = render( template , section: last_blog) + .flex.justify-between.items-center.border-b-8.border-gray-600 + .ml-20.mb-2.text-lg = section.text + .mr-20.mb-2.text-lg + %a.transition{:class => "hover:text-gray-500/75", :href => merged.pages_path} + Read More . . .