new news section, to display latest blog entry/section
This commit is contained in:
parent
e823ac9d16
commit
7ace1652fc
BIN
app/assets/images/merged/section_preview/section_news.png
Normal file
BIN
app/assets/images/merged/section_preview/section_news.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 56 KiB |
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
@ -1,6 +1,7 @@
|
||||
module Merged
|
||||
module ViewHelper
|
||||
include MergedHelper
|
||||
include PagesHelper
|
||||
|
||||
def rows( text )
|
||||
return 5 if text.blank?
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user