saving updated_by

This commit is contained in:
Torsten 2022-12-23 14:40:43 +02:00
parent f46634e3d1
commit ab43a2ed0a
4 changed files with 39 additions and 11 deletions

View File

@ -38,14 +38,13 @@ module Merged
@card.allowed_fields.each do |key|
if( params.has_key?(key) )
@card.update(key, params[key])
puts "updating:#{key}=#{params[key]}"
end
end
options = params[:option]
@card.option_definitions.each do |option|
@card.set_option(option.name, options[option.name])
end if options
@card.save(current_member)
@card.save(current_member.email)
redirect_to section_cards_url(@card.section.id) , notice: "Updated #{@card.header}"
end

View File

@ -15,6 +15,18 @@ 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
end
def template_style
PageStyle.find_by_type( type )
end

View File

@ -22,27 +22,38 @@
%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
- @pages.each do |merged_page|
%tr{id: merged_page.name}
- @pages.each do |page|
%tr{id: page.name}
%td.whitespace-nowrap.px-4.py-2.text-gray-700
= link_to merged_page.id , merged.page_path(merged_page.id)
= link_to page.id , merged.page_path(page.id)
%td.whitespace-nowrap.px-4.py-2.text-gray-700
= link_to merged_page.name , merged.page_sections_path(merged_page.id)
= link_to page.name , merged.page_sections_path(page.id)
%td.whitespace-nowrap.px-4.py-2.text-gray-700
= merged_page.sections.length
= page.sections.length
%td.whitespace-nowrap.px-4.py-2.text-gray-700
= distance_of_time_in_words_to_now(merged_page.updated_at)
= distance_of_time_in_words_to_now(page.updated_at)
%td.whitespace-nowrap.px-4.py-2.text-gray-700
ME
=page.updated_by
- s = page.section_update
%td.whitespace-nowrap.px-4.py-2.text-gray-700
=s.updated_at.to_date
%td.whitespace-nowrap.px-4.py-2.text-gray-700
=s.updated_by
%td.whitespace-nowrap.px-4.py-2
%strong.rounded.bg-green-100.px-3.text-xs.font-medium.text-green-700{:class => "py-1.5"}
= link_to 'Sections', merged.page_sections_path(merged_page.id)
= link_to 'Sections', merged.page_sections_path(page.id)
%strong.rounded.bg-amber-100.px-3.text-xs.font-medium.text-amber-700{:class => "py-1.5"}
= link_to 'Edit', merged.page_path(merged_page.id)
= link_to 'Edit', merged.page_path(page.id)
.grid.grid-cols-3.gap-2.m-8
.relative.block.border.border-gray-100

View File

@ -22,6 +22,12 @@
=link_to(merged.section_move_path(section.id , dir: :up)) do
%svg.w-6.h-6{:fill => "none", :stroke => "currentColor", "stroke-width" => "1.5", :viewbox => "0 0 24 24", :xmlns => "http://www.w3.org/2000/svg"}
%path{:d => "M15.75 17.25L12 21m0 0l-3.75-3.75M12 21V3", "stroke-linecap" => "round", "stroke-linejoin" => "round"}
.basis-full.mt-3
Updated at:
= section.updated_at.to_date
.basis-full.mb-3
Updated by:
= section.updated_by
.basis-full.mb-3
= form_tag( merged.section_path(section.id) , {method: :delete } ) do
=submit_button( "Delete" , true)