consistent updated display
This commit is contained in:
parent
ba022b5259
commit
cbaf858b1c
@ -19,16 +19,8 @@ module Merged
|
|||||||
Section.where(page_id: id).order(index: :asc)
|
Section.where(page_id: id).order(index: :asc)
|
||||||
end
|
end
|
||||||
|
|
||||||
def section_update
|
def sections_update
|
||||||
last = Time.now
|
last_update_for( sections )
|
||||||
last_section = nil
|
|
||||||
sections.each do |section|
|
|
||||||
if( section.updated_at < last )
|
|
||||||
last = section.updated_at
|
|
||||||
last_section = section
|
|
||||||
end
|
|
||||||
end
|
|
||||||
last_section
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def template_style
|
def template_style
|
||||||
|
@ -15,6 +15,10 @@ module Merged
|
|||||||
Card.where(section_id: id).order(index: :asc)
|
Card.where(section_id: id).order(index: :asc)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def cards_update
|
||||||
|
last_update_for( cards )
|
||||||
|
end
|
||||||
|
|
||||||
def template_style
|
def template_style
|
||||||
SectionStyle.find_by_template( template )
|
SectionStyle.find_by_template( template )
|
||||||
end
|
end
|
||||||
|
@ -12,6 +12,18 @@ module Merged
|
|||||||
|
|
||||||
fields :options , :updated_at , :updated_by
|
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 )
|
def edit_save( editor )
|
||||||
self.updated_at = Time.now
|
self.updated_at = Time.now
|
||||||
self.updated_by = editor
|
self.updated_by = editor
|
||||||
|
@ -24,6 +24,12 @@
|
|||||||
%h3.mt-4.text-lg.font-bold Image
|
%h3.mt-4.text-lg.font-bold Image
|
||||||
= yellow_button("Change Image" , merged.images_path(card_id: card.id) )
|
= yellow_button("Change Image" , merged.images_path(card_id: card.id) )
|
||||||
= red_button("Remove image", merged.card_set_image_path( card.id , image: "") )
|
= red_button("Remove image", merged.card_set_image_path( card.id , image: "") )
|
||||||
|
.basis-full.mt-3
|
||||||
|
Updated at:
|
||||||
|
= distance_of_time_in_words_to_now(card.updated_at)
|
||||||
|
.basis-full.mb-3
|
||||||
|
Updated by:
|
||||||
|
= card.updated_by
|
||||||
|
|
||||||
.basis-96
|
.basis-96
|
||||||
%h3.mt-4.text-lg.font-bold Image
|
%h3.mt-4.text-lg.font-bold Image
|
||||||
|
@ -7,30 +7,11 @@
|
|||||||
%table.min-w-full.divide-y.divide-gray-200.text-sm
|
%table.min-w-full.divide-y.divide-gray-200.text-sm
|
||||||
%thead.bg-gray-100
|
%thead.bg-gray-100
|
||||||
%tr
|
%tr
|
||||||
%th.whitespace-nowrap.px-4.py-2.text-left.font-medium.text-gray-900
|
-["Index", "Name","Sections" ,"Updated" ,"Edited by" ,
|
||||||
.flex.items-center.gap-2
|
"Sections at", "Sections by","Actions"].each do |header|
|
||||||
Index
|
%th.whitespace-nowrap.px-4.py-2.text-left.font-medium.text-gray-900
|
||||||
%th.whitespace-nowrap.px-4.py-2.text-left.font-medium.text-gray-900
|
.flex.items-center.gap-2
|
||||||
.flex.items-center.gap-2
|
= header
|
||||||
Name
|
|
||||||
%th.whitespace-nowrap.px-4.py-2.text-left.font-medium.text-gray-900
|
|
||||||
.flex.items-center.gap-2
|
|
||||||
Sections
|
|
||||||
%th.whitespace-nowrap.px-4.py-2.text-left.font-medium.text-gray-900
|
|
||||||
.flex.items-center.gap-2
|
|
||||||
Updated
|
|
||||||
%th.whitespace-nowrap.px-4.py-2.text-left.font-medium.text-gray-900
|
|
||||||
.flex.items-center.gap-2
|
|
||||||
Edited by
|
|
||||||
%th.whitespace-nowrap.px-4.py-2.text-left.font-medium.text-gray-900
|
|
||||||
.flex.items-center.gap-2
|
|
||||||
Sections at
|
|
||||||
%th.whitespace-nowrap.px-4.py-2.text-left.font-medium.text-gray-900
|
|
||||||
.flex.items-center.gap-2
|
|
||||||
Sections by
|
|
||||||
%th.whitespace-nowrap.px-4.py-2.text-left.font-medium.text-gray-900
|
|
||||||
.flex.items-center.gap-2
|
|
||||||
Actions
|
|
||||||
%tbody.divide-y.divide-gray-200
|
%tbody.divide-y.divide-gray-200
|
||||||
- @pages.each do |page|
|
- @pages.each do |page|
|
||||||
%tr{id: page.name}
|
%tr{id: page.name}
|
||||||
@ -44,9 +25,9 @@
|
|||||||
= distance_of_time_in_words_to_now(page.updated_at)
|
= distance_of_time_in_words_to_now(page.updated_at)
|
||||||
%td.whitespace-nowrap.px-4.py-2.text-gray-700
|
%td.whitespace-nowrap.px-4.py-2.text-gray-700
|
||||||
=page.updated_by
|
=page.updated_by
|
||||||
- s = page.section_update
|
- s = page.sections_update
|
||||||
%td.whitespace-nowrap.px-4.py-2.text-gray-700
|
%td.whitespace-nowrap.px-4.py-2.text-gray-700
|
||||||
=s.updated_at.to_date
|
=distance_of_time_in_words_to_now(s.updated_at)
|
||||||
%td.whitespace-nowrap.px-4.py-2.text-gray-700
|
%td.whitespace-nowrap.px-4.py-2.text-gray-700
|
||||||
=s.updated_by
|
=s.updated_by
|
||||||
%td.whitespace-nowrap.px-4.py-2
|
%td.whitespace-nowrap.px-4.py-2
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
-@page.sections.each do |section |
|
-@page.sections.each do |section |
|
||||||
.flex.gap-10.p-4{class: (section.index%2)==1 ? 'bg-cyan-50' : 'bg-red-50' , id: "section_#{section.id}"}
|
.flex.gap-10.p-4{class: (section.index%2)==1 ? 'bg-cyan-50' : 'bg-red-50' , id: "section_#{section.id}"}
|
||||||
.basis-60
|
.basis-72
|
||||||
%h3.mt-4.text-lg.font-bold Section #{section.index} : #{section.header}
|
%h3.mt-4.text-lg.font-bold Section #{section.index} : #{section.header}
|
||||||
.flex.flex-wrap
|
.flex.flex-wrap
|
||||||
= yellow_button("Edit" , merged.section_path(section.id) )
|
= yellow_button("Edit" , merged.section_path(section.id) )
|
||||||
@ -24,13 +24,22 @@
|
|||||||
%path{:d => "M15.75 17.25L12 21m0 0l-3.75-3.75M12 21V3", "stroke-linecap" => "round", "stroke-linejoin" => "round"}
|
%path{:d => "M15.75 17.25L12 21m0 0l-3.75-3.75M12 21V3", "stroke-linecap" => "round", "stroke-linejoin" => "round"}
|
||||||
.basis-full.mt-3
|
.basis-full.mt-3
|
||||||
Updated at:
|
Updated at:
|
||||||
= section.updated_at.to_date
|
= distance_of_time_in_words_to_now(section.updated_at)
|
||||||
.basis-full.mb-3
|
.basis-full.mb-3
|
||||||
Updated by:
|
Updated by:
|
||||||
= section.updated_by
|
= section.updated_by
|
||||||
|
- if section.has_cards?
|
||||||
|
- card = section.cards_update
|
||||||
|
.basis-full
|
||||||
|
Cards updated at:
|
||||||
|
= distance_of_time_in_words_to_now(card.updated_at)
|
||||||
|
.basis-full.mb-3
|
||||||
|
Cards updated by:
|
||||||
|
= card.updated_by
|
||||||
.basis-full.mb-3
|
.basis-full.mb-3
|
||||||
= form_tag( merged.section_path(section.id) , {method: :delete } ) do
|
= form_tag( merged.section_path(section.id) , {method: :delete } ) do
|
||||||
=submit_button( "Delete" , true)
|
=submit_button( "Delete" , true)
|
||||||
|
|
||||||
.basis-72
|
.basis-72
|
||||||
%h3.mt-4.text-lg.font-bold Template
|
%h3.mt-4.text-lg.font-bold Template
|
||||||
= link_to(merged.section_select_template_path(section.id)) do
|
= link_to(merged.section_select_template_path(section.id)) do
|
||||||
@ -53,12 +62,12 @@
|
|||||||
= image_for( section , "h-40")
|
= image_for( section , "h-40")
|
||||||
-else
|
-else
|
||||||
%p No image
|
%p No image
|
||||||
.basis-52.grow
|
.basis-96
|
||||||
%h3.mt-4.text-lg.font-bold Options
|
%h3.mt-4.text-lg.font-bold Options
|
||||||
- section.options.each do|name , value|
|
.grid.grid-cols-2.gap-3.mx-10
|
||||||
%p
|
- section.options.each do|name , value|
|
||||||
= name
|
.font-bold.mt-1= name.camelcase
|
||||||
= value
|
.font-xl= value
|
||||||
.grid.grid-cols-2.gap-2.m-8
|
.grid.grid-cols-2.gap-2.m-8
|
||||||
.relative.block
|
.relative.block
|
||||||
%p
|
%p
|
||||||
|
@ -12,6 +12,12 @@
|
|||||||
= section_preview(@section , class: "w-full object-contain my-4")
|
= section_preview(@section , class: "w-full object-contain my-4")
|
||||||
= yellow_button( "Change Template" , merged.section_select_template_path(@section.id))
|
= yellow_button( "Change Template" , merged.section_select_template_path(@section.id))
|
||||||
= green_button( "New Section" , merged.new_page_section_path(@section.page.id , template: @section.template) )
|
= green_button( "New Section" , merged.new_page_section_path(@section.page.id , template: @section.template) )
|
||||||
|
.basis-full.mt-3
|
||||||
|
Updated at:
|
||||||
|
= distance_of_time_in_words_to_now(@section.updated_at)
|
||||||
|
.basis-full.mb-3
|
||||||
|
Updated by:
|
||||||
|
= @section.updated_by
|
||||||
|
|
||||||
.basis-96
|
.basis-96
|
||||||
%h3.mt-4.text-lg.font-bold Image
|
%h3.mt-4.text-lg.font-bold Image
|
||||||
|
Loading…
Reference in New Issue
Block a user