diff --git a/app/assets/images/merged/section_preview/section_news.png b/app/assets/images/merged/section_preview/section_news.png new file mode 100644 index 0000000..88a3d41 Binary files /dev/null and b/app/assets/images/merged/section_preview/section_news.png differ diff --git a/app/helpers/merged/merged_helper.rb b/app/helpers/merged/merged_helper.rb index 8ce1394..7341854 100644 --- a/app/helpers/merged/merged_helper.rb +++ b/app/helpers/merged/merged_helper.rb @@ -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 diff --git a/app/helpers/merged/pages_helper.rb b/app/helpers/merged/pages_helper.rb index 561be16..0cb3766 100644 --- a/app/helpers/merged/pages_helper.rb +++ b/app/helpers/merged/pages_helper.rb @@ -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 diff --git a/app/helpers/merged/view_helper.rb b/app/helpers/merged/view_helper.rb index 6d3ec60..0c0b98a 100644 --- a/app/helpers/merged/view_helper.rb +++ b/app/helpers/merged/view_helper.rb @@ -1,6 +1,7 @@ module Merged module ViewHelper include MergedHelper + include PagesHelper def rows( text ) return 5 if text.blank? diff --git a/config/merged/section_styles.yml b/config/merged/section_styles.yml index b319a4d..b95a035 100644 --- a/config/merged/section_styles.yml +++ b/config/merged/section_styles.yml @@ -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