Fix bug. #13

Merged
chiu merged 1 commits from 123/seminar:master into master 2023-05-12 00:02:40 +00:00
1 changed files with 8 additions and 10 deletions

View File

@ -24,12 +24,11 @@ class SeminarsController < ApplicationController
time_now = DateTime.now time_now = DateTime.now
session = OrbitHelper.request.session session = OrbitHelper.request.session
seminars = seminars.map do |seminar| seminars = seminars.map do |seminar|
link_url = OrbitHelper.url_to_plugin_show(seminar.to_param, 'seminar')
registration_is_open = seminar.registration_status.present? registration_is_open = seminar.registration_status.present?
sign_up_not_yet = seminar.signup_start_date && time_now && seminar.signup_start_date > time_now sign_up_not_yet = seminar.signup_start_date && time_now && seminar.signup_start_date > time_now
sign_up_overdue = seminar.signup_end_date && time_now && (seminar.signup_end_date + 1.day <= time_now) sign_up_overdue = seminar.signup_end_date && time_now && (seminar.signup_end_date + 1.day <= time_now)
signup_is_full = seminar.signup_is_full? signup_is_full = seminar.signup_is_full?
seminar_url = (@custom_slug ? OrbitHelper.url_to_show(@custom_slug) : OrbitHelper.url_to_show(seminar.to_param)) seminar_url = (@prefix_url ? @prefix_url : OrbitHelper.url_to_plugin_show(seminar.to_param, 'seminar'))
if !registration_is_open if !registration_is_open
sign_up = t('seminar.sign_up_not_open') sign_up = t('seminar.sign_up_not_open')
elsif sign_up_not_yet elsif sign_up_not_yet
@ -40,16 +39,16 @@ class SeminarsController < ApplicationController
sign_up = t('seminar.sign_up_is_full') sign_up = t('seminar.sign_up_is_full')
else else
sign_up_text = t('seminar.signup') sign_up_text = t('seminar.signup')
sign_up = link_to(sign_up_text, seminar.get_frontend_url(link_url), :target=>'_blank', :title=>sign_up_text) sign_up = link_to(sign_up_text, seminar.get_frontend_url(seminar_url), :target=>'_blank', :title=>sign_up_text)
end end
if !seminar.registration_status.blank? && seminar.registration_status.include?('C') && (seminar.contribute_start_date <= time_now rescue false) && ( seminar.contribute_end_date.nil? || (seminar.contribute_end_date+1 >= time_now rescue false) ) if !seminar.registration_status.blank? && seminar.registration_status.include?('C') && (seminar.contribute_start_date <= time_now rescue false) && ( seminar.contribute_end_date.nil? || (seminar.contribute_end_date+1 >= time_now rescue false) )
sign_up += content_tag :span, :style=> "margin-left: 1em;" do sign_up += content_tag :span, :style=> "margin-left: 1em;" do
if session[:seminar_signup_id].present? && session[:seminar_main_id] == seminar.id if session[:seminar_signup_id].present? && session[:seminar_main_id] == seminar.id
button_text = t('seminar_signup.uploads') button_text = t('seminar_signup.uploads')
link_to(button_text, seminar.get_frontend_url(link_url, :con_upload), {:title=>button_text}) link_to(button_text, seminar.get_frontend_url(seminar_url, :con_upload), {:title=>button_text})
else else
button_text = t('seminar_signup.con_login') button_text = t('seminar_signup.con_login')
link_to(button_text, seminar.get_frontend_url(link_url, :con_login), {:title=>button_text}) link_to(button_text, seminar.get_frontend_url(seminar_url, :con_login), {:title=>button_text})
end end
end end
end end
@ -58,7 +57,7 @@ class SeminarsController < ApplicationController
{"title" => seminar.title, {"title" => seminar.title,
"subtitle" => sign_up, "subtitle" => sign_up,
"category" => (seminar.category.title rescue ""), "category" => (seminar.category.title rescue ""),
"link_to_show" => (OrbitHelper.instance_variable_get(:@url_to_plugin_show_blank) ? 'javascript:void(0)' : seminar.get_frontend_url(link_url, :show_data)), "link_to_show" => (OrbitHelper.instance_variable_get(:@url_to_plugin_show_blank) ? 'javascript:void(0)' : seminar.get_frontend_url(seminar_url, :show_data)),
"postdate" => seminar.seminar_start_date, "postdate" => seminar.seminar_start_date,
"statuses" => {}, "statuses" => {},
"bulletin_links" => links, "bulletin_links" => links,
@ -165,7 +164,6 @@ class SeminarsController < ApplicationController
"time_now" => time_now "time_now" => time_now
} }
@_request = OrbitHelper.request @_request = OrbitHelper.request
@custom_slug = "registration"
@registration_postfix = "" @registration_postfix = ""
if template_info["main_content"] if template_info["main_content"]
main_content = render_other_method("show_data",template_info["main_content"]) main_content = render_other_method("show_data",template_info["main_content"])
@ -255,12 +253,12 @@ class SeminarsController < ApplicationController
def render_other_method(render_method=nil,render_template=nil) def render_other_method(render_method=nil,render_template=nil)
params = OrbitHelper.params params = OrbitHelper.params
if render_method && render_template.nil? if render_method && render_template.nil?
return eval(render_method) return self.send(render_method)
end end
render_method = render_method || params[:method] render_method = render_method || params[:method]
render_template = render_template || render_method render_template = render_template || render_method
params = OrbitHelper.params params = OrbitHelper.params
action_data = eval(render_method) action_data = self.send(render_method)
@seminar_main_url = @prefix_url + '/home/introduction' @seminar_main_url = @prefix_url + '/home/introduction'
if action_data if action_data
if render_method == "con_upload" || render_method == "signup_ok" if render_method == "con_upload" || render_method == "signup_ok"
@ -333,7 +331,7 @@ class SeminarsController < ApplicationController
sign_up_not_yet = seminar.signup_start_date && time_now && seminar.signup_start_date > time_now sign_up_not_yet = seminar.signup_start_date && time_now && seminar.signup_start_date > time_now
sign_up_overdue = seminar.signup_end_date && time_now && (seminar.signup_end_date + 1.day <= time_now) sign_up_overdue = seminar.signup_end_date && time_now && (seminar.signup_end_date + 1.day <= time_now)
signup_is_full = seminar.signup_is_full? signup_is_full = seminar.signup_is_full?
seminar_url = (@custom_slug ? OrbitHelper.url_to_show(@custom_slug) : OrbitHelper.url_to_show(seminar.to_param)) seminar_url = (@prefix_url ? @prefix_url : OrbitHelper.url_to_show(seminar.to_param))
if !registration_is_open if !registration_is_open
sign_up = t('seminar.sign_up_not_open') sign_up = t('seminar.sign_up_not_open')
elsif sign_up_not_yet elsif sign_up_not_yet