new news section, to display latest blog entry/section

This commit is contained in:
Torsten 2023-01-08 14:27:23 +02:00
parent e823ac9d16
commit 7ace1652fc
5 changed files with 26 additions and 4 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

View File

@ -71,13 +71,10 @@ module Merged
def last_change_digit
last = ChangeSet.current.last
puts "digit in #{last}"
return 10 unless last
last = (Time.now - last).to_i
puts "digit minus #{last}"
return 10 if ( last >= 600 )
digit = last / 60
puts "digit ret #{digit}"
digit
end

View File

@ -1,2 +1,13 @@
module Merged::PagesHelper
module Merged
module PagesHelper
def last_blog
sections = Section.all.select{|s| s.page.type == "blog"}
sorted = sections.sort_by(&:updated_at)
last = sorted.pop
puts last.template
return last unless last&.template == "blog_header"
return last unless last&.template == "section_news"
sorted.last
end
end
end

View File

@ -1,6 +1,7 @@
module Merged
module ViewHelper
include MergedHelper
include PagesHelper
def rows( text )
return 5 if text.blank?

View File

@ -43,6 +43,19 @@
- item_align
- button_link
- button_text
- template: section_news
header: Showing latest news
text: Always the latest available news section
fields:
- header
- text
options:
- background
- color
- text_align
- item_align
- button_link
- button_text
- template: section_text
header: Newspaper style section for longer passages of text.
text: Text may be markdown. The section may have one image than