This commit is contained in:
BoHung Chiu 2023-04-12 12:35:21 +08:00
parent c99354fc76
commit 511fffa0e2
3 changed files with 22 additions and 6 deletions

View File

@ -333,7 +333,7 @@ class SeminarMain
page_part.sub_parts.where(kind: "module_widget",module: "custom_announcement").destroy page_part.sub_parts.where(kind: "module_widget",module: "custom_announcement").destroy
end end
self.annc_count = 0 self.annc_count = 0
home_page.find_page(:page_id=>"news").update_all(:enabled_for=>[],:enabled_for_mobile=>[],:menu_enabled_for => []) home_page.find_page(:page_id=>"news").update_all(:enabled_for=>[],:enabled_for_mobile=>false,:menu_enabled_for => [])
else else
if page_part.nil? if page_part.nil?
page_part = home_page.page_parts.create(:part_id=>annc_part_id) page_part = home_page.page_parts.create(:part_id=>annc_part_id)
@ -345,7 +345,7 @@ class SeminarMain
data_count: annc_data_count,custom_data_field: {"bind_module_app"=>"seminar", "bind_uid"=>self.uid}) data_count: annc_data_count,custom_data_field: {"bind_module_app"=>"seminar", "bind_uid"=>self.uid})
sub_part.select_options.create(annc_default_select_option_attr) sub_part.select_options.create(annc_default_select_option_attr)
end end
home_page.find_page(:page_id=>"news").update_all(:enabled_for=>@@in_use_locales,:enabled_for_mobile=>@@in_use_locales,:menu_enabled_for => @@in_use_locales) home_page.find_page(:page_id=>"news").update_all(:enabled_for=>@@in_use_locales,:enabled_for_mobile=>true,:menu_enabled_for => @@in_use_locales)
end end
self.save self.save
end end
@ -378,7 +378,7 @@ class SeminarMain
if page_part if page_part
page_part.sub_parts.where(kind: "module_widget",module: "custom_gallery").destroy page_part.sub_parts.where(kind: "module_widget",module: "custom_gallery").destroy
end end
home_page.find_page(:page_id=>"album").update_all(:enabled_for=>[],:enabled_for_mobile=>[],:menu_enabled_for => []) home_page.find_page(:page_id=>"album").update_all(:enabled_for=>[],:enabled_for_mobile=>false,:menu_enabled_for => [])
self.annc_count = 0 self.annc_count = 0
else else
if page_part.nil? if page_part.nil?
@ -390,7 +390,7 @@ class SeminarMain
widget_type: "custom_gallery_widget2",widget_method: "widget", widget_type: "custom_gallery_widget2",widget_method: "widget",
data_count: album_data_count,custom_data_field: {"bind_module_app"=>"seminar", "bind_uid"=>self.uid}) data_count: album_data_count,custom_data_field: {"bind_module_app"=>"seminar", "bind_uid"=>self.uid})
end end
home_page.find_page(:page_id=>"album").update_all(:enabled_for=>@@in_use_locales,:enabled_for_mobile=>@@in_use_locales,:menu_enabled_for => @@in_use_locales) home_page.find_page(:page_id=>"album").update_all(:enabled_for=>@@in_use_locales,:enabled_for_mobile=>true,:menu_enabled_for => @@in_use_locales)
end end
self.save self.save
end end

View File

@ -80,9 +80,9 @@ class SeminarTemplateSetting
end end
end end
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,:enabled_for_mobile=>true)
else else
seminar_page.update(:name_translations=>page_trans,:page_id=>page_id,:url=>"/home/#{page_id}",:module=>page_module) if force_update seminar_page.update(:name_translations=>page_trans,:page_id=>page_id,:url=>"/home/#{page_id}",:module=>page_module,:enabled_for_mobile=>true) if force_update
end end
end end
return @seminar_page_root return @seminar_page_root

View File

@ -10,6 +10,7 @@ Rails.application.routes.draw do
need_update1 = update_flag && !(s.tmp_flags.include?('fix_sr')) need_update1 = update_flag && !(s.tmp_flags.include?('fix_sr'))
need_update2 = !update_flag || !(s.tmp_flags.include?('smer1')) need_update2 = !update_flag || !(s.tmp_flags.include?('smer1'))
need_update3 = !update_flag || !(s.tmp_flags.include?('smer2')) need_update3 = !update_flag || !(s.tmp_flags.include?('smer2'))
need_update4 = !update_flag || !(s.tmp_flags.include?('smer3'))
if need_update1 if need_update1
Page.where(:bind_model=>"SeminarMain",:all_pageids=>nil).each do |p| Page.where(:bind_model=>"SeminarMain",:all_pageids=>nil).each do |p|
p.save p.save
@ -32,6 +33,21 @@ Rails.application.routes.draw do
Site.update_all("$push"=>{"tmp_flags"=>'smer2'}) Site.update_all("$push"=>{"tmp_flags"=>'smer2'})
end end
end end
if need_update4
in_use_locales = s.in_use_locales.map(&:to_s)
Page.where(:parent_page_id.in=>SeminarMain.pluck(:id)).update_all(:enabled_for_mobile=>true, :menu_enabled_for=>in_use_locales, :enabled_for=>in_use_locales)
Page.where(:parent_page_id.in=>SeminarMain.pluck(:id)).each do |p|
p.find_page.each do |pp|
if pp[:enabled_for_mobile].class == Array
pp.enabled_for_mobile = pp[:enabled_for_mobile].present?
pp.save
end
end
end
if update_flag
Site.update_all("$push"=>{"tmp_flags"=>'smer3'})
end
end
end end
SeminarSignupField.create_indexes SeminarSignupField.create_indexes
SeminarSubmissionField.create_indexes SeminarSubmissionField.create_indexes