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
1 changed files with 4 additions and 1 deletions
Showing only changes of commit 1a447c0bf5 - Show all commits

View File

@ -62,13 +62,16 @@ class SeminarTemplateSetting
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) if force_update @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
display_menu = self.display_menu
pages_info = PagesInfo pages_info = PagesInfo
relation_model = {"news" => "CustomBulletin","album"=>"CustomAlbum"} relation_model = {"news" => "CustomBulletin","album"=>"CustomAlbum"}
pages_info.each do |page_id , page_module| pages_info.each do |page_id , page_module|
seminar_page = @seminar_page_root.child_page.where(:page_id=>page_id).first seminar_page = @seminar_page_root.child_page.where(:page_id=>page_id).first
page_trans = available_locales.map{|l| [l,I18n.with_locale(l){I18n.t("seminar.menu.#{page_id}")}]}.to_h page_trans = available_locales.map{|l| [l,I18n.with_locale(l){I18n.t("seminar.menu.#{page_id}")}]}.to_h
available_locales_tmp = available_locales.clone available_locales_tmp = available_locales.clone
if relation_model[page_id] if display_menu.exclude?(page_id)
available_locales_tmp = []
elsif relation_model[page_id]
relation = relation_model[page_id].constantize rescue nil relation = relation_model[page_id].constantize rescue nil
if relation if relation
if relation.where(:bind_uid=>@seminar.uid).count == 0 if relation.where(:bind_uid=>@seminar.uid).count == 0