move cards

This commit is contained in:
2023-01-20 19:54:20 +02:00
parent e752c46d96
commit 321f1909c5
8 changed files with 29 additions and 9 deletions

View File

@ -38,6 +38,10 @@ module Merged
CardStyle.find_by_template( self.template )
end
def allowed_fields
super + [:section_id]
end
def delete_and_reset_index(editor)
delete_save!(editor)
section.reset_index

View File

@ -61,12 +61,15 @@ module Merged
def update(hash)
return unless hash
hash.each do |key , value|
raise "unsuported field #{key} for #{template}:#{allowed_fields}" unless allowed_fields.include?(key.to_sym)
value = value.to_i if key.to_s.include?("_id")
key = key.to_sym
raise "unsuported field #{key} for #{template}:#{allowed_fields}" unless allowed_fields.include?(key)
if(! attributes[key].nil? ) # first setting ok, types not (yet?) specified
if( @attributes[key].class != value.class )
raise "Type mismatch #{key} #{key.class}!=#{value.class}"
raise "Type mismatch #{key} #{@attributes[key].class}!=#{value.class}"
end
end
puts "setting #{key}=#{value}"
attributes[key] = value
end
end