This commit is contained in:
邱博亞 2022-12-19 12:20:03 +08:00
parent ccbe87bb11
commit a837546620
2 changed files with 5 additions and 3 deletions

View File

@ -81,6 +81,8 @@ class Admin::SeminarsController < OrbitAdminController
available_locales = available_locales.map{|l| l.to_s} available_locales = available_locales.map{|l| l.to_s}
if @seminar_page_root.nil? if @seminar_page_root.nil?
@seminar_page_root = @seminar_template_setting.create_seminar_pages @seminar_page_root = @seminar_template_setting.create_seminar_pages
else
@seminar_template_setting.create_seminar_pages(false)
end end
@items = @seminar_page_root.child_page @items = @seminar_page_root.child_page
@parent_pages = [] @parent_pages = []

View File

@ -51,7 +51,7 @@ class SeminarTemplateSetting
end end
end end
end end
def create_seminar_pages def create_seminar_pages(force_update=true)
if self.seminar_main if self.seminar_main
@seminar = self.seminar_main @seminar = self.seminar_main
@seminar_page_root = Page.where(:parent_page_id=>self.seminar_main_id).first @seminar_page_root = Page.where(:parent_page_id=>self.seminar_main_id).first
@ -60,7 +60,7 @@ class SeminarTemplateSetting
if @seminar_page_root.nil? if @seminar_page_root.nil?
@seminar_page_root = Page.create(:parent_page_id=>self.seminar_main_id,:module=>"seminars_home",:name_translations=>@seminar.title_translations,:url=>"/home",:page_id=>"home",:enabled_for=>available_locales,:bind_uid=>@seminar.uid,:bind_module_app=>"seminar",:bind_model=>"SeminarMain",:menu_enabled_for=>available_locales) @seminar_page_root = Page.create(:parent_page_id=>self.seminar_main_id,:module=>"seminars_home",:name_translations=>@seminar.title_translations,:url=>"/home",:page_id=>"home",:enabled_for=>available_locales,:bind_uid=>@seminar.uid,:bind_module_app=>"seminar",:bind_model=>"SeminarMain",:menu_enabled_for=>available_locales)
else else
@seminar_page_root.update(:name_translations=>@seminar.title_translations,:module=>"seminars_home",:url=>"/home",:page_id=>"home",:enabled_for=>available_locales,:bind_uid=>@seminar.uid,:bind_module_app=>"seminar",:bind_model=>"SeminarMain",:menu_enabled_for=>available_locales) @seminar_page_root.update(:name_translations=>@seminar.title_translations,:module=>"seminars_home",:url=>"/home",:page_id=>"home",:enabled_for=>available_locales,:bind_uid=>@seminar.uid,:bind_module_app=>"seminar",:bind_model=>"SeminarMain",:menu_enabled_for=>available_locales) if force_update
end end
pages_info = PagesInfo pages_info = PagesInfo
relation_model = {"news" => "CustomBulletin","album"=>"CustomAlbum"} relation_model = {"news" => "CustomBulletin","album"=>"CustomAlbum"}
@ -79,7 +79,7 @@ class SeminarTemplateSetting
if seminar_page.nil? if seminar_page.nil?
seminar_page = @seminar_page_root.child_page.create(:name_translations=>page_trans,:page_id=>page_id,:url=>"/home/#{page_id}",:enabled_for=>available_locales_tmp,:module=>page_module,:menu_enabled_for=>available_locales_tmp) seminar_page = @seminar_page_root.child_page.create(:name_translations=>page_trans,:page_id=>page_id,:url=>"/home/#{page_id}",:enabled_for=>available_locales_tmp,:module=>page_module,:menu_enabled_for=>available_locales_tmp)
else else
seminar_page.update(:name_translations=>page_trans,:page_id=>page_id,:url=>"/home/#{page_id}",:module=>page_module) seminar_page.update(:name_translations=>page_trans,:page_id=>page_id,:url=>"/home/#{page_id}",:module=>page_module) if force_update
end end
end end
return @seminar_page_root return @seminar_page_root