fix error

This commit is contained in:
chiu 2020-08-16 14:42:55 +08:00
parent 53ab1b77bd
commit 162094a798
2 changed files with 2 additions and 4 deletions

View File

@ -136,6 +136,8 @@ class Admin::CalendarsController < OrbitAdminController
if !bulletin.nil? if !bulletin.nil?
bulletin.update_attributes(calendar_start_date: p1[:start],calendar_end_date: p1[:end],calendar_all_day: p1[:all_day],calendar_type_id: p1[:calendar_type_id]) bulletin.update_attributes(calendar_start_date: p1[:start],calendar_end_date: p1[:end],calendar_all_day: p1[:all_day],calendar_type_id: p1[:calendar_type_id])
end end
p1['title_translations'] = @event['title_translations'].merge({I18n.locale.to_s =>p1['title']})
p1['note_translations'] = @event['title_translations'].merge({I18n.locale.to_s =>p1['note']})
if @event.update_attributes(p1) if @event.update_attributes(p1)
e = @event.to_json e = @event.to_json
e = JSON.parse(e) e = JSON.parse(e)

View File

@ -57,10 +57,6 @@ class Event
end end
end end
end end
before_save do
self['title_translations'] = self['title_translations'].merge({I18n.locale.to_s =>self['title']})
self['note_translations'] = self['title_translations'].merge({I18n.locale.to_s =>self['note']})
end
######################################## ########################################
validates_presence_of :title, :message => "Please fill the title of the Event", :if => lambda { self['title_translations'].blank? } validates_presence_of :title, :message => "Please fill the title of the Event", :if => lambda { self['title_translations'].blank? }
validates_presence_of :title_translations, :message => "Please fill the title of the Event", :if => lambda { self['title'].blank? } validates_presence_of :title_translations, :message => "Please fill the title of the Event", :if => lambda { self['title'].blank? }