diff --git a/app/assets/javascripts/seminar-field-forms-submission.js b/app/assets/javascripts/seminar-field-forms-submission.js index c64b9fc..8259abf 100644 --- a/app/assets/javascripts/seminar-field-forms-submission.js +++ b/app/assets/javascripts/seminar-field-forms-submission.js @@ -96,7 +96,7 @@ function inputAppendLength() { // Role Attribute Template Data 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 = { _add_more: ["add_more_" +l, fields+"["+l+"]["+type+"][add_more]"], _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], _placeholder: ["placeholder_" +l, fields+"["+l+"]["+type+"][placeholder]"], _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]"], }; return data; @@ -270,6 +270,7 @@ $(function() { attributesArray = []; attributesHeaderLength = null; templateType = null; + var default_templateType = 'typeA'; attributeIndex = null; if($('.add-target').length) { inputAppendLength(); @@ -286,7 +287,7 @@ $(function() { }; attributesHeaderLength = $('.attributes:not(:hidden)').length+1; 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(); }); @@ -426,7 +427,7 @@ $(function() { if(!$('.attributes:not(:hidden)').length) { $('#attributes-area').addClass('clickHere'); }; - }).find('.attribute_field_to_delete').attr('value', 'true');; + }).find('.attribute_field_destroy').attr('value', 'true');; }; if($(this).hasClass('trigger')) { // appendIndex = $(this).closest('.controls').find('.input-append').length; diff --git a/app/assets/javascripts/seminar-field-forms.js b/app/assets/javascripts/seminar-field-forms.js index 455fad3..8118423 100644 --- a/app/assets/javascripts/seminar-field-forms.js +++ b/app/assets/javascripts/seminar-field-forms.js @@ -96,7 +96,7 @@ function inputAppendLength() { // Role Attribute Template Data 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 = { _add_more: ["add_more_" +l, fields+"["+l+"]["+type+"][add_more]"], _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], _placeholder: ["placeholder_" +l, fields+"["+l+"]["+type+"][placeholder]"], _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]"], }; return data; @@ -270,6 +270,7 @@ $(function() { attributesArray = []; attributesHeaderLength = null; templateType = null; + var default_templateType = 'typeA'; attributeIndex = null; if($('.add-target').length) { inputAppendLength(); @@ -286,10 +287,7 @@ $(function() { }; attributesHeaderLength = $('.attributes:not(:hidden)').length+1; attributesLength = $('#attributes-area .attributes').length; - if(templateType == null){ - templateType = "typeA"; - } - $("#template-attributes").tmpl(setData(attributesLength, templateType, appendIndex)).appendTo( "#attributes-area" ); + $("#template-attributes").tmpl(setData(attributesLength, default_templateType, appendIndex)).appendTo( "#attributes-area" ); $('.toggle-check').togglebox(); }); @@ -429,7 +427,7 @@ $(function() { if(!$('.attributes:not(:hidden)').length) { $('#attributes-area').addClass('clickHere'); }; - }).find('.attribute_field_to_delete').attr('value', 'true');; + }).find('.attribute_field_destroy').attr('value', 'true');; }; if($(this).hasClass('trigger')) { // appendIndex = $(this).closest('.controls').find('.input-append').length; diff --git a/app/assets/stylesheets/seminar/background_style/1/css/background.css b/app/assets/stylesheets/seminar/background_style/1/css/background.css index 79d9e36..fb68804 100644 --- a/app/assets/stylesheets/seminar/background_style/1/css/background.css +++ b/app/assets/stylesheets/seminar/background_style/1/css/background.css @@ -14,6 +14,12 @@ body, .layout-footer, .layout-footer-inner { .body-banner{ padding: 0; } +.body-banner img{ + width: 100%; +} +.mainContent{ + background: #ffffff; +} .row{ margin: 0; } diff --git a/app/assets/stylesheets/seminar/background_style/10/css/background.css b/app/assets/stylesheets/seminar/background_style/10/css/background.css index 5f0806e..1bd832e 100644 --- a/app/assets/stylesheets/seminar/background_style/10/css/background.css +++ b/app/assets/stylesheets/seminar/background_style/10/css/background.css @@ -26,6 +26,12 @@ header{ .body-banner{ padding: 0; } +.body-banner img{ + width: 100%; +} +.mainContent{ + background: #ffffff; +} .row{ margin: 0; } diff --git a/app/assets/stylesheets/seminar/background_style/10/logo.jpg b/app/assets/stylesheets/seminar/background_style/10/logo.jpg new file mode 100644 index 0000000..77138b0 Binary files /dev/null and b/app/assets/stylesheets/seminar/background_style/10/logo.jpg differ diff --git a/app/assets/stylesheets/seminar/background_style/11/css/background.css b/app/assets/stylesheets/seminar/background_style/11/css/background.css index 5f5c25a..b1cb115 100644 --- a/app/assets/stylesheets/seminar/background_style/11/css/background.css +++ b/app/assets/stylesheets/seminar/background_style/11/css/background.css @@ -21,6 +21,12 @@ body{ .body-banner{ padding: 0; } +.body-banner img{ + width: 100%; +} +.mainContent{ + background: #ffffff; +} .row{ margin: 0; } diff --git a/app/assets/stylesheets/seminar/background_style/12/css/background.css b/app/assets/stylesheets/seminar/background_style/12/css/background.css index 9b2ec1a..45d4608 100644 --- a/app/assets/stylesheets/seminar/background_style/12/css/background.css +++ b/app/assets/stylesheets/seminar/background_style/12/css/background.css @@ -24,6 +24,12 @@ body{ .body-banner{ padding: 0; } +.body-banner img{ + width: 100%; +} +.mainContent{ + background: #ffffff; +} .row{ margin: 0; } diff --git a/app/assets/stylesheets/seminar/background_style/13/css/background.css b/app/assets/stylesheets/seminar/background_style/13/css/background.css index 5ce2102..510d441 100644 --- a/app/assets/stylesheets/seminar/background_style/13/css/background.css +++ b/app/assets/stylesheets/seminar/background_style/13/css/background.css @@ -24,6 +24,12 @@ body{ .body-banner{ padding: 0; } +.body-banner img{ + width: 100%; +} +.mainContent{ + background: #ffffff; +} .row{ margin: 0; } diff --git a/app/assets/stylesheets/seminar/background_style/13/logo.jpg b/app/assets/stylesheets/seminar/background_style/13/logo.jpg new file mode 100644 index 0000000..78eb1cb Binary files /dev/null and b/app/assets/stylesheets/seminar/background_style/13/logo.jpg differ diff --git a/app/assets/stylesheets/seminar/background_style/14/css/background.css b/app/assets/stylesheets/seminar/background_style/14/css/background.css index ae44d3e..1ae57cf 100644 --- a/app/assets/stylesheets/seminar/background_style/14/css/background.css +++ b/app/assets/stylesheets/seminar/background_style/14/css/background.css @@ -28,6 +28,12 @@ body{ .body-banner{ padding: 0; } +.body-banner img{ + width: 100%; +} +.mainContent{ + background: #ffffff; +} .row{ margin: 0; } diff --git a/app/assets/stylesheets/seminar/background_style/15/css/background.css b/app/assets/stylesheets/seminar/background_style/15/css/background.css index fffa9a1..bf275e9 100644 --- a/app/assets/stylesheets/seminar/background_style/15/css/background.css +++ b/app/assets/stylesheets/seminar/background_style/15/css/background.css @@ -25,6 +25,12 @@ body{ .body-banner{ padding: 0; } +.body-banner img{ + width: 100%; +} +.mainContent{ + background: #ffffff; +} .row{ margin: 0; } diff --git a/app/assets/stylesheets/seminar/background_style/16/css/background.css b/app/assets/stylesheets/seminar/background_style/16/css/background.css index 87e2705..81d0f6c 100644 --- a/app/assets/stylesheets/seminar/background_style/16/css/background.css +++ b/app/assets/stylesheets/seminar/background_style/16/css/background.css @@ -25,6 +25,12 @@ body{ .body-banner{ padding: 0; } +.body-banner img{ + width: 100%; +} +.mainContent{ + background: #ffffff; +} .row{ margin: 0; } diff --git a/app/assets/stylesheets/seminar/background_style/17/css/background.css b/app/assets/stylesheets/seminar/background_style/17/css/background.css index 83d4a00..e6efe51 100644 --- a/app/assets/stylesheets/seminar/background_style/17/css/background.css +++ b/app/assets/stylesheets/seminar/background_style/17/css/background.css @@ -27,6 +27,12 @@ header{ .body-banner{ padding: 0; } +.body-banner img{ + width: 100%; +} +.mainContent{ + background: #ffffff; +} .row{ margin: 0; } diff --git a/app/assets/stylesheets/seminar/background_style/2/css/background.css b/app/assets/stylesheets/seminar/background_style/2/css/background.css index 15abb60..ef8ab72 100644 --- a/app/assets/stylesheets/seminar/background_style/2/css/background.css +++ b/app/assets/stylesheets/seminar/background_style/2/css/background.css @@ -21,6 +21,12 @@ body{ .body-banner{ padding: 0; } +.body-banner img{ + width: 100%; +} +.mainContent{ + background: #ffffff; +} .row{ margin: 0; } diff --git a/app/assets/stylesheets/seminar/background_style/3/css/background.css b/app/assets/stylesheets/seminar/background_style/3/css/background.css index 065239f..6e7077d 100644 --- a/app/assets/stylesheets/seminar/background_style/3/css/background.css +++ b/app/assets/stylesheets/seminar/background_style/3/css/background.css @@ -31,6 +31,12 @@ header{ .body-banner{ padding: 0; } +.body-banner img{ + width: 100%; +} +.mainContent{ + background: #ffffff; +} .row{ margin: 0; } diff --git a/app/assets/stylesheets/seminar/background_style/4/css/background.css b/app/assets/stylesheets/seminar/background_style/4/css/background.css index 4b6df1c..1ba5fc9 100644 --- a/app/assets/stylesheets/seminar/background_style/4/css/background.css +++ b/app/assets/stylesheets/seminar/background_style/4/css/background.css @@ -20,6 +20,12 @@ body{ .body-banner{ padding: 0; } +.body-banner img{ + width: 100%; +} +.mainContent{ + background: #ffffff; +} .row{ margin: 0; } diff --git a/app/assets/stylesheets/seminar/background_style/5/css/background.css b/app/assets/stylesheets/seminar/background_style/5/css/background.css index 5f04cdf..50b35ef 100644 --- a/app/assets/stylesheets/seminar/background_style/5/css/background.css +++ b/app/assets/stylesheets/seminar/background_style/5/css/background.css @@ -23,6 +23,12 @@ header{ .body-banner{ padding: 0; } +.body-banner img{ + width: 100%; +} +.mainContent{ + background: #ffffff; +} .row{ margin: 0; } diff --git a/app/assets/stylesheets/seminar/background_style/6/css/background.css b/app/assets/stylesheets/seminar/background_style/6/css/background.css index 59d3d3f..188e5b7 100644 --- a/app/assets/stylesheets/seminar/background_style/6/css/background.css +++ b/app/assets/stylesheets/seminar/background_style/6/css/background.css @@ -25,6 +25,12 @@ body{ .body-banner{ padding: 0; } +.body-banner img{ + width: 100%; +} +.mainContent{ + background: #ffffff; +} .row{ margin: 0; } diff --git a/app/assets/stylesheets/seminar/background_style/7/css/background.css b/app/assets/stylesheets/seminar/background_style/7/css/background.css index 12cec21..a98424d 100644 --- a/app/assets/stylesheets/seminar/background_style/7/css/background.css +++ b/app/assets/stylesheets/seminar/background_style/7/css/background.css @@ -27,6 +27,12 @@ body{ .body-banner{ padding: 0; } +.body-banner img{ + width: 100%; +} +.mainContent{ + background: #ffffff; +} .row{ margin: 0; } diff --git a/app/assets/stylesheets/seminar/background_style/8/css/background.css b/app/assets/stylesheets/seminar/background_style/8/css/background.css index 0bf0c89..e459442 100644 --- a/app/assets/stylesheets/seminar/background_style/8/css/background.css +++ b/app/assets/stylesheets/seminar/background_style/8/css/background.css @@ -29,6 +29,12 @@ body{ .body-banner{ padding: 0; } +.body-banner img{ + width: 100%; +} +.mainContent{ + background: #ffffff; +} .row{ margin: 0; } diff --git a/app/assets/stylesheets/seminar/background_style/9/css/background.css b/app/assets/stylesheets/seminar/background_style/9/css/background.css index 8e04fe0..af31299 100644 --- a/app/assets/stylesheets/seminar/background_style/9/css/background.css +++ b/app/assets/stylesheets/seminar/background_style/9/css/background.css @@ -27,6 +27,12 @@ body{ .body-banner{ padding: 0; } +.body-banner img{ + width: 100%; +} +.mainContent{ + background: #ffffff; +} .row{ margin: 0; } diff --git a/app/assets/stylesheets/seminar/content_style/1/css/template.css b/app/assets/stylesheets/seminar/content_style/1/css/template.css index 775b948..6b63fc6 100644 --- a/app/assets/stylesheets/seminar/content_style/1/css/template.css +++ b/app/assets/stylesheets/seminar/content_style/1/css/template.css @@ -71,6 +71,11 @@ li.w-annc__item.row > *:last-child { padding: 1em; } } +@media (min-width: 768px){ + .row > .layout-content.col-sm-9{ + padding-right: 0; + } +} [data-pp="200"]{ padding: 0 0.9375em; } \ No newline at end of file diff --git a/app/controllers/admin/seminars_controller.rb b/app/controllers/admin/seminars_controller.rb index 84560af..04cd3d3 100644 --- a/app/controllers/admin/seminars_controller.rb +++ b/app/controllers/admin/seminars_controller.rb @@ -77,10 +77,13 @@ class Admin::SeminarsController < OrbitAdminController end def sub_page_setting @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 = available_locales.map{|l| l.to_s} if @seminar_page_root.nil? @seminar_page_root = @seminar_template_setting.create_seminar_pages + else + @seminar_template_setting.create_seminar_pages(false) end @items = @seminar_page_root.child_page @parent_pages = [] @@ -498,26 +501,13 @@ class Admin::SeminarsController < OrbitAdminController @seminar_params["reviewer_ids"] = [] if @seminar_params["reviewer_ids"].nil? @seminar_params["organizer_id"] = nil if @seminar_params["organizer_id"].nil? end - if @seminar_params[:seminar_signup_fields] - @seminar_params[:seminar_signup_fields].each do |a| - @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 + if @seminar_params[:seminar_signup_fields_attributes] + @seminar.update_attributes(@seminar_params.slice(:seminar_signup_fields_attributes)) 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 - elsif @seminar_params[:seminar_submission_fields] - params[:seminar_main][:seminar_submission_fields].each do |a| - @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 + elsif @seminar_params[:seminar_submission_fields_attributes] + @seminar.update_attributes(@seminar_params.slice(:seminar_submission_fields_attributes)) 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 @seminar.update(:assign_mode => 2) default_sort_number = SeminarSignup.fields['sort_number'].options[:default] @@ -550,7 +540,6 @@ class Admin::SeminarsController < OrbitAdminController end redirect_to admin_seminars_path and return else - if !seminar_params['seminar_links_attributes'].nil? seminar_params['seminar_links_attributes'].each do |idx,link| 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 if @seminar.update_attributes(seminar_params) + @seminar.update_enable_recaptcha @seminar.seminar_signup_fields.each{|t| t.destroy if t["to_delete"] == true} redirect_to params['referer_url'] and return else diff --git a/app/controllers/seminars_controller.rb b/app/controllers/seminars_controller.rb index 7e0b634..cc8f4fd 100644 --- a/app/controllers/seminars_controller.rb +++ b/app/controllers/seminars_controller.rb @@ -1,5 +1,4 @@ class SeminarsController < ApplicationController - helper MemberHelper include MemberHelper include ActionView::Context #vary important (only add this can access @@session from view) @@ -25,36 +24,41 @@ class SeminarsController < ApplicationController time_now = DateTime.now session = OrbitHelper.request.session seminars = seminars.map do |seminar| - link_url = OrbitHelper.url_to_show(seminar.to_param) - 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 ) - sign_up = ('' + I18n.t('seminar.signup') + '').html_safe - elsif seminar.registration_status.blank? - sign_up = I18n.t('seminar.sign_up_not_open') - elsif (seminar.signup_start_date > @time_now rescue false) - sign_up = I18n.t('seminar.sign_up_not_yet') + link_url = OrbitHelper.url_to_plugin_show(seminar.to_param, 'seminar') + 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? + 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') + 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 - 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 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 += "".html_safe - if !session[:seminar_signup_id].blank? - if session[:seminar_main_id] == seminar.id - sign_up += ('' + t('seminar_signup.uploads') + '').html_safe + sign_up += content_tag :span, :style=> "margin-left: 1em;" do + if session[:seminar_signup_id].present? && session[:seminar_main_id] == seminar.id + button_text = t('seminar_signup.uploads') + link_to(button_text, seminar.get_frontend_url(link_url, :con_upload), {:title=>button_text}) else - sign_up += ('' + t('seminar_signup.con_login') + '').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 - else - sign_up += ('' + t('seminar_signup.con_login') + '').html_safe end - sign_up += "".html_safe 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.delete(nil) - links = seminar.seminar_links.map{|link| { "link_url" => link.url, "link_title" => (link.title.blank? ? link.url : link.title) } } rescue [] + links = seminar.seminar_links.map{|link| { "link_url" => link.url, "link_title" => (link.title.blank? ? link.url : link.title rescue '') } } rescue [] {"title" => seminar.title, "subtitle" => sign_up, "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, "statuses" => {}, "bulletin_links" => links, @@ -185,14 +189,12 @@ class SeminarsController < ApplicationController sign_up = t('seminar.sign_up_overdue') 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 !@@session[:seminar_signup_id].blank? - if @@session[:seminar_main_id] == seminar.id - contribute_action = ('' + t('seminar_signup.uploads') + '').html_safe - else - contribute_action = ('' + t('seminar_signup.con_login') + '').html_safe - end + if @@session[:seminar_signup_id].present? && @@session[:seminar_main_id] == seminar.id + button_text = t('seminar_signup.uploads') + contribute_action = link_to(button_text, submission_url + '?method=con_upload', :title=>button_text) else - contribute_action = ('' + t('seminar_signup.con_login') + '').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 data = { @@ -288,6 +290,23 @@ class SeminarsController < ApplicationController :params=>params,:session=>@@session},:layout=>false).html_safe 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}¬ice=#{notice_words}" + end + else + referer_url = referer_url + "?notice=#{notice_words}" + end + end def show_privacy params = OrbitHelper.params @@ -310,31 +329,34 @@ class SeminarsController < ApplicationController params = OrbitHelper.params seminar = SeminarMain.find_by(uid: params[:uid]) - - if !seminar.registration_status.blank? && seminar.signup_start_date <= time_now && ( seminar.signup_end_date.nil? || seminar.signup_end_date+1 >= time_now ) - sign_up = ('' + t('seminar.signup') + '').html_safe - elsif seminar.registration_status.blank? + 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? + 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') - elsif seminar.signup_start_date > time_now + elsif sign_up_not_yet sign_up = t('seminar.sign_up_not_yet') - else + 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 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_main_id] == seminar.id - contribute_action = ('' + t('seminar_signup.uploads') + '').html_safe - else - contribute_action = ('' + t('seminar_signup.con_login') + '').html_safe - end + if @@session[:seminar_signup_id].present? && @@session[:seminar_main_id] == seminar.id + button_text = t('seminar_signup.uploads') + contribute_action = link_to(button_text, seminar.get_frontend_url(seminar_url, :con_upload), :title=>button_text) else - contribute_action = ('' + t('seminar_signup.con_login') + '').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 - - { 'seminar' => seminar, 'sign_up' => sign_up, @@ -400,84 +422,97 @@ class SeminarsController < ApplicationController end def create - - @signup = SeminarSignup.where(email: params[:seminar_signup][:email], seminar_main_id: params[:seminar_signup][:seminar_main_id] ).first + seminar_id = params[:seminar_signup][:seminar_main_id] + @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 = SeminarMain.where(id:params[:seminar_signup][:seminar_main_id]).first - if @seminar.seminar_signup_field_sets.count!=0 - flag = @seminar.seminar_signup_field_sets.select{|v| v.field_name=='recaptcha'}[0].disabled - else - flag = false - end - 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 + not_signup_yet = @signup.blank? + if not_signup_yet && @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 - extra_text = "
#{I18n.t('seminar_signup.serial_number')}: #{@seminar_signup.display_serial_number}" - extra_text += render_to_string("seminars/signup_email_contents",:locals=>{:seminar=>@seminar, - :seminar_signup=>@seminar_signup},:layout=>false) - if params['seminar_signup']['status']=='C' - status_param = '&status=' - send_mail('submission',params[:seminar_signup][:email],params[:seminar_signup][:seminar_main_id],extra_text) - else - status_param = '' - send_mail('signup',params[:seminar_signup][:email],params[:seminar_signup][:seminar_main_id],extra_text) + 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 - 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 - if !@signup.blank? - redirect_to "#{params[:referer_url]}", :notice => 'mail已存在' - else - referer_url = params[:referer_url].to_s - if referer_url.split("/").last.include?("?") - uri_query = referer_url.split("?").last.gsub(/notice=[^&]*/,'') - 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("?") + "¬ice=#{t('recaptcha.errors.verification_failed')}" - end - else - referer_url = referer_url + "?notice=#{t('recaptcha.errors.verification_failed')}" - end - redirect_to referer_url, :notice => t('recaptcha.errors.verification_failed') + @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 + extra_text = "
#{I18n.t('seminar_signup.serial_number')}: #{@seminar_signup.display_serial_number}" + extra_text += render_to_string("seminars/signup_email_contents",:locals=>{:seminar=>@seminar, + :seminar_signup=>@seminar_signup},:layout=>false) + if params['seminar_signup']['status']=='C' + status_param = '&status=' + send_mail('submission',params[:seminar_signup][:email],params[:seminar_signup][:seminar_main_id],extra_text) + else + status_param = '' + send_mail('signup',params[:seminar_signup][:email],params[:seminar_signup][:seminar_main_id],extra_text) + end + 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 - else - referer_url = params[:referer_url].to_s - if referer_url.split("/").last.include?("?") - uri_query = referer_url.split("?").last.gsub(/notice=[^&]*/,'') - 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("?") + "¬ice=#{t('recaptcha.errors.verification_failed')}" - end + if !not_signup_yet + notice_words = t('seminar.email_exist') + referer_url = get_referer_url_for_notice(notice_words) + redirect_to referer_url, :notice => notice_words 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 - redirect_to referer_url, :notice => t('recaptcha.errors.verification_failed') end end diff --git a/app/models/seminar_main.rb b/app/models/seminar_main.rb index d746313..d1eb37c 100644 --- a/app/models/seminar_main.rb +++ b/app/models/seminar_main.rb @@ -9,6 +9,7 @@ class SeminarMain include Slug ChoiceTypes = ["checkbox","radio","select"] ExceptFieldSetDisplays = ["password", "recaptcha"] + field :enable_recaptcha, :type => Boolean field :annc_count, :type => Integer, :default => 0 field :album_count, :type => Integer, :default => 0 field :copy_id @@ -25,11 +26,11 @@ class SeminarMain "F. Environmental and Reaction Engineering","G. Industrial Applications", "H. Student Oral Presentation Contest (in English)","I. Student Poster Competition" ] - field :seminar_start_date, :type => Date, :default => Time.now - field :seminar_end_date, :type => Date, :default => Time.now + field :seminar_start_date, :type => Date, :default => Date.today + field :seminar_end_date, :type => Date, :default => Date.today - field :signup_start_date, :type => Date, :default => Time.now - field :signup_end_date, :type => Date, :default => Time.now + field :signup_start_date, :type => Date, :default => Date.today + field :signup_end_date, :type => Date, :default => Date.today field :contribute_start_date, :type => Date field :contribute_end_date, :type => Date @@ -50,6 +51,9 @@ class SeminarMain 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 :update_old_flag, :type => Boolean, :default => false + + field :signup_limit, :type => Integer, :default => nil + belongs_to :seminar_item belongs_to :organizer , :class_name=>"MemberProfile", :foreign_key => :organizer_id 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_template_setting, :allow_destroy => true 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" add_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 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) if !date1.blank? diff --git a/app/models/seminar_signup.rb b/app/models/seminar_signup.rb index 4fde0df..c73aef2 100644 --- a/app/models/seminar_signup.rb +++ b/app/models/seminar_signup.rb @@ -30,7 +30,18 @@ class SeminarSignup accepts_nested_attributes_for :seminar_signup_values, allow_destroy: true accepts_nested_attributes_for :seminar_signup_contributes, allow_destroy: true 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 unit = self.unit_translations.values.select{|v| v.present?}.first tmp_unit_translations = self.unit_translations diff --git a/app/models/seminar_signup_field.rb b/app/models/seminar_signup_field.rb index 60ff2d1..c0d87f3 100644 --- a/app/models/seminar_signup_field.rb +++ b/app/models/seminar_signup_field.rb @@ -6,14 +6,14 @@ class SeminarSignupField include ::Admin::SeminarsFieldHelper field :key, type: String - field :af_count + # field :af_count field :title, type: String, localize: true field :markup, default: "text_field" field :option_list, type: Hash,default: {} field :markup_options, type: Hash field :built_in, 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 @@ -27,7 +27,15 @@ class SeminarSignupField has_many :seminar_signup_values, autosave: true, dependent: :destroy accepts_nested_attributes_for :seminar_signup_values, :allow_destroy => true 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 get_data["option_list"] end @@ -100,24 +108,16 @@ class SeminarSignupField def self.add_seminar_signup_field(seminar,seminar_param, seminar_signup_field_id=nil,field_status) @field_name = 'seminar' 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 - old_key = @seminar_signup_field.key - @seminar_signup_field.update(seminar_param) - @seminar_signup_field.save - attribute_values = @seminar_signup_field.seminar_signup_values - if attribute_values.count > 0 - attribute_values.each do |av| - av.key = seminar_param["key"] - av.save - end + if @seminar_signup_field.nil? + @seminar_signup_field = seminar.seminar_signup_fields.build(seminar_param) + @seminar_signup_field.save + else + @seminar_signup_field.update(seminar_param) end - @seminar_signup_field[:af_count] = @seminar_signup_field_counter else - @seminar_signup_field_counter = seminar.seminar_signup_fields.count rescue nil - @seminar_signup_field = seminar.seminar_signup_fields.build(seminar_param) rescue nil - @seminar_signup_field.save - @seminar_signup_field[:af_count] = @seminar_signup_field_counter + @seminar_signup_field = seminar.seminar_signup_fields.build(seminar_param) + @seminar_signup_field.save end return @seminar_signup_field end diff --git a/app/models/seminar_submission_field.rb b/app/models/seminar_submission_field.rb index cd6968d..c86a56c 100644 --- a/app/models/seminar_submission_field.rb +++ b/app/models/seminar_submission_field.rb @@ -6,14 +6,14 @@ class SeminarSubmissionField include ::Admin::SeminarsFieldHelper field :key, type: String - field :af_count + # field :af_count field :title, type: String, localize: true field :markup, default: "text_field" field :option_list, type: Hash,default: {} field :markup_options, type: Hash field :built_in, 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 @@ -27,6 +27,15 @@ class SeminarSubmissionField has_many :seminar_submission_values, autosave: true, dependent: :destroy accepts_nested_attributes_for :seminar_submission_values, :allow_destroy => true 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 "seminar_submission_values" end @@ -125,24 +134,16 @@ class SeminarSubmissionField def self.add_seminar_signup_field(seminar,seminar_param, seminar_submission_field_id=nil,field_status) @field_name = 'seminar' 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 - old_key = @seminar_submission_field.key - @seminar_submission_field.update(seminar_param) - @seminar_submission_field.save - attribute_values = @seminar_submission_field.seminar_submission_values - if attribute_values.count > 0 - attribute_values.each do |av| - av.key = seminar_param["key"] - av.save - end + if @seminar_submission_field.nil? + @seminar_submission_field = seminar.seminar_submission_fields.build(seminar_param) + @seminar_submission_field.save + else + @seminar_submission_field.update(seminar_param) end - @seminar_submission_field[:af_count] = @seminar_submission_field_counter else - @seminar_submission_field_counter = seminar.seminar_submission_fields.count rescue nil - @seminar_submission_field = seminar.seminar_submission_fields.build(seminar_param) rescue nil - @seminar_submission_field.save - @seminar_submission_field[:af_count] = @seminar_submission_field_counter + @seminar_submission_field = seminar.seminar_submission_fields.build(seminar_param) + @seminar_submission_field.save end return @seminar_submission_field end diff --git a/app/models/seminar_template_setting.rb b/app/models/seminar_template_setting.rb index 725c845..c9ed1a2 100644 --- a/app/models/seminar_template_setting.rb +++ b/app/models/seminar_template_setting.rb @@ -51,7 +51,7 @@ class SeminarTemplateSetting end end end - def create_seminar_pages + def create_seminar_pages(force_update=true) if self.seminar_main @seminar = self.seminar_main @seminar_page_root = Page.where(:parent_page_id=>self.seminar_main_id).first @@ -60,15 +60,18 @@ class SeminarTemplateSetting if @seminar_page_root.nil? @seminar_page_root = Page.create(:parent_page_id=>self.seminar_main_id,:module=>"seminars_home",:name_translations=>@seminar.title_translations,:url=>"/home",:page_id=>"home",:enabled_for=>available_locales,:bind_uid=>@seminar.uid,:bind_module_app=>"seminar",:bind_model=>"SeminarMain",:menu_enabled_for=>available_locales) else - @seminar_page_root.update(:name_translations=>@seminar.title_translations,:module=>"seminars_home",:url=>"/home",:page_id=>"home",:enabled_for=>available_locales,:bind_uid=>@seminar.uid,:bind_module_app=>"seminar",:bind_model=>"SeminarMain",:menu_enabled_for=>available_locales) + @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 + display_menu = self.display_menu pages_info = PagesInfo relation_model = {"news" => "CustomBulletin","album"=>"CustomAlbum"} pages_info.each do |page_id , page_module| seminar_page = @seminar_page_root.child_page.where(:page_id=>page_id).first page_trans = available_locales.map{|l| [l,I18n.with_locale(l){I18n.t("seminar.menu.#{page_id}")}]}.to_h available_locales_tmp = available_locales.clone - if relation_model[page_id] + if display_menu.exclude?(page_id) + available_locales_tmp = [] + elsif relation_model[page_id] relation = relation_model[page_id].constantize rescue nil if relation if relation.where(:bind_uid=>@seminar.uid).count == 0 @@ -79,7 +82,7 @@ class SeminarTemplateSetting if seminar_page.nil? seminar_page = @seminar_page_root.child_page.create(:name_translations=>page_trans,:page_id=>page_id,:url=>"/home/#{page_id}",:enabled_for=>available_locales_tmp,:module=>page_module,:menu_enabled_for=>available_locales_tmp) else - seminar_page.update(:name_translations=>page_trans,:page_id=>page_id,:url=>"/home/#{page_id}",:module=>page_module) + seminar_page.update(:name_translations=>page_trans,:page_id=>page_id,:url=>"/home/#{page_id}",:module=>page_module) if force_update end end return @seminar_page_root diff --git a/app/views/admin/seminars/_attribute_field.html.erb b/app/views/admin/seminars/_attribute_field.html.erb index c71dd8a..46df8ba 100644 --- a/app/views/admin/seminars/_attribute_field.html.erb +++ b/app/views/admin/seminars/_attribute_field.html.erb @@ -1,16 +1,16 @@
<% - attribute_field.af_count ? @af_counter = attribute_field_counter + attribute_field.af_count : @af_counter = attribute_field_counter + @af_counter = attribute_field_counter %>
- <%= 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"} %>
<%= t(:delete_)%> - <%= 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"%> Reset

Field <%= @af_counter + 1 %>

@@ -18,27 +18,27 @@
- <%= 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"} %>
- <%= 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]"}%>
- > <%$seminar_list[:markups].each do |key,val|%> <% next if val["display_only"] && val["display_only"] != "seminar_signup_field" %> <% if key != 'address' %> @@ -57,25 +57,25 @@
- <%= 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' %> <%= 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?%> - <%= 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%> - <%= 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 if show_seminar_type_panel(attribute_field,"typeB") != 'typeB hide' %> @@ -84,17 +84,17 @@
- <%= 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"] %>
@@ -102,10 +102,10 @@
@@ -116,18 +116,18 @@
- <%= 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' %> <%= 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' %> - <%= 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%> \ No newline at end of file diff --git a/app/views/admin/seminars/_attribute_submission_field.html.erb b/app/views/admin/seminars/_attribute_submission_field.html.erb index a2228f6..30a089d 100644 --- a/app/views/admin/seminars/_attribute_submission_field.html.erb +++ b/app/views/admin/seminars/_attribute_submission_field.html.erb @@ -1,16 +1,16 @@
<% - 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 %>
- <%= 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"} %>
<%= t(:delete_)%> - <%= 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"%> Reset

Field <%= @af_counter + 1 %>

@@ -18,27 +18,27 @@
- <%= 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"} %>
- <%= 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]"}%>
- > <%$seminar_list[:markups].each do |key,val|%> <% next if val["display_only"] && val["display_only"] != "seminar_submission_field" %> <% if key != 'address' %> @@ -57,25 +57,25 @@
- <%= 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' %> <%= 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?%> - <%= 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%> - <%= 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 if show_seminar_type_panel(attribute_submission_field,"typeB") != 'typeB hide' %> @@ -84,17 +84,17 @@
- <%= 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"] %>
@@ -102,10 +102,10 @@
@@ -116,16 +116,16 @@
- <%= 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' %> <%= 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' %> <%= content_tag :div,:class=>"field-type default fade in #{show_seminar_type_panel(attribute_submission_field,"typeF")}" do%>
@@ -139,6 +139,6 @@
<% 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%> \ No newline at end of file diff --git a/app/views/admin/seminars/_form.html.erb b/app/views/admin/seminars/_form.html.erb index b026be9..e0c6ecb 100644 --- a/app/views/admin/seminars/_form.html.erb +++ b/app/views/admin/seminars/_form.html.erb @@ -112,6 +112,13 @@ +
+ +
+ <%= f.number_field :signup_limit, placeholder: t('seminar.blank_no_limit') %> +
+
+
diff --git a/app/views/admin/seminars/_get_display_fields.html.erb b/app/views/admin/seminars/_get_display_fields.html.erb index 54e84db..14e98f8 100644 --- a/app/views/admin/seminars/_get_display_fields.html.erb +++ b/app/views/admin/seminars/_get_display_fields.html.erb @@ -32,10 +32,11 @@ <% @seminar.seminar_signup_field_customs.each do |field_set| %> <% s = field_set.seminar_signup_field %> <% 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 %> <% @seminar.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_name_translations << s.title %> @@ -110,16 +111,18 @@ <% @field_name_translations << t(th) %> <% 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 %> - <% seminar_signup_field_customs.each do |s| %> + <% seminar_signup_field_customs.each do |field_set| %> <% s = field_set.seminar_signup_field %> - <% next if (s.nil? || s.key.blank?) %> - <% default_hidden << "seminar_signup_field_custom.#{s.key}" if (field_set.hidden) %> + <% next if s.title.blank? %> + <% default_hidden << "seminar_signup_fields.#{s.key}" if (field_set.hidden) %> <% end %> <% end %> - <% seminar_signup_fields = SeminarSignupField.all.uniq{|s| s.key} %> <% 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_name_translations << s.title %> <% end %> @@ -138,8 +141,9 @@ <% default_show << "seminar_signup_contributes.description" if show3 %> <% @field_names << 'seminar_signup_contributes.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| %> + <% next if s.title.blank? %> <% @field_names << "seminar_submission_fields.#{s.key}" %> <% @field_name_translations << s.title %> <% end %> diff --git a/app/views/admin/seminars/_support_member_form_js.erb b/app/views/admin/seminars/_support_member_form_js.erb index 6205f84..12dabb9 100644 --- a/app/views/admin/seminars/_support_member_form_js.erb +++ b/app/views/admin/seminars/_support_member_form_js.erb @@ -6,7 +6,7 @@ Delete Reply - +

Field ${attributesHeaderLength}

diff --git a/app/views/seminars/index.html.erb b/app/views/seminars/index.html.erb index 9b70e05..a64cdf1 100644 --- a/app/views/seminars/index.html.erb +++ b/app/views/seminars/index.html.erb @@ -23,25 +23,29 @@ <% @seminars.each do |seminar| - - 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 = ('' + t('seminar.signup') + '').html_safe - elsif seminar.registration_status.blank? - sign_up = t('seminar.sign_up_not_open') - elsif (seminar.signup_start_date > @time_now rescue false) - sign_up = t('seminar.sign_up_not_yet') - else - sign_up = t('seminar.sign_up_overdue') - 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? + seminar_url = OrbitHelper.url_to_show(seminar.to_param) + 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 + 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 %> <%= seminar.category.title %> - <% if (seminar.enable_custom_template rescue false) %> - <%= ('' + seminar.title + '').html_safe %> - <% else %> - <%= ('' + seminar.title + '').html_safe %> - <% end %> + <%= link_to(seminar_title, seminar.get_frontend_url(seminar_url, :show_data), :target=>'_blank', :title=>seminar_title) %> <%= SeminarMain.time_range(seminar.seminar_start_date, seminar.seminar_end_date) %> <%= seminar.act_place %> @@ -49,15 +53,13 @@ <%= sign_up %>
<%= - 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 !session[:seminar_signup_id].blank? - if session[:seminar_main_id] == seminar.id - ('' + t('seminar_signup.uploads') + '').html_safe - else - ('' + t('seminar_signup.con_login') + '').html_safe - end + 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].present? && session[:seminar_main_id] == seminar.id + button_text = t('seminar_signup.uploads') + link_to(button_text, seminar.get_frontend_url(seminar_url, :con_upload), :title=>button_text) else - ('' + t('seminar_signup.con_login') + '').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 %> diff --git a/app/views/seminars/show.html.erb b/app/views/seminars/show.html.erb index 4107704..b77212b 100644 --- a/app/views/seminars/show.html.erb +++ b/app/views/seminars/show.html.erb @@ -9,9 +9,28 @@ else prefix_url = OrbitHelper.url_to_show(@seminar.to_param) 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 "basic/bootstrap-datetimepicker" %> <%= javascript_include_tag "lib/bootstrap-datetimepicker" %> @@ -322,16 +341,4 @@ alert("1ssss2"); })(); -<% 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 %> \ No newline at end of file diff --git a/config/locales/en.yml b/config/locales/en.yml index fd200be..c316bfa 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -27,6 +27,7 @@ en: abstract_number: Abstract number presentation_type: Presentation seminar: + signup_limit: Signup Limit participant_list: Participant list back: Back please_login_first: "Please login first!" @@ -85,6 +86,7 @@ en: dashboard: Dashboard display_field: Display field note: Note + email_exist: "Email exist!" email_signup_success: Signup success email_submission_success: Submission registration 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_open: Does Not Open Sign Up #未開放報名 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 #投稿檔案數 frontend: diff --git a/config/locales/zh_tw.yml b/config/locales/zh_tw.yml index bbb5d8d..a31cc88 100644 --- a/config/locales/zh_tw.yml +++ b/config/locales/zh_tw.yml @@ -28,6 +28,7 @@ zh_tw: abstract_number: 摘要編號 presentation_type: 發表方式 seminar: + signup_limit: 報名限制人數 participant_list: 參加者名單 back: 回上一頁 please_login_first: "請先登入!" @@ -86,6 +87,7 @@ zh_tw: dashboard: 儀錶板 display_field: 顯示的欄位 note: 附註 + email_exist: "email已存在!" email_signup_success: 報名成功 email_submission_success: 投稿註冊成功 email_add_file_success: 新增上傳成功 @@ -154,6 +156,8 @@ zh_tw: sign_up_not_yet: 報名時間未開始 sign_up_not_open: 未開放報名 sign_up_overdue: 報名時間已過 + sign_up_is_full: "報名已額滿!" + sign_up_failed: "報名失敗" contribute_file_count: 投稿檔案數 frontend: diff --git a/config/routes.rb b/config/routes.rb index 78e33d2..3a242de 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,4 +1,8 @@ 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 if Page.fields.include?('all_pageids') s = Site.first diff --git a/seminar.gemspec b/seminar.gemspec index ad6ef40..bd040b5 100644 --- a/seminar.gemspec +++ b/seminar.gemspec @@ -93,4 +93,7 @@ Gem::Specification.new do |s| s.test_files = Dir["test/**/*"] s.add_dependency "custom_announcement" s.add_dependency "custom_gallery" + s.metadata = { + "global_hash" => "{counter: {}, limit: {}}" + } end