fixing saves

This commit is contained in:
2022-12-22 21:28:00 +02:00
parent 168320d6ee
commit 5c4123c012
9 changed files with 49 additions and 6 deletions

View File

@ -45,7 +45,7 @@ module Merged
@card.option_definitions.each do |option|
@card.set_option(option.name, options[option.name])
end if options
@card.save
@card.save(current_member)
redirect_to section_cards_url(@card.section.id) , notice: "Updated #{@card.header}"
end

View File

@ -75,7 +75,7 @@ module Merged
@section.option_definitions.each do |option|
@section.set_option(option.name, options[option.name])
end if options
@section.save
@section.save(current_member.email)
redirect_to :section , notice: "Update ok"
end

View File

@ -60,11 +60,10 @@ module Merged
[has_sections , has_cards]
end
def save
def save(editor)
olds = self.redirects.to_s.split(" ")
olds.delete( self.name.to_s )
self.redirects = olds.join(" ")
updated_at = Time.now
super
end

View File

@ -12,6 +12,12 @@ module Merged
fields :options , :updated_at , :updated_by
def save( editor )
self.updated_at = Time.now
self.updated_by = editor
super()
end
def has_option?(option)
options.has_key?(option) and !options[option].blank?
end

View File

@ -22,7 +22,7 @@
= yellow_button("Change Image", merged.images_path(section_id: @section.id))
= red_button( "Remove image", merged.section_set_image_path( @section.id , image: ""))
.basis-80.grow
.basis-80.grow.content_update
= section_form( class: "mx-auto mt-8 mb-0 max-w space-y-4") do
%label.block
%h4.text-lg.font-bold Header