consistent updated display
This commit is contained in:
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
Reference in New Issue
Block a user