Fix bug. Add signup limit feature. #2

Merged
chiu merged 7 commits from 123/seminar:master into master 2023-01-11 10:13:37 +00:00
2 changed files with 5 additions and 3 deletions
Showing only changes of commit a837546620 - Show all commits

View File

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

View File

@ -51,7 +51,7 @@ class SeminarTemplateSetting
end
end
end
def create_seminar_pages
def create_seminar_pages(force_update=true)
if self.seminar_main
@seminar = self.seminar_main
@seminar_page_root = Page.where(:parent_page_id=>self.seminar_main_id).first
@ -60,7 +60,7 @@ class SeminarTemplateSetting
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)
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
pages_info = PagesInfo
relation_model = {"news" => "CustomBulletin","album"=>"CustomAlbum"}
@ -79,7 +79,7 @@ class SeminarTemplateSetting
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)
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
return @seminar_page_root