improve the news section

This commit is contained in:
Torsten 2023-01-08 21:22:09 +02:00
parent a620275a1c
commit bcb02ea4a4
2 changed files with 15 additions and 8 deletions

View File

@ -4,10 +4,12 @@ module Merged
sections = Section.all.select{|s| s.page.type == "blog"} sections = Section.all.select{|s| s.page.type == "blog"}
sorted = sections.sort_by(&:updated_at) sorted = sections.sort_by(&:updated_at)
last = sorted.pop last = sorted.pop
puts last.template.class
puts last.template puts last.template
return last unless last&.template == "blog_header" if (last&.template == "blog_header") or (last&.template == "section_news")
return last unless last&.template == "section_news" return sorted.last
sorted.last end
return last
end end
def header_list def header_list

View File

@ -1,11 +1,16 @@
- if blog = last_blog - if blog = last_blog
%section.border.border-xl.mt-20{ options(section , :background )} %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 .text-2xl.font-bold.tracking-tight.sm:text-4xl
= section.header = section.header
.text-lg .text-lg
= section.text = distance_of_time_in_words_to_now last_blog.updated_at
- template = find_template(last_blog) %hr.mt-2.border.border-4.border-gray-600
= render( template , section: last_blog) - template = find_template(last_blog)
.mr-20.text-lg = render( template , section: last_blog)
.flex.justify-between.items-center.border-b-8.border-gray-600
.ml-20.mb-2.text-lg
= section.text = section.text
.mr-20.mb-2.text-lg
%a.transition{:class => "hover:text-gray-500/75", :href => merged.pages_path}
Read More . . .