consistent updated display

This commit is contained in:
2022-12-26 20:58:34 +02:00
parent ba022b5259
commit cbaf858b1c
7 changed files with 53 additions and 43 deletions

View File

@ -19,16 +19,8 @@ module Merged
Section.where(page_id: id).order(index: :asc)
end
def section_update
last = Time.now
last_section = nil
sections.each do |section|
if( section.updated_at < last )
last = section.updated_at
last_section = section
end
end
last_section
def sections_update
last_update_for( sections )
end
def template_style

View File

@ -15,6 +15,10 @@ module Merged
Card.where(section_id: id).order(index: :asc)
end
def cards_update
last_update_for( cards )
end
def template_style
SectionStyle.find_by_template( template )
end

View File

@ -12,6 +12,18 @@ module Merged
fields :options , :updated_at , :updated_by
def last_update_for(elements)
last = Time.now
last_section = nil
elements.each do |section|
if( section.updated_at < last )
last = section.updated_at
last_section = section
end
end
last_section
end
def edit_save( editor )
self.updated_at = Time.now
self.updated_by = editor