Merge pull request 'Fix bug. Add signup limit feature.' (#2) from 123/seminar:master into master

Reviewed-on: #2
This commit is contained in:
chiu 2023-01-11 10:13:36 +00:00
commit f952165f34
40 changed files with 525 additions and 276 deletions

View File

@ -96,7 +96,7 @@ function inputAppendLength() {
// Role Attribute Template Data // Role Attribute Template Data
function setData(l, type, ol) { function setData(l, type, ol) {
var fields = $('#info').length ? "info[seminar_submission_fields]" : $('#sub_seminar_main').length ? "sub_seminar_main[seminar_submission_fields]" : "seminar_main[seminar_submission_fields]", var fields = $('#sub_seminar_main').length ? "sub_seminar_main[seminar_submission_fields_attributes]" : "seminar_main[seminar_submission_fields_attributes]",
data = { data = {
_add_more: ["add_more_" +l, fields+"["+l+"]["+type+"][add_more]"], _add_more: ["add_more_" +l, fields+"["+l+"]["+type+"][add_more]"],
_calendar: ["calendar_" +l, fields+"["+l+"]["+type+"][calendar]"], _calendar: ["calendar_" +l, fields+"["+l+"]["+type+"][calendar]"],
@ -110,7 +110,7 @@ function setData(l, type, ol) {
_option_list: ["option_list_"+l+"_"+ol, fields+"["+l+"]["+type+"][option_list]["+ol+"]", "option_list_"+ol], _option_list: ["option_list_"+l+"_"+ol, fields+"["+l+"]["+type+"][option_list]["+ol+"]", "option_list_"+ol],
_placeholder: ["placeholder_" +l, fields+"["+l+"]["+type+"][placeholder]"], _placeholder: ["placeholder_" +l, fields+"["+l+"]["+type+"][placeholder]"],
_title_translations: ["title_translations_" +l, fields+"["+l+"][title_translations]"], _title_translations: ["title_translations_" +l, fields+"["+l+"][title_translations]"],
_to_delete: ["to_delete_" +l, fields+"["+l+"][to_delete]"], _destroy: ["destroy_" +l, fields+"["+l+"][_destroy]"],
_to_require: ["to_require_" +l, fields+"["+l+"][to_require]"], _to_require: ["to_require_" +l, fields+"["+l+"][to_require]"],
}; };
return data; return data;
@ -270,6 +270,7 @@ $(function() {
attributesArray = []; attributesArray = [];
attributesHeaderLength = null; attributesHeaderLength = null;
templateType = null; templateType = null;
var default_templateType = 'typeA';
attributeIndex = null; attributeIndex = null;
if($('.add-target').length) { if($('.add-target').length) {
inputAppendLength(); inputAppendLength();
@ -286,7 +287,7 @@ $(function() {
}; };
attributesHeaderLength = $('.attributes:not(:hidden)').length+1; attributesHeaderLength = $('.attributes:not(:hidden)').length+1;
attributesLength = $('#attributes-area .attributes').length; attributesLength = $('#attributes-area .attributes').length;
$("#template-attributes").tmpl(setData(attributesLength, templateType, appendIndex)).appendTo( "#attributes-area" ); $("#template-attributes").tmpl(setData(attributesLength, default_templateType, appendIndex)).appendTo( "#attributes-area" );
$('.toggle-check').togglebox(); $('.toggle-check').togglebox();
}); });
@ -426,7 +427,7 @@ $(function() {
if(!$('.attributes:not(:hidden)').length) { if(!$('.attributes:not(:hidden)').length) {
$('#attributes-area').addClass('clickHere'); $('#attributes-area').addClass('clickHere');
}; };
}).find('.attribute_field_to_delete').attr('value', 'true');; }).find('.attribute_field_destroy').attr('value', 'true');;
}; };
if($(this).hasClass('trigger')) { if($(this).hasClass('trigger')) {
// appendIndex = $(this).closest('.controls').find('.input-append').length; // appendIndex = $(this).closest('.controls').find('.input-append').length;

View File

@ -96,7 +96,7 @@ function inputAppendLength() {
// Role Attribute Template Data // Role Attribute Template Data
function setData(l, type, ol) { function setData(l, type, ol) {
var fields = $('#info').length ? "info[seminar_signup_fields]" : $('#sub_seminar_main').length ? "sub_seminar_main[seminar_signup_fields]" : "seminar_main[seminar_signup_fields]", var fields = $('#sub_seminar_main').length ? "sub_seminar_main[seminar_signup_fields_attributes]" : "seminar_main[seminar_signup_fields_attributes]",
data = { data = {
_add_more: ["add_more_" +l, fields+"["+l+"]["+type+"][add_more]"], _add_more: ["add_more_" +l, fields+"["+l+"]["+type+"][add_more]"],
_calendar: ["calendar_" +l, fields+"["+l+"]["+type+"][calendar]"], _calendar: ["calendar_" +l, fields+"["+l+"]["+type+"][calendar]"],
@ -110,7 +110,7 @@ function setData(l, type, ol) {
_option_list: ["option_list_"+l+"_"+ol, fields+"["+l+"]["+type+"][option_list]["+ol+"]", "option_list_"+ol], _option_list: ["option_list_"+l+"_"+ol, fields+"["+l+"]["+type+"][option_list]["+ol+"]", "option_list_"+ol],
_placeholder: ["placeholder_" +l, fields+"["+l+"]["+type+"][placeholder]"], _placeholder: ["placeholder_" +l, fields+"["+l+"]["+type+"][placeholder]"],
_title_translations: ["title_translations_" +l, fields+"["+l+"][title_translations]"], _title_translations: ["title_translations_" +l, fields+"["+l+"][title_translations]"],
_to_delete: ["to_delete_" +l, fields+"["+l+"][to_delete]"], _destroy: ["destroy_" +l, fields+"["+l+"][_destroy]"],
_to_require: ["to_require_" +l, fields+"["+l+"][to_require]"], _to_require: ["to_require_" +l, fields+"["+l+"][to_require]"],
}; };
return data; return data;
@ -270,6 +270,7 @@ $(function() {
attributesArray = []; attributesArray = [];
attributesHeaderLength = null; attributesHeaderLength = null;
templateType = null; templateType = null;
var default_templateType = 'typeA';
attributeIndex = null; attributeIndex = null;
if($('.add-target').length) { if($('.add-target').length) {
inputAppendLength(); inputAppendLength();
@ -286,10 +287,7 @@ $(function() {
}; };
attributesHeaderLength = $('.attributes:not(:hidden)').length+1; attributesHeaderLength = $('.attributes:not(:hidden)').length+1;
attributesLength = $('#attributes-area .attributes').length; attributesLength = $('#attributes-area .attributes').length;
if(templateType == null){ $("#template-attributes").tmpl(setData(attributesLength, default_templateType, appendIndex)).appendTo( "#attributes-area" );
templateType = "typeA";
}
$("#template-attributes").tmpl(setData(attributesLength, templateType, appendIndex)).appendTo( "#attributes-area" );
$('.toggle-check').togglebox(); $('.toggle-check').togglebox();
}); });
@ -429,7 +427,7 @@ $(function() {
if(!$('.attributes:not(:hidden)').length) { if(!$('.attributes:not(:hidden)').length) {
$('#attributes-area').addClass('clickHere'); $('#attributes-area').addClass('clickHere');
}; };
}).find('.attribute_field_to_delete').attr('value', 'true');; }).find('.attribute_field_destroy').attr('value', 'true');;
}; };
if($(this).hasClass('trigger')) { if($(this).hasClass('trigger')) {
// appendIndex = $(this).closest('.controls').find('.input-append').length; // appendIndex = $(this).closest('.controls').find('.input-append').length;

View File

@ -14,6 +14,12 @@ body, .layout-footer, .layout-footer-inner {
.body-banner{ .body-banner{
padding: 0; padding: 0;
} }
.body-banner img{
width: 100%;
}
.mainContent{
background: #ffffff;
}
.row{ .row{
margin: 0; margin: 0;
} }

View File

@ -26,6 +26,12 @@ header{
.body-banner{ .body-banner{
padding: 0; padding: 0;
} }
.body-banner img{
width: 100%;
}
.mainContent{
background: #ffffff;
}
.row{ .row{
margin: 0; margin: 0;
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 148 KiB

View File

@ -21,6 +21,12 @@ body{
.body-banner{ .body-banner{
padding: 0; padding: 0;
} }
.body-banner img{
width: 100%;
}
.mainContent{
background: #ffffff;
}
.row{ .row{
margin: 0; margin: 0;
} }

View File

@ -24,6 +24,12 @@ body{
.body-banner{ .body-banner{
padding: 0; padding: 0;
} }
.body-banner img{
width: 100%;
}
.mainContent{
background: #ffffff;
}
.row{ .row{
margin: 0; margin: 0;
} }

View File

@ -24,6 +24,12 @@ body{
.body-banner{ .body-banner{
padding: 0; padding: 0;
} }
.body-banner img{
width: 100%;
}
.mainContent{
background: #ffffff;
}
.row{ .row{
margin: 0; margin: 0;
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 86 KiB

View File

@ -28,6 +28,12 @@ body{
.body-banner{ .body-banner{
padding: 0; padding: 0;
} }
.body-banner img{
width: 100%;
}
.mainContent{
background: #ffffff;
}
.row{ .row{
margin: 0; margin: 0;
} }

View File

@ -25,6 +25,12 @@ body{
.body-banner{ .body-banner{
padding: 0; padding: 0;
} }
.body-banner img{
width: 100%;
}
.mainContent{
background: #ffffff;
}
.row{ .row{
margin: 0; margin: 0;
} }

View File

@ -25,6 +25,12 @@ body{
.body-banner{ .body-banner{
padding: 0; padding: 0;
} }
.body-banner img{
width: 100%;
}
.mainContent{
background: #ffffff;
}
.row{ .row{
margin: 0; margin: 0;
} }

View File

@ -27,6 +27,12 @@ header{
.body-banner{ .body-banner{
padding: 0; padding: 0;
} }
.body-banner img{
width: 100%;
}
.mainContent{
background: #ffffff;
}
.row{ .row{
margin: 0; margin: 0;
} }

View File

@ -21,6 +21,12 @@ body{
.body-banner{ .body-banner{
padding: 0; padding: 0;
} }
.body-banner img{
width: 100%;
}
.mainContent{
background: #ffffff;
}
.row{ .row{
margin: 0; margin: 0;
} }

View File

@ -31,6 +31,12 @@ header{
.body-banner{ .body-banner{
padding: 0; padding: 0;
} }
.body-banner img{
width: 100%;
}
.mainContent{
background: #ffffff;
}
.row{ .row{
margin: 0; margin: 0;
} }

View File

@ -20,6 +20,12 @@ body{
.body-banner{ .body-banner{
padding: 0; padding: 0;
} }
.body-banner img{
width: 100%;
}
.mainContent{
background: #ffffff;
}
.row{ .row{
margin: 0; margin: 0;
} }

View File

@ -23,6 +23,12 @@ header{
.body-banner{ .body-banner{
padding: 0; padding: 0;
} }
.body-banner img{
width: 100%;
}
.mainContent{
background: #ffffff;
}
.row{ .row{
margin: 0; margin: 0;
} }

View File

@ -25,6 +25,12 @@ body{
.body-banner{ .body-banner{
padding: 0; padding: 0;
} }
.body-banner img{
width: 100%;
}
.mainContent{
background: #ffffff;
}
.row{ .row{
margin: 0; margin: 0;
} }

View File

@ -27,6 +27,12 @@ body{
.body-banner{ .body-banner{
padding: 0; padding: 0;
} }
.body-banner img{
width: 100%;
}
.mainContent{
background: #ffffff;
}
.row{ .row{
margin: 0; margin: 0;
} }

View File

@ -29,6 +29,12 @@ body{
.body-banner{ .body-banner{
padding: 0; padding: 0;
} }
.body-banner img{
width: 100%;
}
.mainContent{
background: #ffffff;
}
.row{ .row{
margin: 0; margin: 0;
} }

View File

@ -27,6 +27,12 @@ body{
.body-banner{ .body-banner{
padding: 0; padding: 0;
} }
.body-banner img{
width: 100%;
}
.mainContent{
background: #ffffff;
}
.row{ .row{
margin: 0; margin: 0;
} }

View File

@ -71,6 +71,11 @@ li.w-annc__item.row > *:last-child {
padding: 1em; padding: 1em;
} }
} }
@media (min-width: 768px){
.row > .layout-content.col-sm-9{
padding-right: 0;
}
}
[data-pp="200"]{ [data-pp="200"]{
padding: 0 0.9375em; padding: 0 0.9375em;
} }

View File

@ -77,10 +77,13 @@ class Admin::SeminarsController < OrbitAdminController
end end
def sub_page_setting def sub_page_setting
@seminar_page_root = Page.where(:parent_page_id=>params[:id]).first @seminar_page_root = Page.where(:parent_page_id=>params[:id]).first
@seminar_template_setting = SeminarTemplateSetting.where(:seminar_main_id=>params[:id]).first
available_locales = Site.first.in_use_locales rescue I18n.available_locales available_locales = Site.first.in_use_locales rescue I18n.available_locales
available_locales = available_locales.map{|l| l.to_s} available_locales = available_locales.map{|l| l.to_s}
if @seminar_page_root.nil? if @seminar_page_root.nil?
@seminar_page_root = @seminar_template_setting.create_seminar_pages @seminar_page_root = @seminar_template_setting.create_seminar_pages
else
@seminar_template_setting.create_seminar_pages(false)
end end
@items = @seminar_page_root.child_page @items = @seminar_page_root.child_page
@parent_pages = [] @parent_pages = []
@ -498,26 +501,13 @@ class Admin::SeminarsController < OrbitAdminController
@seminar_params["reviewer_ids"] = [] if @seminar_params["reviewer_ids"].nil? @seminar_params["reviewer_ids"] = [] if @seminar_params["reviewer_ids"].nil?
@seminar_params["organizer_id"] = nil if @seminar_params["organizer_id"].nil? @seminar_params["organizer_id"] = nil if @seminar_params["organizer_id"].nil?
end end
if @seminar_params[:seminar_signup_fields] if @seminar_params[:seminar_signup_fields_attributes]
@seminar_params[:seminar_signup_fields].each do |a| @seminar.update_attributes(@seminar_params.slice(:seminar_signup_fields_attributes))
@field_name = 'seminar_main'
field_status = a.last[:id].present?
@attribute_field = SeminarSignupField.add_seminar_signup_field(@seminar, a.last, a.last[:id], field_status)
@attribute = @seminar
end
flash.now[:notice] = "Updated Fields" flash.now[:notice] = "Updated Fields"
@seminar.seminar_signup_fields.each{|t| t.destroy if t["to_delete"] == true}
redirect_to admin_seminars_path and return redirect_to admin_seminars_path and return
elsif @seminar_params[:seminar_submission_fields] elsif @seminar_params[:seminar_submission_fields_attributes]
params[:seminar_main][:seminar_submission_fields].each do |a| @seminar.update_attributes(@seminar_params.slice(:seminar_submission_fields_attributes))
@field_name = 'seminar_main'
field_status = a.last[:id].present?
@attribute_field = SeminarSubmissionField.add_seminar_signup_field(@seminar, a.last, a.last[:id], field_status)
@attribute = @seminar
end
flash.now[:notice] = "Updated Fields" flash.now[:notice] = "Updated Fields"
@seminar.seminar_submission_fields.each{|t| t.destroy if t["to_delete"] == true}
if @seminar.seminar_submission_fields.select{|sf| sf.markup == "seminar_preferred_session"}.count != 0 if @seminar.seminar_submission_fields.select{|sf| sf.markup == "seminar_preferred_session"}.count != 0
@seminar.update(:assign_mode => 2) @seminar.update(:assign_mode => 2)
default_sort_number = SeminarSignup.fields['sort_number'].options[:default] default_sort_number = SeminarSignup.fields['sort_number'].options[:default]
@ -550,7 +540,6 @@ class Admin::SeminarsController < OrbitAdminController
end end
redirect_to admin_seminars_path and return redirect_to admin_seminars_path and return
else else
if !seminar_params['seminar_links_attributes'].nil? if !seminar_params['seminar_links_attributes'].nil?
seminar_params['seminar_links_attributes'].each do |idx,link| seminar_params['seminar_links_attributes'].each do |idx,link|
seminar_params['seminar_links_attributes'].delete(idx.to_s) if link['url'].blank? seminar_params['seminar_links_attributes'].delete(idx.to_s) if link['url'].blank?
@ -559,6 +548,7 @@ class Admin::SeminarsController < OrbitAdminController
@seminar.update_user_id = current_user.id @seminar.update_user_id = current_user.id
if @seminar.update_attributes(seminar_params) if @seminar.update_attributes(seminar_params)
@seminar.update_enable_recaptcha
@seminar.seminar_signup_fields.each{|t| t.destroy if t["to_delete"] == true} @seminar.seminar_signup_fields.each{|t| t.destroy if t["to_delete"] == true}
redirect_to params['referer_url'] and return redirect_to params['referer_url'] and return
else else

View File

@ -1,5 +1,4 @@
class SeminarsController < ApplicationController class SeminarsController < ApplicationController
helper MemberHelper helper MemberHelper
include MemberHelper include MemberHelper
include ActionView::Context #vary important (only add this can access @@session from view) include ActionView::Context #vary important (only add this can access @@session from view)
@ -25,36 +24,41 @@ 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_show(seminar.to_param) link_url = OrbitHelper.url_to_plugin_show(seminar.to_param, 'seminar')
if !seminar.registration_status.blank? && (seminar.signup_start_date <= time_now rescue false) && ( seminar.signup_end_date.nil? || seminar.signup_end_date+1 >= time_now ) registration_is_open = seminar.registration_status.present?
sign_up = ('<a href="'+ link_url + '" target="_blank">' + I18n.t('seminar.signup') + '</a>').html_safe sign_up_not_yet = seminar.signup_start_date && @time_now && @seminar.signup_start_date > @time_now
elsif seminar.registration_status.blank? sign_up_overdue = seminar.signup_end_date && @time_now && (@seminar.signup_end_date + 1.day <= @time_now)
sign_up = I18n.t('seminar.sign_up_not_open') signup_is_full = seminar.signup_is_full?
elsif (seminar.signup_start_date > @time_now rescue false) seminar_url = (@custom_slug ? OrbitHelper.url_to_show(@custom_slug) : OrbitHelper.url_to_show(seminar.to_param))
sign_up = I18n.t('seminar.sign_up_not_yet') if !registration_is_open
sign_up = t('seminar.sign_up_not_open')
elsif sign_up_not_yet
sign_up = t('seminar.sign_up_not_yet')
elsif sign_up_overdue
sign_up = t('seminar.sign_up_overdue')
elsif signup_is_full
sign_up = t('seminar.sign_up_is_full')
else else
sign_up = I18n.t('seminar.sign_up_overdue') 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)
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 += "<span style=\"margin-left: 1em;\">".html_safe sign_up += content_tag :span, :style=> "margin-left: 1em;" do
if !session[:seminar_signup_id].blank? if session[:seminar_signup_id].present? && session[:seminar_main_id] == seminar.id
if session[:seminar_main_id] == seminar.id button_text = t('seminar_signup.uploads')
sign_up += ('<a href="'+ link_url + '?method=con_upload">' + t('seminar_signup.uploads') + '</a>').html_safe link_to(button_text, seminar.get_frontend_url(link_url, :con_upload), {:title=>button_text})
else else
sign_up += ('<a href="'+ link_url + '?method=con_login">' + t('seminar_signup.con_login') + '</a>').html_safe button_text = t('seminar_signup.con_login')
link_to(button_text, seminar.get_frontend_url(link_url, :con_login), {:title=>button_text})
end end
else
sign_up += ('<a href="'+ link_url + '?method=con_login">' + t('seminar_signup.con_login') + '</a>').html_safe
end end
sign_up += "</span>".html_safe
end end
files = seminar.seminar_files.map{|file| { "file_url" => file.file.url, "file_title" => (file.title.blank? ? File.basename(file.file.path) : file.title rescue '') } } rescue [] files = seminar.seminar_files.map{|file| { "file_url" => file.file.url, "file_title" => (file.title.blank? ? File.basename(file.file.path) : file.title rescue '') } } rescue []
files.delete(nil) links = seminar.seminar_links.map{|link| { "link_url" => link.url, "link_title" => (link.title.blank? ? link.url : link.title rescue '') } } rescue []
links = seminar.seminar_links.map{|link| { "link_url" => link.url, "link_title" => (link.title.blank? ? link.url : link.title) } } rescue []
{"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" => (link_url == "#" ? '' : link_url + "?method=show_data"), "link_to_show" => (OrbitHelper.instance_variable_get(:@url_to_plugin_show_blank) ? 'javascript:void(0)' : seminar.get_frontend_url(link_url, :show_data)),
"postdate" => seminar.seminar_start_date, "postdate" => seminar.seminar_start_date,
"statuses" => {}, "statuses" => {},
"bulletin_links" => links, "bulletin_links" => links,
@ -185,14 +189,12 @@ class SeminarsController < ApplicationController
sign_up = t('seminar.sign_up_overdue') sign_up = t('seminar.sign_up_overdue')
end end
if !seminar.registration_status.blank? && seminar.registration_status.include?('C') && seminar.contribute_start_date <= time_now && ( seminar.contribute_end_date.nil? || seminar.contribute_end_date+1 >= time_now ) if !seminar.registration_status.blank? && seminar.registration_status.include?('C') && seminar.contribute_start_date <= time_now && ( seminar.contribute_end_date.nil? || seminar.contribute_end_date+1 >= time_now )
if !@@session[:seminar_signup_id].blank? if @@session[:seminar_signup_id].present? && @@session[:seminar_main_id] == seminar.id
if @@session[:seminar_main_id] == seminar.id button_text = t('seminar_signup.uploads')
contribute_action = ('<a href="'+ submission_url + '?method=con_upload">' + t('seminar_signup.uploads') + '</a>').html_safe contribute_action = link_to(button_text, submission_url + '?method=con_upload', :title=>button_text)
else
contribute_action = ('<a href="'+ submission_url + '?method=con_login">' + t('seminar_signup.con_login') + '</a>').html_safe
end
else else
contribute_action = ('<a href="'+ submission_url + '?method=con_login">' + t('seminar_signup.con_login') + '</a>').html_safe button_text = t('seminar_signup.con_login')
contribute_action = link_to(button_text, submission_url + '?method=con_login', :title=>button_text)
end end
end end
data = { data = {
@ -288,6 +290,23 @@ class SeminarsController < ApplicationController
:params=>params,:session=>@@session},:layout=>false).html_safe :params=>params,:session=>@@session},:layout=>false).html_safe
end end
end end
def get_referer_url_for_notice(notice_words)
referer_url = params[:referer_url].to_s
split_path = referer_url.split("/")
last_path = split_path.last
if last_path.include?("?")
referer_url = split_path[0...-1].join('/') + '/' + last_path.split('?')[0]
uri_query = last_path.split("?")[1..-1].join('?')
uri_query.gsub!(/notice=[^&]*/,'').gsub!(/&+$/,'')
if uri_query.blank?
referer_url = referer_url + "?notice=#{notice_words}"
else
referer_url = referer_url + "?#{uri_query}&notice=#{notice_words}"
end
else
referer_url = referer_url + "?notice=#{notice_words}"
end
end
def show_privacy def show_privacy
params = OrbitHelper.params params = OrbitHelper.params
@ -310,31 +329,34 @@ class SeminarsController < ApplicationController
params = OrbitHelper.params params = OrbitHelper.params
seminar = SeminarMain.find_by(uid: params[:uid]) seminar = SeminarMain.find_by(uid: params[:uid])
registration_is_open = seminar.registration_status.present?
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_not_yet = seminar.signup_start_date && @time_now && @seminar.signup_start_date > @time_now
sign_up = ('<a href="'+ (@custom_slug ? OrbitHelper.url_to_show(@custom_slug) : OrbitHelper.url_to_show(seminar.to_param)) + @registration_postfix.to_s + '" target="_blank">' + t('seminar.signup') + '</a>').html_safe sign_up_overdue = seminar.signup_end_date && @time_now && (@seminar.signup_end_date + 1.day <= @time_now)
elsif seminar.registration_status.blank? signup_is_full = seminar.signup_is_full?
seminar_url = (@custom_slug ? OrbitHelper.url_to_show(@custom_slug) : OrbitHelper.url_to_show(seminar.to_param))
if !registration_is_open
sign_up = t('seminar.sign_up_not_open') sign_up = t('seminar.sign_up_not_open')
elsif seminar.signup_start_date > time_now elsif sign_up_not_yet
sign_up = t('seminar.sign_up_not_yet') sign_up = t('seminar.sign_up_not_yet')
else elsif sign_up_overdue
sign_up = t('seminar.sign_up_overdue') sign_up = t('seminar.sign_up_overdue')
elsif signup_is_full
sign_up = t('seminar.sign_up_is_full')
else
sign_up_text = t('seminar.signup')
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 && ( seminar.contribute_end_date.nil? || seminar.contribute_end_date+1 >= time_now ) if !seminar.registration_status.blank? && seminar.registration_status.include?('C') && seminar.contribute_start_date <= time_now && ( seminar.contribute_end_date.nil? || seminar.contribute_end_date+1 >= time_now )
if !@@session[:seminar_signup_id].blank? if @@session[:seminar_signup_id].present? && @@session[:seminar_main_id] == seminar.id
if @@session[:seminar_main_id] == seminar.id button_text = t('seminar_signup.uploads')
contribute_action = ('<a href="'+ OrbitHelper.url_to_show(seminar.to_param) + '?method=con_upload">' + t('seminar_signup.uploads') + '</a>').html_safe contribute_action = link_to(button_text, seminar.get_frontend_url(seminar_url, :con_upload), :title=>button_text)
else
contribute_action = ('<a href="'+ OrbitHelper.url_to_show(seminar.to_param) + '?method=con_login">' + t('seminar_signup.con_login') + '</a>').html_safe
end
else else
contribute_action = ('<a href="'+ OrbitHelper.url_to_show(seminar.to_param) + '?method=con_login">' + t('seminar_signup.con_login') + '</a>').html_safe button_text = t('seminar_signup.con_login')
contribute_action = link_to(button_text, seminar.get_frontend_url(seminar_url, :con_login), :title=>button_text)
end end
end end
{ {
'seminar' => seminar, 'seminar' => seminar,
'sign_up' => sign_up, 'sign_up' => sign_up,
@ -400,84 +422,97 @@ class SeminarsController < ApplicationController
end end
def create def create
seminar_id = params[:seminar_signup][:seminar_main_id]
@signup = SeminarSignup.where(email: params[:seminar_signup][:email], seminar_main_id: params[:seminar_signup][:seminar_main_id] ).first @seminar = SeminarMain.where(id: seminar_id).first
if @seminar.enable_recaptcha && (!gotcha_valid?)
notice_words = t('recaptcha.errors.verification_failed')
referer_url = get_referer_url_for_notice(notice_words)
redirect_to referer_url, :notice => notice_words
return
end
signup_limit = @seminar.signup_limit
has_counter = false
if signup_limit
if defined?(OrbitHelper::SharedMutex)
OrbitHelper::SharedMutex.synchronize do
signup_count = OrbitHelper::SharedHash['seminar'][:counter][seminar_id]
if signup_count.nil?
signup_count = SeminarSignup.where(:seminar_main_id=>@seminar.id).count
OrbitHelper::SharedHash['seminar'][:counter][seminar_id] = signup_count
end
if signup_limit > signup_count
OrbitHelper::SharedHash['seminar'][:counter][seminar_id] = signup_count + 1
has_counter = true
else
notice_words = t('seminar.sign_up_is_full')
referer_url = get_referer_url_for_notice(notice_words)
redirect_to referer_url, :notice => notice_words
return
end
end
else
signup_count = SeminarSignup.where(:seminar_main_id=>@seminar.id).count
if signup_limit <= signup_count
notice_words = t('seminar.sign_up_is_full')
referer_url = get_referer_url_for_notice(notice_words)
redirect_to referer_url, :notice => notice_words
return
end
end
end
@signup = SeminarSignup.where(email: params[:seminar_signup][:email], seminar_main_id: seminar_id ).first
@seminar_signup = SeminarSignup.new(seminar_signup_params) @seminar_signup = SeminarSignup.new(seminar_signup_params)
@seminar = SeminarMain.where(id:params[:seminar_signup][:seminar_main_id]).first not_signup_yet = @signup.blank?
if @seminar.seminar_signup_field_sets.count!=0 if not_signup_yet && @seminar_signup.save
flag = @seminar.seminar_signup_field_sets.select{|v| v.field_name=='recaptcha'}[0].disabled if !params[:seminar_signup_values].nil?
else seminar_signup_values_params.each_with_index do |r,i|
flag = false field_value = r.last[:id].present?
end @custom_field_value = SeminarSignupValue.put_field_values(@seminar_signup, r.last, r.last[:seminar_signup_field_id], field_value)
if gotcha_valid? || flag
if @signup.blank? && @seminar_signup.save
# if gotcha_valid? && @seminar_signup.save
if !params[:seminar_signup_values].nil?
seminar_signup_values_params.each_with_index do |r,i|
field_value = r.last[:id].present?
@custom_field_value = SeminarSignupValue.put_field_values(@seminar_signup, r.last, r.last[:seminar_signup_field_id], field_value)
end
seminar_reviews = SeminarReview.where(:seminar_main_id=>@seminar.id).to_a
seminar_reviews.each{|sr| sr.save}
@seminar = @seminar_signup.seminar_main
unassigned_seminar_signup_ids = @seminar.seminar_signup_ids.map{|s| s.to_s}
unassigned_seminar_signup_ids.push(@seminar_signup.id.to_s)
seminar_reviews = SeminarReview.where(:seminar_main_id=>@seminar.id).to_a
seminar_reviews.each do |sr|
unassigned_seminar_signup_ids = unassigned_seminar_signup_ids - sr.all_seminar_signup_ids
end
@seminar.unassigned_seminar_signup_ids << @seminar_signup.id.to_s
@seminar.unassigned_mode_1_seminar_signup_ids << @seminar_signup.id.to_s
@seminar.save
else
@seminar.unassigned_seminar_signup_ids << @seminar_signup.id.to_s
@seminar.unassigned_mode_1_seminar_signup_ids << @seminar_signup.id.to_s
@seminar.save
end end
extra_text = "<br>#{I18n.t('seminar_signup.serial_number')}: #{@seminar_signup.display_serial_number}" seminar_reviews = SeminarReview.where(:seminar_main_id=>@seminar.id).to_a
extra_text += render_to_string("seminars/signup_email_contents",:locals=>{:seminar=>@seminar, seminar_reviews.each{|sr| sr.save}
:seminar_signup=>@seminar_signup},:layout=>false) @seminar = @seminar_signup.seminar_main
if params['seminar_signup']['status']=='C' unassigned_seminar_signup_ids = @seminar.seminar_signup_ids.map{|s| s.to_s}
status_param = '&status=' unassigned_seminar_signup_ids.push(@seminar_signup.id.to_s)
send_mail('submission',params[:seminar_signup][:email],params[:seminar_signup][:seminar_main_id],extra_text) seminar_reviews = SeminarReview.where(:seminar_main_id=>@seminar.id).to_a
else seminar_reviews.each do |sr|
status_param = '' unassigned_seminar_signup_ids = unassigned_seminar_signup_ids - sr.all_seminar_signup_ids
send_mail('signup',params[:seminar_signup][:email],params[:seminar_signup][:seminar_main_id],extra_text)
end end
redirect_to "#{params[:referer_url].to_s.chomp('/')}/?method=signup_ok#{status_param}&serial_number=#{@seminar_signup.display_serial_number}" @seminar.unassigned_seminar_signup_ids << @seminar_signup.id.to_s
@seminar.unassigned_mode_1_seminar_signup_ids << @seminar_signup.id.to_s
@seminar.save
else else
if !@signup.blank? @seminar.unassigned_seminar_signup_ids << @seminar_signup.id.to_s
redirect_to "#{params[:referer_url]}", :notice => 'mail已存在' @seminar.unassigned_mode_1_seminar_signup_ids << @seminar_signup.id.to_s
else @seminar.save
referer_url = params[:referer_url].to_s end
if referer_url.split("/").last.include?("?") extra_text = "<br>#{I18n.t('seminar_signup.serial_number')}: #{@seminar_signup.display_serial_number}"
uri_query = referer_url.split("?").last.gsub(/notice=[^&]*/,'') extra_text += render_to_string("seminars/signup_email_contents",:locals=>{:seminar=>@seminar,
if uri_query == "" :seminar_signup=>@seminar_signup},:layout=>false)
referer_url = referer_url.split("?")[0...-1].join("?") + "?notice=#{t('recaptcha.errors.verification_failed')}" if params['seminar_signup']['status']=='C'
else status_param = '&status='
referer_url = referer_url.split("?")[0...-1].join("?") + "&notice=#{t('recaptcha.errors.verification_failed')}" send_mail('submission',params[:seminar_signup][:email],params[:seminar_signup][:seminar_main_id],extra_text)
end else
else status_param = ''
referer_url = referer_url + "?notice=#{t('recaptcha.errors.verification_failed')}" send_mail('signup',params[:seminar_signup][:email],params[:seminar_signup][:seminar_main_id],extra_text)
end end
redirect_to referer_url, :notice => t('recaptcha.errors.verification_failed') redirect_to "#{params[:referer_url].to_s.chomp('/').gsub(/\/([^\/?#]+)(|[^\/]+)$/){|f| '/'+$1}}?method=signup_ok#{status_param}&serial_number=#{@seminar_signup.display_serial_number}"
else
if has_counter
OrbitHelper::SharedMutex.synchronize do
OrbitHelper::SharedHash['seminar'][:counter][seminar_id] = OrbitHelper::SharedHash['seminar'][:counter][seminar_id] - 1
end end
end end
else if !not_signup_yet
referer_url = params[:referer_url].to_s notice_words = t('seminar.email_exist')
if referer_url.split("/").last.include?("?") referer_url = get_referer_url_for_notice(notice_words)
uri_query = referer_url.split("?").last.gsub(/notice=[^&]*/,'') redirect_to referer_url, :notice => notice_words
if uri_query == ""
referer_url = referer_url.split("?")[0...-1].join("?") + "?notice=#{t('recaptcha.errors.verification_failed')}"
else
referer_url = referer_url.split("?")[0...-1].join("?") + "&notice=#{t('recaptcha.errors.verification_failed')}"
end
else else
referer_url = referer_url + "?notice=#{t('recaptcha.errors.verification_failed')}" notice_words = t('seminar.sign_up_failed')
referer_url = get_referer_url_for_notice(notice_words)
redirect_to referer_url, :notice => notice_words
end end
redirect_to referer_url, :notice => t('recaptcha.errors.verification_failed')
end end
end end

View File

@ -9,6 +9,7 @@ class SeminarMain
include Slug include Slug
ChoiceTypes = ["checkbox","radio","select"] ChoiceTypes = ["checkbox","radio","select"]
ExceptFieldSetDisplays = ["password", "recaptcha"] ExceptFieldSetDisplays = ["password", "recaptcha"]
field :enable_recaptcha, :type => Boolean
field :annc_count, :type => Integer, :default => 0 field :annc_count, :type => Integer, :default => 0
field :album_count, :type => Integer, :default => 0 field :album_count, :type => Integer, :default => 0
field :copy_id field :copy_id
@ -25,11 +26,11 @@ class SeminarMain
"F. Environmental and Reaction Engineering","G. Industrial Applications", "F. Environmental and Reaction Engineering","G. Industrial Applications",
"H. Student Oral Presentation Contest (in English)","I. Student Poster Competition" "H. Student Oral Presentation Contest (in English)","I. Student Poster Competition"
] ]
field :seminar_start_date, :type => Date, :default => Time.now field :seminar_start_date, :type => Date, :default => Date.today
field :seminar_end_date, :type => Date, :default => Time.now field :seminar_end_date, :type => Date, :default => Date.today
field :signup_start_date, :type => Date, :default => Time.now field :signup_start_date, :type => Date, :default => Date.today
field :signup_end_date, :type => Date, :default => Time.now field :signup_end_date, :type => Date, :default => Date.today
field :contribute_start_date, :type => Date field :contribute_start_date, :type => Date
field :contribute_end_date, :type => Date field :contribute_end_date, :type => Date
@ -50,6 +51,9 @@ class SeminarMain
field :last_serial_number, :type => Integer, :default => 0 field :last_serial_number, :type => Integer, :default => 0
field :assign_mode, :type => Integer, :default => 0 # 0 => 用default signup ids來分配 ,1 => 用final_session來分配, 2 => 用final_session來分配(當有preffered session欄位時) field :assign_mode, :type => Integer, :default => 0 # 0 => 用default signup ids來分配 ,1 => 用final_session來分配, 2 => 用final_session來分配(當有preffered session欄位時)
field :update_old_flag, :type => Boolean, :default => false field :update_old_flag, :type => Boolean, :default => false
field :signup_limit, :type => Integer, :default => nil
belongs_to :seminar_item belongs_to :seminar_item
belongs_to :organizer , :class_name=>"MemberProfile", :foreign_key => :organizer_id belongs_to :organizer , :class_name=>"MemberProfile", :foreign_key => :organizer_id
has_many :seminar_sessions, :autosave => true, :dependent => :destroy has_many :seminar_sessions, :autosave => true, :dependent => :destroy
@ -79,6 +83,12 @@ class SeminarMain
accepts_nested_attributes_for :seminar_signup_field_customs, :allow_destroy => true accepts_nested_attributes_for :seminar_signup_field_customs, :allow_destroy => true
accepts_nested_attributes_for :seminar_template_setting, :allow_destroy => true accepts_nested_attributes_for :seminar_template_setting, :allow_destroy => true
before_save do before_save do
if self.signup_limit == 0
self.signup_limit = nil
end
if self.signup_limit_changed?
self.sync_signup_count
end
module_app_key = "seminar" module_app_key = "seminar"
add_module_app_member_ids = [] add_module_app_member_ids = []
remove_module_app_member_ids = [] remove_module_app_member_ids = []
@ -229,6 +239,64 @@ class SeminarMain
Page.where(:bind_model=>self.class.to_s,:bind_uid=>self.uid).destroy Page.where(:bind_model=>self.class.to_s,:bind_uid=>self.uid).destroy
end end
end end
def get_frontend_url(tmp_seminar_url, call_action=nil)
@enable_custom_template = self.enable_custom_template
if call_action.nil?
if @enable_custom_template
extra_url = '/home/registration'
else
extra_url = ''
end
elsif call_action == :show_data
if @enable_custom_template
extra_url = '/home/introduction'
else
extra_url = '?method=show_data'
end
else
if @enable_custom_template
extra_url = "/home/submission"
else
extra_url = "?method=#{call_action}"
end
end
tmp_seminar_url + extra_url
end
def update_enable_recaptcha
self.enable_recaptcha = (self.seminar_signup_field_sets.where(:field_name=>'recaptcha', :disabled.ne=>true).count != 0)
self.save
end
def sync_signup_count
if defined?(OrbitHelper::SharedMutex)
seminar_id =self.id.to_s
OrbitHelper::SharedMutex.synchronize do
if self.signup_limit.nil?
OrbitHelper::SharedHash['seminar'][:counter][seminar_id] = nil
else
signup_count = SeminarSignup.where(:seminar_main_id=>self.id).count
OrbitHelper::SharedHash['seminar'][:counter][seminar_id] = signup_count
end
end
end
end
def signup_is_full?
tmp_signup_limit = self.signup_limit
return false if tmp_signup_limit.nil?
if defined?(OrbitHelper::SharedMutex)
seminar_id =self.id.to_s
signup_count = 0
OrbitHelper::SharedMutex.synchronize do
signup_count = OrbitHelper::SharedHash['seminar'][:counter][seminar_id]
if signup_count.nil?
signup_count = SeminarSignup.where(:seminar_main_id=>self.id).count
OrbitHelper::SharedHash['seminar'][:counter][seminar_id] = signup_count
end
end
else
signup_count = SeminarSignup.where(:seminar_main_id=>self.id).count
end
return (tmp_signup_limit <= signup_count)
end
def self.time_range(date1 = null, date2 = null) def self.time_range(date1 = null, date2 = null)
if !date1.blank? if !date1.blank?

View File

@ -30,7 +30,18 @@ class SeminarSignup
accepts_nested_attributes_for :seminar_signup_values, allow_destroy: true accepts_nested_attributes_for :seminar_signup_values, allow_destroy: true
accepts_nested_attributes_for :seminar_signup_contributes, allow_destroy: true accepts_nested_attributes_for :seminar_signup_contributes, allow_destroy: true
scope :sort_ordered, ->{ order_by(:sort_number=>1,:created_at=>1) } scope :sort_ordered, ->{ order_by(:sort_number=>1,:created_at=>1) }
after_destroy do
if defined?(OrbitHelper::SharedMutex)
OrbitHelper::SharedMutex.synchronize do
seminar_id = self.seminar_main_id.to_s
signup_count = OrbitHelper::SharedHash['seminar'][:counter][seminar_id]
if signup_count
signup_count -= 1
OrbitHelper::SharedHash['seminar'][:counter][seminar_id] = signup_count
end
end
end
end
before_create do before_create do
unit = self.unit_translations.values.select{|v| v.present?}.first unit = self.unit_translations.values.select{|v| v.present?}.first
tmp_unit_translations = self.unit_translations tmp_unit_translations = self.unit_translations

View File

@ -6,14 +6,14 @@ class SeminarSignupField
include ::Admin::SeminarsFieldHelper include ::Admin::SeminarsFieldHelper
field :key, type: String field :key, type: String
field :af_count # field :af_count
field :title, type: String, localize: true field :title, type: String, localize: true
field :markup, default: "text_field" field :markup, default: "text_field"
field :option_list, type: Hash,default: {} field :option_list, type: Hash,default: {}
field :markup_options, type: Hash field :markup_options, type: Hash
field :built_in, type: Boolean, default: false field :built_in, type: Boolean, default: false
field :disabled, type: Boolean, default: false field :disabled, type: Boolean, default: false
field :to_delete, type: Boolean, default: false # field :to_delete, type: Boolean, default: false
field :to_require,type: Boolean, default: true field :to_require,type: Boolean, default: true
@ -27,7 +27,15 @@ class SeminarSignupField
has_many :seminar_signup_values, autosave: true, dependent: :destroy has_many :seminar_signup_values, autosave: true, dependent: :destroy
accepts_nested_attributes_for :seminar_signup_values, :allow_destroy => true accepts_nested_attributes_for :seminar_signup_values, :allow_destroy => true
before_save :check_option_list before_save :check_option_list
before_save do |record|
record.instance_variable_set(:@key_changed, record.key_changed?)
true
end
after_save do |record|
if record.instance_variable_get(:@key_changed)
record.seminar_signup_values.update_all(:key=>record.key)
end
end
def markup_value def markup_value
get_data["option_list"] get_data["option_list"]
end end
@ -100,24 +108,16 @@ class SeminarSignupField
def self.add_seminar_signup_field(seminar,seminar_param, seminar_signup_field_id=nil,field_status) def self.add_seminar_signup_field(seminar,seminar_param, seminar_signup_field_id=nil,field_status)
@field_name = 'seminar' @field_name = 'seminar'
if field_status.eql?(true) if field_status.eql?(true)
@seminar_signup_field_counter = seminar.seminar_signup_fields.count rescue nil
@seminar_signup_field = self.find(seminar_signup_field_id) rescue nil @seminar_signup_field = self.find(seminar_signup_field_id) rescue nil
old_key = @seminar_signup_field.key if @seminar_signup_field.nil?
@seminar_signup_field.update(seminar_param) @seminar_signup_field = seminar.seminar_signup_fields.build(seminar_param)
@seminar_signup_field.save @seminar_signup_field.save
attribute_values = @seminar_signup_field.seminar_signup_values else
if attribute_values.count > 0 @seminar_signup_field.update(seminar_param)
attribute_values.each do |av|
av.key = seminar_param["key"]
av.save
end
end end
@seminar_signup_field[:af_count] = @seminar_signup_field_counter
else else
@seminar_signup_field_counter = seminar.seminar_signup_fields.count rescue nil @seminar_signup_field = seminar.seminar_signup_fields.build(seminar_param)
@seminar_signup_field = seminar.seminar_signup_fields.build(seminar_param) rescue nil
@seminar_signup_field.save @seminar_signup_field.save
@seminar_signup_field[:af_count] = @seminar_signup_field_counter
end end
return @seminar_signup_field return @seminar_signup_field
end end

View File

@ -6,14 +6,14 @@ class SeminarSubmissionField
include ::Admin::SeminarsFieldHelper include ::Admin::SeminarsFieldHelper
field :key, type: String field :key, type: String
field :af_count # field :af_count
field :title, type: String, localize: true field :title, type: String, localize: true
field :markup, default: "text_field" field :markup, default: "text_field"
field :option_list, type: Hash,default: {} field :option_list, type: Hash,default: {}
field :markup_options, type: Hash field :markup_options, type: Hash
field :built_in, type: Boolean, default: false field :built_in, type: Boolean, default: false
field :disabled, type: Boolean, default: false field :disabled, type: Boolean, default: false
field :to_delete, type: Boolean, default: false # field :to_delete, type: Boolean, default: false
field :to_require,type: Boolean, default: true field :to_require,type: Boolean, default: true
@ -27,6 +27,15 @@ class SeminarSubmissionField
has_many :seminar_submission_values, autosave: true, dependent: :destroy has_many :seminar_submission_values, autosave: true, dependent: :destroy
accepts_nested_attributes_for :seminar_submission_values, :allow_destroy => true accepts_nested_attributes_for :seminar_submission_values, :allow_destroy => true
before_save :check_option_list before_save :check_option_list
before_save do |record|
record.instance_variable_set(:@key_changed, record.key_changed?)
true
end
after_save do |record|
if record.instance_variable_get(:@key_changed)
record.seminar_submission_values.update_all(:key=>record.key)
end
end
def get_basic_field_name_org def get_basic_field_name_org
"seminar_submission_values" "seminar_submission_values"
end end
@ -125,24 +134,16 @@ class SeminarSubmissionField
def self.add_seminar_signup_field(seminar,seminar_param, seminar_submission_field_id=nil,field_status) def self.add_seminar_signup_field(seminar,seminar_param, seminar_submission_field_id=nil,field_status)
@field_name = 'seminar' @field_name = 'seminar'
if field_status.eql?(true) if field_status.eql?(true)
@seminar_submission_field_counter = seminar.seminar_submission_fields.count rescue nil
@seminar_submission_field = self.find(seminar_submission_field_id) rescue nil @seminar_submission_field = self.find(seminar_submission_field_id) rescue nil
old_key = @seminar_submission_field.key if @seminar_submission_field.nil?
@seminar_submission_field.update(seminar_param) @seminar_submission_field = seminar.seminar_submission_fields.build(seminar_param)
@seminar_submission_field.save @seminar_submission_field.save
attribute_values = @seminar_submission_field.seminar_submission_values else
if attribute_values.count > 0 @seminar_submission_field.update(seminar_param)
attribute_values.each do |av|
av.key = seminar_param["key"]
av.save
end
end end
@seminar_submission_field[:af_count] = @seminar_submission_field_counter
else else
@seminar_submission_field_counter = seminar.seminar_submission_fields.count rescue nil @seminar_submission_field = seminar.seminar_submission_fields.build(seminar_param)
@seminar_submission_field = seminar.seminar_submission_fields.build(seminar_param) rescue nil
@seminar_submission_field.save @seminar_submission_field.save
@seminar_submission_field[:af_count] = @seminar_submission_field_counter
end end
return @seminar_submission_field return @seminar_submission_field
end end

View File

@ -51,7 +51,7 @@ class SeminarTemplateSetting
end end
end end
end end
def create_seminar_pages def create_seminar_pages(force_update=true)
if self.seminar_main if self.seminar_main
@seminar = self.seminar_main @seminar = self.seminar_main
@seminar_page_root = Page.where(:parent_page_id=>self.seminar_main_id).first @seminar_page_root = Page.where(:parent_page_id=>self.seminar_main_id).first
@ -60,15 +60,18 @@ class SeminarTemplateSetting
if @seminar_page_root.nil? 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) @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 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) @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
@ -79,7 +82,7 @@ class SeminarTemplateSetting
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)
else else
seminar_page.update(:name_translations=>page_trans,:page_id=>page_id,:url=>"/home/#{page_id}",:module=>page_module) seminar_page.update(:name_translations=>page_trans,:page_id=>page_id,:url=>"/home/#{page_id}",:module=>page_module) if force_update
end end
end end
return @seminar_page_root return @seminar_page_root

View File

@ -1,16 +1,16 @@
<div class="attributes default <%= attribute_field.disabled ? 'disabled' : ''%>"> <div class="attributes default <%= attribute_field.disabled ? 'disabled' : ''%>">
<% <%
attribute_field.af_count ? @af_counter = attribute_field_counter + attribute_field.af_count : @af_counter = attribute_field_counter @af_counter = attribute_field_counter
%> %>
<div class="attributes-header clearfix"> <div class="attributes-header clearfix">
<div class="toggle-control" style="float: right;"> <div class="toggle-control" style="float: right;">
<div class="togglebox <%= attribute_field.disabled ? 'disabled' : ''%>"> <div class="togglebox <%= attribute_field.disabled ? 'disabled' : ''%>">
<%= hidden_field "#{@field_name}[seminar_signup_fields][#{@af_counter}]","disabled",:value=>attribute_field.disabled,:class=>"toggle-check", :data=>{:deploy=>"right"} %> <%= hidden_field "#{@field_name}[seminar_signup_fields_attributes][#{@af_counter}]","disabled",:value=>attribute_field.disabled,:class=>"toggle-check", :data=>{:deploy=>"right"} %>
<label><b></b></label> <label><b></b></label>
</div> </div>
</div> </div>
<a class="btn btn-mini pull-right btn-danger delete" href="#"><i class="icon-trash"></i> <%= t(:delete_)%></a> <a class="btn btn-mini pull-right btn-danger delete" href="#"><i class="icon-trash"></i> <%= t(:delete_)%></a>
<%= hidden_field "#{@field_name}[seminar_signup_fields][#{@af_counter}]","to_delete",:value=>false,:class=>"attribute_field_to_delete"%> <%= hidden_field "#{@field_name}[seminar_signup_fields_attributes][#{@af_counter}]","_destroy",:value=>false,:class=>"attribute_field_destroy"%>
<a class="btn btn-mini pull-right btn-inverse reply hide" href="#"><i class="icons-reply"></i> Reset</a> <a class="btn btn-mini pull-right btn-inverse reply hide" href="#"><i class="icons-reply"></i> Reset</a>
<h4>Field <span><%= @af_counter + 1 %></span></h4> <h4>Field <span><%= @af_counter + 1 %></span></h4>
</div> </div>
@ -18,27 +18,27 @@
<div class="control-group"> <div class="control-group">
<label class="control-label muted" for="key_<%= @af_counter %>"><%= t(:key) %></label> <label class="control-label muted" for="key_<%= @af_counter %>"><%= t(:key) %></label>
<div class="controls"> <div class="controls">
<%= text_field "#{@field_name}[seminar_signup_fields][#{@af_counter}]","key",:value=>attribute_field.key, :data=>{:type=>"key"} %> <%= text_field "#{@field_name}[seminar_signup_fields_attributes][#{@af_counter}]","key",:value=>attribute_field.key, :data=>{:type=>"key"} %>
</div> </div>
</div> </div>
<%= render :partial=>"shared/attribute_field/placeholder_block",:locals=>{:values=>attribute_field.title_translations,:class_ext=>"pull-left",:label_ext=>t(:name),:field_name=>"#{@field_name}[seminar_signup_fields][#{@af_counter}][title_translations]"}%> <%= render :partial=>"shared/attribute_field/placeholder_block",:locals=>{:values=>attribute_field.title_translations,:class_ext=>"pull-left",:label_ext=>t(:name),:field_name=>"#{@field_name}[seminar_signup_fields_attributes][#{@af_counter}][title_translations]"}%>
<div class="control-group"> <div class="control-group">
<label class="control-label muted" for=""><%= t('seminar.to_require') %></label> <label class="control-label muted" for=""><%= t('seminar.to_require') %></label>
<div class="controls"> <div class="controls">
<label class="radio inline"> <label class="radio inline">
<%= radio_button("#{@field_name}[seminar_signup_fields][#{@af_counter}]", "to_require", "true",:checked => (attribute_field.to_require == true ? true : false), :data=>{:type=>"search_true"}) %><%= t(:yes_)%> <%= radio_button("#{@field_name}[seminar_signup_fields_attributes][#{@af_counter}]", "to_require", "true",:checked => (attribute_field.to_require == true ? true : false), :data=>{:type=>"search_true"}) %><%= t(:yes_)%>
</label> </label>
<label class="radio inline"> <label class="radio inline">
<%= radio_button("#{@field_name}[seminar_signup_fields][#{@af_counter}]", "to_require", "false",:checked => (attribute_field.to_require == false ? true : false), :data=>{:type=>"search_false"}) %><%= t(:no_)%> <%= radio_button("#{@field_name}[seminar_signup_fields_attributes][#{@af_counter}]", "to_require", "false",:checked => (attribute_field.to_require == false ? true : false), :data=>{:type=>"search_false"}) %><%= t(:no_)%>
</label> </label>
</div> </div>
</div> </div>
<div class="control-group"> <div class="control-group">
<label class="control-label muted" for=""><%= t(:type)%></label> <label class="control-label muted" for=""><%= t(:type)%></label>
<div class="controls"> <div class="controls">
<select class="dataType" data-type="select" name=<%= "#{@field_name}[seminar_signup_fields][#{@af_counter}][markup]"%>> <select class="dataType" data-type="select" name=<%= "#{@field_name}[seminar_signup_fields_attributes][#{@af_counter}][markup]"%>>
<%$seminar_list[:markups].each do |key,val|%> <%$seminar_list[:markups].each do |key,val|%>
<% next if val["display_only"] && val["display_only"] != "seminar_signup_field" %> <% next if val["display_only"] && val["display_only"] != "seminar_signup_field" %>
<% if key != 'address' %> <% if key != 'address' %>
@ -57,25 +57,25 @@
<label class="control-label muted"><%= t(:enabled_for)%></label> <label class="control-label muted"><%= t(:enabled_for)%></label>
<div class="controls"> <div class="controls">
<label class="checkbox inline"> <label class="checkbox inline">
<%= check_box_tag("#{@field_name}[seminar_signup_fields][#{@af_counter}][typeA][cross_lang]","true",attribute_field["typeA"]["cross_lang"],:data=>{:type=>"cross_lang"}) %> <%= check_box_tag("#{@field_name}[seminar_signup_fields_attributes][#{@af_counter}][typeA][cross_lang]","true",attribute_field["typeA"]["cross_lang"],:data=>{:type=>"cross_lang"}) %>
<%= t(:cross_lang) %> <%= t(:cross_lang) %>
</label> </label>
<label class="checkbox inline"> <label class="checkbox inline">
<%= check_box_tag("#{@field_name}[seminar_signup_fields][#{@af_counter}][typeA][add_more]","true",attribute_field["typeA"]["add_more"],:data=>{:type=>"add_more"}) %> <%= check_box_tag("#{@field_name}[seminar_signup_fields_attributes][#{@af_counter}][typeA][add_more]","true",attribute_field["typeA"]["add_more"],:data=>{:type=>"add_more"}) %>
<%= t(:add_more)%> <%= t(:add_more)%>
</label> </label>
</div> </div>
</div> </div>
<%= render :partial=>"shared/attribute_field/placeholder_block",:locals=>{:values=>attribute_field["typeA"]["placeholder"],:field_name=>"#{@field_name}[seminar_signup_fields][#{@af_counter}][typeA][placeholder]"}%> <%= render :partial=>"shared/attribute_field/placeholder_block",:locals=>{:values=>attribute_field["typeA"]["placeholder"],:field_name=>"#{@field_name}[seminar_signup_fields_attributes][#{@af_counter}][typeA][placeholder]"}%>
<% end if show_seminar_type_panel(attribute_field,"typeA") != 'typeA hide' %> <% end if show_seminar_type_panel(attribute_field,"typeA") != 'typeA hide' %>
<%= content_tag :div,:class=>"field-type default fade in #{show_seminar_type_panel(attribute_field,"typeB")}" do %> <%= content_tag :div,:class=>"field-type default fade in #{show_seminar_type_panel(attribute_field,"typeB")}" do %>
<%= render :partial=>"shared/attribute_field/placeholder_block",:locals=>{:label_ext=>t(:initial),:values=>attribute_field["typeB"]["initial"],:field_name=>"#{@field_name}[seminar_signup_fields][#{@af_counter}][typeB][initial]"}%> <%= render :partial=>"shared/attribute_field/placeholder_block",:locals=>{:label_ext=>t(:initial),:values=>attribute_field["typeB"]["initial"],:field_name=>"#{@field_name}[seminar_signup_fields_attributes][#{@af_counter}][typeB][initial]"}%>
<% if attribute_field.self_defined_markup_options?%> <% if attribute_field.self_defined_markup_options?%>
<%= render :partial=>"shared/attribute_field/list_block",:locals=>{:values=>attribute_field["option_list"],:field_name=> "#{@field_name}[seminar_signup_fields][#{@af_counter}][attribute][seminar][statuses]"} %> <%= render :partial=>"shared/attribute_field/list_block",:locals=>{:values=>attribute_field["option_list"],:field_name=> "#{@field_name}[seminar_signup_fields_attributes][#{@af_counter}][attribute][seminar][statuses]"} %>
<%else #normal list%> <%else #normal list%>
<%= render :partial=>"shared/attribute_field/list_block",:locals=>{:values=>attribute_field["option_list"],:field_name=> "#{@field_name}[seminar_signup_fields][#{@af_counter}][typeB][option_list]"} %> <%= render :partial=>"shared/attribute_field/list_block",:locals=>{:values=>attribute_field["option_list"],:field_name=> "#{@field_name}[seminar_signup_fields_attributes][#{@af_counter}][typeB][option_list]"} %>
<% end #of self_defined_markup_options?%> <% end #of self_defined_markup_options?%>
<% end if show_seminar_type_panel(attribute_field,"typeB") != 'typeB hide' %> <% end if show_seminar_type_panel(attribute_field,"typeB") != 'typeB hide' %>
@ -84,17 +84,17 @@
<div class="control-group"> <div class="control-group">
<label class="control-label"><%= t("date.format")%></label> <label class="control-label"><%= t("date.format")%></label>
<div class="controls"> <div class="controls">
<%= select "#{@field_name}[seminar_signup_fields][#{@af_counter}][typeC]","format",Admin::AttributeValuesViewHelper::OPT,:class=>"dataType",:selected=>attribute_field["typeC"]["format"] %> <%= select "#{@field_name}[seminar_signup_fields_attributes][#{@af_counter}][typeC]","format",Admin::AttributeValuesViewHelper::OPT,:class=>"dataType",:selected=>attribute_field["typeC"]["format"] %>
</div> </div>
</div> </div>
<div class="control-group"> <div class="control-group">
<label class="control-label"><%= t("date.range")%></label> <label class="control-label"><%= t("date.range")%></label>
<div class="controls"> <div class="controls">
<label class="radio inline"> <label class="radio inline">
<%= radio_button("#{@field_name}[seminar_signup_fields][#{@af_counter}][typeC]", "is_range", "false",:checked => (!attribute_field.date_is_range? ? true : false)) %><%= t(:yes_)%> <%= radio_button("#{@field_name}[seminar_signup_fields_attributes][#{@af_counter}][typeC]", "is_range", "false",:checked => (!attribute_field.date_is_range? ? true : false)) %><%= t(:yes_)%>
</label> </label>
<label class="radio inline"> <label class="radio inline">
<%= radio_button("#{@field_name}[seminar_signup_fields][#{@af_counter}][typeC]", "is_range", "true",:checked => (attribute_field.date_is_range? ? true : false)) %><%= t(:no_)%> <%= radio_button("#{@field_name}[seminar_signup_fields_attributes][#{@af_counter}][typeC]", "is_range", "true",:checked => (attribute_field.date_is_range? ? true : false)) %><%= t(:no_)%>
</label> </label>
</div> </div>
</div> </div>
@ -102,10 +102,10 @@
<label class="control-label"><%= t("date.calendar")%></label> <label class="control-label"><%= t("date.calendar")%></label>
<div class="controls"> <div class="controls">
<label class="radio inline"> <label class="radio inline">
<%= radio_button("#{@field_name}[seminar_signup_fields][#{@af_counter}][typeC]", "calendar", "west_calendar",:checked =>(attribute_field["typeC"]["calendar"]== "west_calendar" ? true : false)) %><%= t("date.west_calendar")%> <%= radio_button("#{@field_name}[seminar_signup_fields_attributes][#{@af_counter}][typeC]", "calendar", "west_calendar",:checked =>(attribute_field["typeC"]["calendar"]== "west_calendar" ? true : false)) %><%= t("date.west_calendar")%>
</label> </label>
<label class="radio inline"> <label class="radio inline">
<%= radio_button("#{@field_name}[seminar_signup_fields][#{@af_counter}][typeC]", "calendar", "tw_calendar",:checked =>(attribute_field["typeC"]["calendar"]== "tw_calendar" ? true : false)) %><%= t("date.tw_calendar")%> <%= radio_button("#{@field_name}[seminar_signup_fields_attributes][#{@af_counter}][typeC]", "calendar", "tw_calendar",:checked =>(attribute_field["typeC"]["calendar"]== "tw_calendar" ? true : false)) %><%= t("date.tw_calendar")%>
</label> </label>
</div> </div>
</div> </div>
@ -116,18 +116,18 @@
<label class="control-label"><%= t(:enabled_for)%></label> <label class="control-label"><%= t(:enabled_for)%></label>
<div class="controls"> <div class="controls">
<label class="checkbox inline"> <label class="checkbox inline">
<%= check_box_tag("#{@field_name}[seminar_signup_fields][#{@af_counter}][typeD][cross_lang]","true",attribute_field["typeD"]["cross_lang"]) %> <%= check_box_tag("#{@field_name}[seminar_signup_fields_attributes][#{@af_counter}][typeD][cross_lang]","true",attribute_field["typeD"]["cross_lang"]) %>
<%= t(:cross_lang)%> <%= t(:cross_lang)%>
</label> </label>
</div> </div>
</div> </div>
<%= render :partial=>"shared/attribute_field/placeholder_block",:locals=>{:field_name=>"#{@field_name}[seminar_signup_fields][#{@af_counter}][typeD][placeholder]",:values=>attribute_field["typeD"]["placeholder"]} %> <%= render :partial=>"shared/attribute_field/placeholder_block",:locals=>{:field_name=>"#{@field_name}[seminar_signup_fields_attributes][#{@af_counter}][typeD][placeholder]",:values=>attribute_field["typeD"]["placeholder"]} %>
<% end if show_seminar_type_panel(attribute_field,"typeD") != 'typeD hide' %> <% end if show_seminar_type_panel(attribute_field,"typeD") != 'typeD hide' %>
<%= content_tag :div,:class=>"field-type default fade in #{show_seminar_type_panel(attribute_field,"typeE")}" do%> <%= content_tag :div,:class=>"field-type default fade in #{show_seminar_type_panel(attribute_field,"typeE")}" do%>
<%= render :partial=>"shared/attribute_field/list_block",:locals=>{:field_name=>"#{@field_name}[seminar_signup_fields][#{@af_counter}][typeE][option_list]",:values=>attribute_field["typeE"]["option_list"]}%> <%= render :partial=>"shared/attribute_field/list_block",:locals=>{:field_name=>"#{@field_name}[seminar_signup_fields_attributes][#{@af_counter}][typeE][option_list]",:values=>attribute_field["typeE"]["option_list"]}%>
<% end if show_seminar_type_panel(attribute_field,"typeE") != 'typeE hide' %> <% end if show_seminar_type_panel(attribute_field,"typeE") != 'typeE hide' %>
<%= hidden_field "#{@field_name}[seminar_signup_fields][#{@af_counter}]","id",:value=>attribute_field.id%> <%= hidden_field "#{@field_name}[seminar_signup_fields_attributes][#{@af_counter}]","id",:value=>attribute_field.id%>
</div> </div>

View File

@ -1,16 +1,16 @@
<div class="attributes default <%= attribute_submission_field.disabled ? 'disabled' : ''%>"> <div class="attributes default <%= attribute_submission_field.disabled ? 'disabled' : ''%>">
<% <%
attribute_submission_field.af_count ? @af_counter = attribute_submission_field_counter + attribute_submission_field.af_count : @af_counter = attribute_submission_field_counter @af_counter = attribute_submission_field_counter
%> %>
<div class="attributes-header clearfix"> <div class="attributes-header clearfix">
<div class="toggle-control" style="float: right;"> <div class="toggle-control" style="float: right;">
<div class="togglebox <%= attribute_submission_field.disabled ? 'disabled' : ''%>"> <div class="togglebox <%= attribute_submission_field.disabled ? 'disabled' : ''%>">
<%= hidden_field "#{@field_name}[seminar_submission_fields][#{@af_counter}]","disabled",:value=>attribute_submission_field.disabled,:class=>"toggle-check", :data=>{:deploy=>"right"} %> <%= hidden_field "#{@field_name}[seminar_submission_fields_attributes][#{@af_counter}]","disabled",:value=>attribute_submission_field.disabled,:class=>"toggle-check", :data=>{:deploy=>"right"} %>
<label><b></b></label> <label><b></b></label>
</div> </div>
</div> </div>
<a class="btn btn-mini pull-right btn-danger delete" href="#"><i class="icon-trash"></i> <%= t(:delete_)%></a> <a class="btn btn-mini pull-right btn-danger delete" href="#"><i class="icon-trash"></i> <%= t(:delete_)%></a>
<%= hidden_field "#{@field_name}[seminar_submission_fields][#{@af_counter}]","to_delete",:value=>false,:class=>"attribute_submission_field_to_delete"%> <%= hidden_field "#{@field_name}[seminar_submission_fields_attributes][#{@af_counter}]","_destroy",:value=>false,:class=>"attribute_field_destroy"%>
<a class="btn btn-mini pull-right btn-inverse reply hide" href="#"><i class="icons-reply"></i> Reset</a> <a class="btn btn-mini pull-right btn-inverse reply hide" href="#"><i class="icons-reply"></i> Reset</a>
<h4>Field <span><%= @af_counter + 1 %></span></h4> <h4>Field <span><%= @af_counter + 1 %></span></h4>
</div> </div>
@ -18,27 +18,27 @@
<div class="control-group"> <div class="control-group">
<label class="control-label muted" for="key_<%= @af_counter %>"><%= t(:key) %></label> <label class="control-label muted" for="key_<%= @af_counter %>"><%= t(:key) %></label>
<div class="controls"> <div class="controls">
<%= text_field "#{@field_name}[seminar_submission_fields][#{@af_counter}]","key",:value=>attribute_submission_field.key, :data=>{:type=>"key"} %> <%= text_field "#{@field_name}[seminar_submission_fields_attributes][#{@af_counter}]","key",:value=>attribute_submission_field.key, :data=>{:type=>"key"} %>
</div> </div>
</div> </div>
<%= render :partial=>"shared/attribute_field/placeholder_block",:locals=>{:values=>attribute_submission_field.title_translations,:class_ext=>"pull-left",:label_ext=>t(:name),:field_name=>"#{@field_name}[seminar_submission_fields][#{@af_counter}][title_translations]"}%> <%= render :partial=>"shared/attribute_field/placeholder_block",:locals=>{:values=>attribute_submission_field.title_translations,:class_ext=>"pull-left",:label_ext=>t(:name),:field_name=>"#{@field_name}[seminar_submission_fields_attributes][#{@af_counter}][title_translations]"}%>
<div class="control-group"> <div class="control-group">
<label class="control-label muted" for=""><%= t('seminar.to_require') %></label> <label class="control-label muted" for=""><%= t('seminar.to_require') %></label>
<div class="controls"> <div class="controls">
<label class="radio inline"> <label class="radio inline">
<%= radio_button("#{@field_name}[seminar_submission_fields][#{@af_counter}]", "to_require", "true",:checked => (attribute_submission_field.to_require == true ? true : false), :data=>{:type=>"search_true"}) %><%= t(:yes_)%> <%= radio_button("#{@field_name}[seminar_submission_fields_attributes][#{@af_counter}]", "to_require", "true",:checked => (attribute_submission_field.to_require == true ? true : false), :data=>{:type=>"search_true"}) %><%= t(:yes_)%>
</label> </label>
<label class="radio inline"> <label class="radio inline">
<%= radio_button("#{@field_name}[seminar_submission_fields][#{@af_counter}]", "to_require", "false",:checked => (attribute_submission_field.to_require == false ? true : false), :data=>{:type=>"search_false"}) %><%= t(:no_)%> <%= radio_button("#{@field_name}[seminar_submission_fields_attributes][#{@af_counter}]", "to_require", "false",:checked => (attribute_submission_field.to_require == false ? true : false), :data=>{:type=>"search_false"}) %><%= t(:no_)%>
</label> </label>
</div> </div>
</div> </div>
<div class="control-group"> <div class="control-group">
<label class="control-label muted" for=""><%= t(:type)%></label> <label class="control-label muted" for=""><%= t(:type)%></label>
<div class="controls"> <div class="controls">
<select class="dataType" data-type="select" name=<%= "#{@field_name}[seminar_submission_fields][#{@af_counter}][markup]"%>> <select class="dataType" data-type="select" name=<%= "#{@field_name}[seminar_submission_fields_attributes][#{@af_counter}][markup]"%>>
<%$seminar_list[:markups].each do |key,val|%> <%$seminar_list[:markups].each do |key,val|%>
<% next if val["display_only"] && val["display_only"] != "seminar_submission_field" %> <% next if val["display_only"] && val["display_only"] != "seminar_submission_field" %>
<% if key != 'address' %> <% if key != 'address' %>
@ -57,25 +57,25 @@
<label class="control-label muted"><%= t(:enabled_for)%></label> <label class="control-label muted"><%= t(:enabled_for)%></label>
<div class="controls"> <div class="controls">
<label class="checkbox inline"> <label class="checkbox inline">
<%= check_box_tag("#{@field_name}[seminar_submission_fields][#{@af_counter}][typeA][cross_lang]","true",attribute_submission_field["typeA"]["cross_lang"],:data=>{:type=>"cross_lang"}) %> <%= check_box_tag("#{@field_name}[seminar_submission_fields_attributes][#{@af_counter}][typeA][cross_lang]","true",attribute_submission_field["typeA"]["cross_lang"],:data=>{:type=>"cross_lang"}) %>
<%= t(:cross_lang) %> <%= t(:cross_lang) %>
</label> </label>
<label class="checkbox inline"> <label class="checkbox inline">
<%= check_box_tag("#{@field_name}[seminar_submission_fields][#{@af_counter}][typeA][add_more]","true",attribute_submission_field["typeA"]["add_more"],:data=>{:type=>"add_more"}) %> <%= check_box_tag("#{@field_name}[seminar_submission_fields_attributes][#{@af_counter}][typeA][add_more]","true",attribute_submission_field["typeA"]["add_more"],:data=>{:type=>"add_more"}) %>
<%= t(:add_more)%> <%= t(:add_more)%>
</label> </label>
</div> </div>
</div> </div>
<%= render :partial=>"shared/attribute_field/placeholder_block",:locals=>{:values=>attribute_submission_field["typeA"]["placeholder"],:field_name=>"#{@field_name}[seminar_submission_fields][#{@af_counter}][typeA][placeholder]"}%> <%= render :partial=>"shared/attribute_field/placeholder_block",:locals=>{:values=>attribute_submission_field["typeA"]["placeholder"],:field_name=>"#{@field_name}[seminar_submission_fields_attributes][#{@af_counter}][typeA][placeholder]"}%>
<% end if show_seminar_type_panel(attribute_submission_field,"typeA") != 'typeA hide' %> <% end if show_seminar_type_panel(attribute_submission_field,"typeA") != 'typeA hide' %>
<%= content_tag :div,:class=>"field-type default fade in #{show_seminar_type_panel(attribute_submission_field,"typeB")}" do %> <%= content_tag :div,:class=>"field-type default fade in #{show_seminar_type_panel(attribute_submission_field,"typeB")}" do %>
<%= render :partial=>"shared/attribute_field/placeholder_block",:locals=>{:label_ext=>t(:initial),:values=>attribute_submission_field["typeB"]["initial"],:field_name=>"#{@field_name}[seminar_submission_fields][#{@af_counter}][typeB][initial]"}%> <%= render :partial=>"shared/attribute_field/placeholder_block",:locals=>{:label_ext=>t(:initial),:values=>attribute_submission_field["typeB"]["initial"],:field_name=>"#{@field_name}[seminar_submission_fields_attributes][#{@af_counter}][typeB][initial]"}%>
<% if attribute_submission_field.self_defined_markup_options?%> <% if attribute_submission_field.self_defined_markup_options?%>
<%= render :partial=>"shared/attribute_field/list_block",:locals=>{:values=>attribute_submission_field["option_list"],:field_name=> "#{@field_name}[seminar_submission_fields][#{@af_counter}][attribute][seminar][statuses]"} %> <%= render :partial=>"shared/attribute_field/list_block",:locals=>{:values=>attribute_submission_field["option_list"],:field_name=> "#{@field_name}[seminar_submission_fields_attributes][#{@af_counter}][attribute][seminar][statuses]"} %>
<%else #normal list%> <%else #normal list%>
<%= render :partial=>"shared/attribute_field/list_block",:locals=>{:values=>attribute_submission_field["option_list"],:field_name=> "#{@field_name}[seminar_submission_fields][#{@af_counter}][typeB][option_list]"} %> <%= render :partial=>"shared/attribute_field/list_block",:locals=>{:values=>attribute_submission_field["option_list"],:field_name=> "#{@field_name}[seminar_submission_fields_attributes][#{@af_counter}][typeB][option_list]"} %>
<% end #of self_defined_markup_options?%> <% end #of self_defined_markup_options?%>
<% end if show_seminar_type_panel(attribute_submission_field,"typeB") != 'typeB hide' %> <% end if show_seminar_type_panel(attribute_submission_field,"typeB") != 'typeB hide' %>
@ -84,17 +84,17 @@
<div class="control-group"> <div class="control-group">
<label class="control-label"><%= t("date.format")%></label> <label class="control-label"><%= t("date.format")%></label>
<div class="controls"> <div class="controls">
<%= select "#{@field_name}[seminar_submission_fields][#{@af_counter}][typeC]","format",Admin::AttributeValuesViewHelper::OPT,:class=>"dataType",:selected=>attribute_submission_field["typeC"]["format"] %> <%= select "#{@field_name}[seminar_submission_fields_attributes][#{@af_counter}][typeC]","format",Admin::AttributeValuesViewHelper::OPT,:class=>"dataType",:selected=>attribute_submission_field["typeC"]["format"] %>
</div> </div>
</div> </div>
<div class="control-group"> <div class="control-group">
<label class="control-label"><%= t("date.range")%></label> <label class="control-label"><%= t("date.range")%></label>
<div class="controls"> <div class="controls">
<label class="radio inline"> <label class="radio inline">
<%= radio_button("#{@field_name}[seminar_submission_fields][#{@af_counter}][typeC]", "is_range", "false",:checked => (!attribute_submission_field.date_is_range? ? true : false)) %><%= t(:yes_)%> <%= radio_button("#{@field_name}[seminar_submission_fields_attributes][#{@af_counter}][typeC]", "is_range", "false",:checked => (!attribute_submission_field.date_is_range? ? true : false)) %><%= t(:yes_)%>
</label> </label>
<label class="radio inline"> <label class="radio inline">
<%= radio_button("#{@field_name}[seminar_submission_fields][#{@af_counter}][typeC]", "is_range", "true",:checked => (attribute_submission_field.date_is_range? ? true : false)) %><%= t(:no_)%> <%= radio_button("#{@field_name}[seminar_submission_fields_attributes][#{@af_counter}][typeC]", "is_range", "true",:checked => (attribute_submission_field.date_is_range? ? true : false)) %><%= t(:no_)%>
</label> </label>
</div> </div>
</div> </div>
@ -102,10 +102,10 @@
<label class="control-label"><%= t("date.calendar")%></label> <label class="control-label"><%= t("date.calendar")%></label>
<div class="controls"> <div class="controls">
<label class="radio inline"> <label class="radio inline">
<%= radio_button("#{@field_name}[seminar_submission_fields][#{@af_counter}][typeC]", "calendar", "west_calendar",:checked =>(attribute_submission_field["typeC"]["calendar"]== "west_calendar" ? true : false)) %><%= t("date.west_calendar")%> <%= radio_button("#{@field_name}[seminar_submission_fields_attributes][#{@af_counter}][typeC]", "calendar", "west_calendar",:checked =>(attribute_submission_field["typeC"]["calendar"]== "west_calendar" ? true : false)) %><%= t("date.west_calendar")%>
</label> </label>
<label class="radio inline"> <label class="radio inline">
<%= radio_button("#{@field_name}[seminar_submission_fields][#{@af_counter}][typeC]", "calendar", "tw_calendar",:checked =>(attribute_submission_field["typeC"]["calendar"]== "tw_calendar" ? true : false)) %><%= t("date.tw_calendar")%> <%= radio_button("#{@field_name}[seminar_submission_fields_attributes][#{@af_counter}][typeC]", "calendar", "tw_calendar",:checked =>(attribute_submission_field["typeC"]["calendar"]== "tw_calendar" ? true : false)) %><%= t("date.tw_calendar")%>
</label> </label>
</div> </div>
</div> </div>
@ -116,16 +116,16 @@
<label class="control-label"><%= t(:enabled_for)%></label> <label class="control-label"><%= t(:enabled_for)%></label>
<div class="controls"> <div class="controls">
<label class="checkbox inline"> <label class="checkbox inline">
<%= check_box_tag("#{@field_name}[seminar_submission_fields][#{@af_counter}][typeD][cross_lang]","true",attribute_submission_field["typeD"]["cross_lang"]) %> <%= check_box_tag("#{@field_name}[seminar_submission_fields_attributes][#{@af_counter}][typeD][cross_lang]","true",attribute_submission_field["typeD"]["cross_lang"]) %>
<%= t(:cross_lang)%> <%= t(:cross_lang)%>
</label> </label>
</div> </div>
</div> </div>
<%= render :partial=>"shared/attribute_field/placeholder_block",:locals=>{:field_name=>"#{@field_name}[seminar_submission_fields][#{@af_counter}][typeD][placeholder]",:values=>attribute_submission_field["typeD"]["placeholder"]} %> <%= render :partial=>"shared/attribute_field/placeholder_block",:locals=>{:field_name=>"#{@field_name}[seminar_submission_fields_attributes][#{@af_counter}][typeD][placeholder]",:values=>attribute_submission_field["typeD"]["placeholder"]} %>
<% end if show_seminar_type_panel(attribute_submission_field,"typeD") != 'typeD hide' %> <% end if show_seminar_type_panel(attribute_submission_field,"typeD") != 'typeD hide' %>
<%= content_tag :div,:class=>"field-type default fade in #{show_seminar_type_panel(attribute_submission_field,"typeE")}" do%> <%= content_tag :div,:class=>"field-type default fade in #{show_seminar_type_panel(attribute_submission_field,"typeE")}" do%>
<%= render :partial=>"shared/attribute_field/list_block",:locals=>{:field_name=>"#{@field_name}[seminar_submission_fields][#{@af_counter}][typeE][option_list]",:values=>attribute_submission_field["typeE"]["option_list"]}%> <%= render :partial=>"shared/attribute_field/list_block",:locals=>{:field_name=>"#{@field_name}[seminar_submission_fields_attributes][#{@af_counter}][typeE][option_list]",:values=>attribute_submission_field["typeE"]["option_list"]}%>
<% end if show_seminar_type_panel(attribute_submission_field,"typeE") != 'typeE hide' %> <% end if show_seminar_type_panel(attribute_submission_field,"typeE") != 'typeE hide' %>
<%= content_tag :div,:class=>"field-type default fade in #{show_seminar_type_panel(attribute_submission_field,"typeF")}" do%> <%= content_tag :div,:class=>"field-type default fade in #{show_seminar_type_panel(attribute_submission_field,"typeF")}" do%>
<div class="control-group"> <div class="control-group">
@ -139,6 +139,6 @@
</div> </div>
</div> </div>
<% end if show_seminar_type_panel(attribute_submission_field,"typeF") != 'typeF hide' %> <% end if show_seminar_type_panel(attribute_submission_field,"typeF") != 'typeF hide' %>
<%= hidden_field "#{@field_name}[seminar_submission_fields][#{@af_counter}]","id",:value=>attribute_submission_field.id%> <%= hidden_field "#{@field_name}[seminar_submission_fields_attributes][#{@af_counter}]","id",:value=>attribute_submission_field.id%>
</div> </div>

View File

@ -112,6 +112,13 @@
</div> </div>
</div> </div>
<div class="control-group">
<label class="control-label muted"><%= t('seminar.signup_limit') %></label>
<div class="controls">
<%= f.number_field :signup_limit, placeholder: t('seminar.blank_no_limit') %>
</div>
</div>
<!-- Contribute Date Time Picker --> <!-- Contribute Date Time Picker -->
<div class="control-group"> <div class="control-group">
<label class="control-label muted"><%= t('seminar.contribute_start_date') %></label> <label class="control-label muted"><%= t('seminar.contribute_start_date') %></label>

View File

@ -32,10 +32,11 @@
<% @seminar.seminar_signup_field_customs.each do |field_set| %> <% @seminar.seminar_signup_field_customs.each do |field_set| %>
<% s = field_set.seminar_signup_field %> <% s = field_set.seminar_signup_field %>
<% next if (s.nil? || s.key.blank?) %> <% next if (s.nil? || s.key.blank?) %>
<% default_hidden << "seminar_signup_field_custom.#{s.key}" if (field_set.hidden) %> <% default_hidden << "seminar_signup_fields.#{s.key}" if (field_set.hidden) %>
<% end %> <% end %>
<% end %> <% end %>
<% @seminar.seminar_signup_fields.each do |s| %> <% @seminar.seminar_signup_fields.each do |s| %>
<% next if s.title.blank? %>
<% default_hidden << "seminar_signup_fields.#{s.key}" %> <% default_hidden << "seminar_signup_fields.#{s.key}" %>
<% @field_names << "seminar_signup_fields.#{s.key}" %> <% @field_names << "seminar_signup_fields.#{s.key}" %>
<% @field_name_translations << s.title %> <% @field_name_translations << s.title %>
@ -110,16 +111,18 @@
<% @field_name_translations << t(th) %> <% @field_name_translations << t(th) %>
<% end %> <% end %>
<% end %> <% end %>
<% seminar_signup_field_customs = SeminarSignupFieldCustom.all.map{|field_set| SeminarSignupField.where(id: field_set.seminar_signup_field_id).first}.select{|s| !s.nil?}.uniq{|s| s.key } %> <% seminar_signup_fields = SeminarSignupField.where(:key.nin=>["", nil]).uniq{|s| s.key} %>
<% seminar_signup_field_customs = SeminarSignupFieldCustom.where(:seminar_signup_field_id.in=> seminar_signup_fields.map(&:id)).to_a %>
<% if seminar_signup_field_customs.count != 0 %> <% if seminar_signup_field_customs.count != 0 %>
<% seminar_signup_field_customs.each do |s| %> <% seminar_signup_field_customs.each do |field_set| %>
<% s = field_set.seminar_signup_field %> <% s = field_set.seminar_signup_field %>
<% next if (s.nil? || s.key.blank?) %> <% next if s.title.blank? %>
<% default_hidden << "seminar_signup_field_custom.#{s.key}" if (field_set.hidden) %> <% default_hidden << "seminar_signup_fields.#{s.key}" if (field_set.hidden) %>
<% end %> <% end %>
<% end %> <% end %>
<% seminar_signup_fields = SeminarSignupField.all.uniq{|s| s.key} %>
<% seminar_signup_fields.each do |s| %> <% seminar_signup_fields.each do |s| %>
<% next if s.title.blank? %>
<% default_hidden << "seminar_signup_fields.#{s.key}" %>
<% @field_names << "seminar_signup_fields.#{s.key}" %> <% @field_names << "seminar_signup_fields.#{s.key}" %>
<% @field_name_translations << s.title %> <% @field_name_translations << s.title %>
<% end %> <% end %>
@ -138,8 +141,9 @@
<% default_show << "seminar_signup_contributes.description" if show3 %> <% default_show << "seminar_signup_contributes.description" if show3 %>
<% @field_names << 'seminar_signup_contributes.description' %> <% @field_names << 'seminar_signup_contributes.description' %>
<% @field_name_translations << t('seminar_signup.description') %> <% @field_name_translations << t('seminar_signup.description') %>
<% seminar_submission_fields = SeminarSignupField.all.uniq{|s| s.key} %> <% seminar_submission_fields = SeminarSubmissionField.where(:key.nin=>["", nil]).uniq{|s| s.key} %>
<% seminar_submission_fields.each do |s| %> <% seminar_submission_fields.each do |s| %>
<% next if s.title.blank? %>
<% @field_names << "seminar_submission_fields.#{s.key}" %> <% @field_names << "seminar_submission_fields.#{s.key}" %>
<% @field_name_translations << s.title %> <% @field_name_translations << s.title %>
<% end %> <% end %>

View File

@ -6,7 +6,7 @@
<input class="toggle-check" data-deploy="right" id="${_disabled[0]}" name="${_disabled[1]}" type="hidden" value="false"> <input class="toggle-check" data-deploy="right" id="${_disabled[0]}" name="${_disabled[1]}" type="hidden" value="false">
<a class="btn btn-mini pull-right btn-danger delete" href="#"><i class="icon-trash"></i> Delete</a> <a class="btn btn-mini pull-right btn-danger delete" href="#"><i class="icon-trash"></i> Delete</a>
<a class="btn btn-mini pull-right btn-inverse reply hide" href="#"><i class="icons-reply"></i> Reply</a> <a class="btn btn-mini pull-right btn-inverse reply hide" href="#"><i class="icons-reply"></i> Reply</a>
<input class="attribute_field_to_delete" id="${_to_delete[0]}" name="${_to_delete[1]}" type="hidden" value="false"> <input class="attribute_field_destroy" id="${_destroy[0]}" name="${_destroy[1]}" type="hidden" value="false">
<h4>Field <span>${attributesHeaderLength}</span></h4> <h4>Field <span>${attributesHeaderLength}</span></h4>
</div> </div>
<div class="attributes-body"> <div class="attributes-body">

View File

@ -23,25 +23,29 @@
<tbody> <tbody>
<% <%
@seminars.each do |seminar| @seminars.each do |seminar|
registration_is_open = seminar.registration_status.present?
if !seminar.registration_status.blank? and (seminar.signup_start_date <= @time_now rescue false) and ( seminar.signup_end_date.nil? or seminar.signup_end_date+1 >= @time_now ) sign_up_not_yet = seminar.signup_start_date && @time_now && seminar.signup_start_date > @time_now
sign_up = ('<a href="'+ OrbitHelper.url_to_show(seminar.to_param) + '" target="_blank">' + t('seminar.signup') + '</a>').html_safe sign_up_overdue = seminar.signup_end_date && @time_now && (seminar.signup_end_date + 1.day <= @time_now)
elsif seminar.registration_status.blank? signup_is_full = seminar.signup_is_full?
sign_up = t('seminar.sign_up_not_open') seminar_url = OrbitHelper.url_to_show(seminar.to_param)
elsif (seminar.signup_start_date > @time_now rescue false) if !registration_is_open
sign_up = t('seminar.sign_up_not_yet') sign_up = t('seminar.sign_up_not_open')
else elsif sign_up_not_yet
sign_up = t('seminar.sign_up_overdue') sign_up = t('seminar.sign_up_not_yet')
end elsif sign_up_overdue
sign_up = t('seminar.sign_up_overdue')
elsif signup_is_full
sign_up = t('seminar.sign_up_is_full')
else
sign_up_text = t('seminar.signup')
sign_up = link_to(sign_up_text, seminar.get_frontend_url(seminar_url), :target=>'_blank', :title=>sign_up_text)
end
seminar_title = seminar.title
%> %>
<tr> <tr>
<td><%= seminar.category.title %></td> <td><%= seminar.category.title %></td>
<td> <td>
<% if (seminar.enable_custom_template rescue false) %> <%= link_to(seminar_title, seminar.get_frontend_url(seminar_url, :show_data), :target=>'_blank', :title=>seminar_title) %>
<%= ('<a href="'+ OrbitHelper.url_to_show(seminar.to_param) + '/home/introduction" target="_blank">' + seminar.title + '</a>').html_safe %>
<% else %>
<%= ('<a href="'+ OrbitHelper.url_to_show(seminar.to_param) + '?method=show_data" target="_blank">' + seminar.title + '</a>').html_safe %>
<% end %>
</td> </td>
<td><%= SeminarMain.time_range(seminar.seminar_start_date, seminar.seminar_end_date) %></td> <td><%= SeminarMain.time_range(seminar.seminar_start_date, seminar.seminar_end_date) %></td>
<td><%= seminar.act_place %></td> <td><%= seminar.act_place %></td>
@ -49,15 +53,13 @@
<%= sign_up %> <br /> <%= sign_up %> <br />
<%= <%=
if !seminar.registration_status.blank? and seminar.registration_status.include?('C') and (seminar.contribute_start_date <= @time_now rescue false) and ( seminar.contribute_end_date.nil? or (seminar.contribute_end_date+1 >= @time_now rescue false) ) if registration_is_open && seminar.registration_status.include?('C') && (seminar.contribute_start_date.nil? || seminar.contribute_start_date <= @time_now rescue false) && ( seminar.contribute_end_date.nil? || (seminar.contribute_end_date+1.day >= @time_now rescue false) )
if !session[:seminar_signup_id].blank? if session[:seminar_signup_id].present? && session[:seminar_main_id] == seminar.id
if session[:seminar_main_id] == seminar.id button_text = t('seminar_signup.uploads')
('<a href="'+ OrbitHelper.url_to_show(seminar.to_param) + '?method=con_upload">' + t('seminar_signup.uploads') + '</a>').html_safe link_to(button_text, seminar.get_frontend_url(seminar_url, :con_upload), :title=>button_text)
else
('<a href="'+ OrbitHelper.url_to_show(seminar.to_param) + '?method=con_login">' + t('seminar_signup.con_login') + '</a>').html_safe
end
else else
('<a href="'+ OrbitHelper.url_to_show(seminar.to_param) + '?method=con_login">' + t('seminar_signup.con_login') + '</a>').html_safe button_text = t('seminar_signup.con_login')
link_to(button_text, seminar.get_frontend_url(seminar_url, :con_login), :title=>button_text)
end end
end end
%> %>

View File

@ -9,9 +9,28 @@
else else
prefix_url = OrbitHelper.url_to_show(@seminar.to_param) prefix_url = OrbitHelper.url_to_show(@seminar.to_param)
end end
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_overdue = @seminar.signup_end_date && @time_now && (@seminar.signup_end_date + 1.day <= @time_now)
signup_is_full = @seminar.signup_is_full?
%> %>
<% if !@seminar.registration_status.blank? and @seminar.signup_start_date < @time_now and ( @seminar.signup_end_date.nil? or @seminar.signup_end_date+1 > @time_now ) %> <% if !registration_is_open %>
<%= t('seminar.sign_up_not_open') %>
<% elsif sign_up_not_yet %>
<%= t('seminar.sign_up_not_yet') %>
<% elsif sign_up_overdue %>
<%= t('seminar.sign_up_overdue') %>
<% elsif signup_is_full %>
<%= t('seminar.sign_up_is_full') %>
<% else %>
<%#= stylesheet_link_tag "lib/main-forms" %> <%#= stylesheet_link_tag "lib/main-forms" %>
<%= stylesheet_link_tag "basic/bootstrap-datetimepicker" %> <%= stylesheet_link_tag "basic/bootstrap-datetimepicker" %>
<%= javascript_include_tag "lib/bootstrap-datetimepicker" %> <%= javascript_include_tag "lib/bootstrap-datetimepicker" %>
@ -322,16 +341,4 @@ alert("1ssss2");
})(); })();
</script> </script>
<% elsif @seminar.registration_status.blank? %>
<%= t('seminar.sign_up_not_open') %>
<% elsif @seminar.signup_start_date > @time_now %>
<%= t('seminar.sign_up_not_yet') %>
<% else %>
<%= t('seminar.sign_up_overdue') %>
<% end %> <% end %>

View File

@ -27,6 +27,7 @@ en:
abstract_number: Abstract number abstract_number: Abstract number
presentation_type: Presentation presentation_type: Presentation
seminar: seminar:
signup_limit: Signup Limit
participant_list: Participant list participant_list: Participant list
back: Back back: Back
please_login_first: "Please login first!" please_login_first: "Please login first!"
@ -85,6 +86,7 @@ en:
dashboard: Dashboard dashboard: Dashboard
display_field: Display field display_field: Display field
note: Note note: Note
email_exist: "Email exist!"
email_signup_success: Signup success email_signup_success: Signup success
email_submission_success: Submission registration success email_submission_success: Submission registration success
email_add_file_success: Add file success email_add_file_success: Add file success
@ -153,6 +155,8 @@ en:
sign_up_not_yet: Does Not Yet Allow Sign Up #報名時間未開始 sign_up_not_yet: Does Not Yet Allow Sign Up #報名時間未開始
sign_up_not_open: Does Not Open Sign Up #未開放報名 sign_up_not_open: Does Not Open Sign Up #未開放報名
sign_up_overdue: Sign Up Overdue #報名時間已過 sign_up_overdue: Sign Up Overdue #報名時間已過
sign_up_is_full: "Sign up is FULL!"
sign_up_failed: "Sign up failed!"
contribute_file_count: Count of Contribute Files #投稿檔案數 contribute_file_count: Count of Contribute Files #投稿檔案數
frontend: frontend:

View File

@ -28,6 +28,7 @@ zh_tw:
abstract_number: 摘要編號 abstract_number: 摘要編號
presentation_type: 發表方式 presentation_type: 發表方式
seminar: seminar:
signup_limit: 報名限制人數
participant_list: 參加者名單 participant_list: 參加者名單
back: 回上一頁 back: 回上一頁
please_login_first: "請先登入!" please_login_first: "請先登入!"
@ -86,6 +87,7 @@ zh_tw:
dashboard: 儀錶板 dashboard: 儀錶板
display_field: 顯示的欄位 display_field: 顯示的欄位
note: 附註 note: 附註
email_exist: "email已存在!"
email_signup_success: 報名成功 email_signup_success: 報名成功
email_submission_success: 投稿註冊成功 email_submission_success: 投稿註冊成功
email_add_file_success: 新增上傳成功 email_add_file_success: 新增上傳成功
@ -154,6 +156,8 @@ zh_tw:
sign_up_not_yet: 報名時間未開始 sign_up_not_yet: 報名時間未開始
sign_up_not_open: 未開放報名 sign_up_not_open: 未開放報名
sign_up_overdue: 報名時間已過 sign_up_overdue: 報名時間已過
sign_up_is_full: "報名已額滿!"
sign_up_failed: "報名失敗"
contribute_file_count: 投稿檔案數 contribute_file_count: 投稿檔案數
frontend: frontend:

View File

@ -1,4 +1,8 @@
Rails.application.routes.draw do Rails.application.routes.draw do
OrbitHelper::SharedMutex.synchronize do
OrbitHelper::SharedHash['seminar'][:counter] = SeminarMain.where(:signup_limit.ne => nil).map{|v| [v.id, v.seminar_signups.count]}.to_h
OrbitHelper::SharedHash['seminar'][:limit] = SeminarMain.where(:signup_limit.ne => nil).map{|v| [v.id, v.signup_limit]}.to_h
end
Thread.new do Thread.new do
if Page.fields.include?('all_pageids') if Page.fields.include?('all_pageids')
s = Site.first s = Site.first

View File

@ -93,4 +93,7 @@ Gem::Specification.new do |s|
s.test_files = Dir["test/**/*"] s.test_files = Dir["test/**/*"]
s.add_dependency "custom_announcement" s.add_dependency "custom_announcement"
s.add_dependency "custom_gallery" s.add_dependency "custom_gallery"
s.metadata = {
"global_hash" => "{counter: {}, limit: {}}"
}
end end