Fix bug.
This commit is contained in:
parent
f086976912
commit
d1c23953df
Binary file not shown.
File diff suppressed because one or more lines are too long
Binary file not shown.
Binary file not shown.
|
@ -37,9 +37,25 @@ class SeminarsController < ApplicationController
|
|||
template_path = content_style_info["template"]
|
||||
template_info = content_style_info["info"]
|
||||
custom_footer = seminar_template_setting.footer_info
|
||||
if seminar_template_setting.seminar_banner_images.count != 0
|
||||
if seminar_template_setting.seminar_banner_images.count != 0 || background_style_info["default_logo"]
|
||||
banner_title = seminar.title
|
||||
external_link = prefix_url + "/home"
|
||||
images = []
|
||||
if seminar_template_setting.seminar_banner_images.count == 0
|
||||
images = [{
|
||||
"image_link" => background_style_info["default_logo"],
|
||||
"image_alt" => banner_title,
|
||||
"title" => "",
|
||||
"alt_title" => banner_title,
|
||||
"class" => "active",
|
||||
"height" => 0,
|
||||
"width" => 0,
|
||||
"caption" => '<div class="cycle-overlay"></div><div class="cycle-pager"></div>',
|
||||
"context" => "",
|
||||
"link" => external_link,
|
||||
"target" => ""
|
||||
}]
|
||||
else
|
||||
images = seminar_template_setting.seminar_banner_images.map.with_index do |image,i|
|
||||
caption = (i == 0 ? '<div class="cycle-overlay"></div><div class="cycle-pager"></div>' : "")
|
||||
klass = (i == 0 ? "active" : "")
|
||||
|
@ -60,6 +76,7 @@ class SeminarsController < ApplicationController
|
|||
"target" => ""
|
||||
}
|
||||
end
|
||||
end
|
||||
custom_banner = {
|
||||
"extras" => {
|
||||
"ad_fx" => "fade",
|
||||
|
|
|
@ -10,10 +10,46 @@ class SeminarTemplateSetting
|
|||
field :website_title, type: String , default: "", localize: true
|
||||
field :footer_info, type: String , default: "", localize: true
|
||||
field :introduction, type: String , default: "", localize: true
|
||||
field :background_style, type: String , default: ""
|
||||
field :content_style, type: String , default: ""
|
||||
field :background_style, type: String , default: "1"
|
||||
field :content_style, type: String , default: "1"
|
||||
has_many :seminar_banner_images, :autosave => true, :dependent => :destroy
|
||||
accepts_nested_attributes_for :seminar_banner_images, :allow_destroy => true
|
||||
after_create do
|
||||
if self.seminar_main
|
||||
@seminar_page_root = Page.where(:parent_page_id=>self.seminar_main_id).first
|
||||
available_locales = Site.first.in_use_locales rescue I18n.available_locales
|
||||
available_locales = available_locales.map{|l| l.to_s}
|
||||
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)
|
||||
end
|
||||
pages_info = {"introduction" => "seminars_page",
|
||||
"news" => "custom_announcement",
|
||||
"registration" => "seminar_registration",
|
||||
"submission" => "seminar_submission",
|
||||
"album" => "custom_gallery"}
|
||||
relation_model = {"news" => "CustomBulletin","album"=>"CustomAlbum"}
|
||||
pages_info.each do |page_id , page_module|
|
||||
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
|
||||
available_locales_tmp = available_locales.clone
|
||||
if relation_model[page_id]
|
||||
relation = relation_model[page_id].constantize rescue nil
|
||||
if relation
|
||||
if relation.where(:bind_uid=>@seminar.uid).count == 0
|
||||
available_locales_tmp = []
|
||||
end
|
||||
end
|
||||
end
|
||||
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)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
after_save do
|
||||
if self.display_menu_changed?
|
||||
@seminar_page_root = Page.where(:parent_page_id=>self.seminar_main_id).first
|
||||
|
@ -45,10 +81,15 @@ class SeminarTemplateSetting
|
|||
image_file = image_file.select{|f| File.basename(f).include?(folder_name)}.first
|
||||
key = File.basename(folder)
|
||||
image_path = "/assets/seminar/background_style/#{key}/#{File.basename(image_file) rescue ''}"
|
||||
default_logo = nil
|
||||
if File.exist?("#{folder}logo.jpg")
|
||||
default_logo = "#{folder}logo.jpg".split("app")[1..-1].join("app").sub("/stylesheets/","/")
|
||||
end
|
||||
@@background_style_infos[key] = {
|
||||
"image"=>image_path,
|
||||
"css"=> get_folder_content(folder,"css"),
|
||||
"js"=> get_folder_content(folder,"js")
|
||||
"js"=> get_folder_content(folder,"js"),
|
||||
"default_logo"=> default_logo
|
||||
}
|
||||
end
|
||||
@@background_style_infos = @@background_style_infos.sort_by {|k, v| (k.match(/\d+/)[0].to_i rescue 0)}.to_h
|
||||
|
|
|
@ -8,7 +8,8 @@
|
|||
<% begin %>
|
||||
<table class="table table-hover table-striped seminar-index">
|
||||
<caption>
|
||||
<h3><%= t('seminar.seminar') %></h3>
|
||||
<% page = OrbitHelper.page rescue Page.where(:page_id => params[:page_id]).first %>
|
||||
<h3><%= page.name rescue t('seminar.seminar') %></h3>
|
||||
</caption>
|
||||
<thead>
|
||||
<tr>
|
||||
|
|
Loading…
Reference in New Issue