Fix sign up link.

This commit is contained in:
BoHung Chiu 2022-04-14 12:42:39 +08:00
parent bd5d34197f
commit c5d58fb6e0
1 changed files with 4 additions and 2 deletions

View File

@ -77,8 +77,10 @@ class SeminarsController < ApplicationController
seminar_template_setting = seminar.seminar_template_setting seminar_template_setting = seminar.seminar_template_setting
@seminar_template_setting = seminar_template_setting @seminar_template_setting = seminar_template_setting
home_page = Page.where(:parent_page_id=>seminar.id).first home_page = Page.where(:parent_page_id=>seminar.id).first
OrbitHelper.set_page(home_page) rescue nil
prefix_url = OrbitHelper.request.path.split("-").first + "-#{params[:uid]}" prefix_url = OrbitHelper.request.path.split("-").first + "-#{params[:uid]}"
@prefix_url = prefix_url @prefix_url = prefix_url
@registration_postfix = "/home/registration"
header_data = "<a href=\"#{prefix_url}#{home_page.url}\">Home</a> | " + header_data = "<a href=\"#{prefix_url}#{home_page.url}\">Home</a> | " +
"<a href=\"/\">Main Site</a>" "<a href=\"/\">Main Site</a>"
content_style = seminar_template_setting.content_style content_style = seminar_template_setting.content_style
@ -169,7 +171,7 @@ class SeminarsController < ApplicationController
params = OrbitHelper.params params = OrbitHelper.params
seminar = SeminarMain.find_by(uid: params[:uid]) seminar = SeminarMain.find_by(uid: params[:uid])
if !seminar.registration_status.blank? && seminar.signup_start_date <= time_now && ( seminar.signup_end_date.nil? || seminar.signup_end_date+1 >= time_now ) if !seminar.registration_status.blank? && seminar.signup_start_date <= time_now && ( seminar.signup_end_date.nil? || seminar.signup_end_date+1 >= time_now )
sign_up = ('<a href="'+ prefix_url + '/home/registration" target="_blank">' + t('seminar.signup') + '</a>').html_safe sign_up = ('<a href="'+ prefix_url + @registration_postfix + '" target="_blank">' + t('seminar.signup') + '</a>').html_safe
elsif seminar.registration_status.blank? elsif seminar.registration_status.blank?
sign_up = t('seminar.sign_up_not_open') sign_up = t('seminar.sign_up_not_open')
elsif seminar.signup_start_date > time_now elsif seminar.signup_start_date > time_now
@ -305,7 +307,7 @@ class SeminarsController < ApplicationController
seminar = SeminarMain.find_by(uid: params[:uid]) seminar = SeminarMain.find_by(uid: params[:uid])
if !seminar.registration_status.blank? && seminar.signup_start_date <= time_now && ( seminar.signup_end_date.nil? || seminar.signup_end_date+1 >= time_now ) if !seminar.registration_status.blank? && seminar.signup_start_date <= time_now && ( seminar.signup_end_date.nil? || seminar.signup_end_date+1 >= time_now )
sign_up = ('<a href="'+ OrbitHelper.url_to_show(seminar.to_param) + '" target="_blank">' + t('seminar.signup') + '</a>').html_safe sign_up = ('<a href="'+ OrbitHelper.url_to_show(seminar.to_param) + @registration_postfix.to_s + '" target="_blank">' + t('seminar.signup') + '</a>').html_safe
elsif seminar.registration_status.blank? elsif seminar.registration_status.blank?
sign_up = t('seminar.sign_up_not_open') sign_up = t('seminar.sign_up_not_open')
elsif seminar.signup_start_date > time_now elsif seminar.signup_start_date > time_now