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"}
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

View File

@ -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 . . .