diff --git a/app/controllers/admin/seminars_controller.rb b/app/controllers/admin/seminars_controller.rb index ed71378..800e67a 100644 --- a/app/controllers/admin/seminars_controller.rb +++ b/app/controllers/admin/seminars_controller.rb @@ -48,10 +48,10 @@ class Admin::SeminarsController < OrbitAdminController @seminar = SeminarMain.find(params[:id]) @seminar_signups = SeminarSignup.where(:seminar_main_id => params[:id]) - + filename = @seminar.title.parameterize.underscore + "_export.xlsx" respond_to do |format| format.xlsx { - response.headers['Content-Disposition'] = 'attachment; filename="export.xlsx"' + response.headers['Content-Disposition'] = 'attachment; filename="' + filename + '"' } end diff --git a/app/controllers/seminars_controller.rb b/app/controllers/seminars_controller.rb index 99d62e3..6a577b7 100644 --- a/app/controllers/seminars_controller.rb +++ b/app/controllers/seminars_controller.rb @@ -2,7 +2,7 @@ class SeminarsController < ApplicationController helper MemberHelper include Admin::SeminarsHelper - + # include SimpleCaptcha::ControllerHelpers def index time_now = Time.now @@ -21,7 +21,7 @@ class SeminarsController < ApplicationController params = OrbitHelper.params - seminar = SeminarMain.find_by(uid: params[:uid]) + seminar = SeminarMain.where(uid: params[:uid]).first seminar_agreement = SeminarAgreement.first @@ -86,12 +86,11 @@ class SeminarsController < ApplicationController categories = module_app.categories - seminar = SeminarMain.find_by(uid: params[:uid]) + seminar = SeminarMain.where(uid: params[:uid]).first seminar_signup = SeminarSignup.new time_now = Time.now - { "seminar" => seminar, "seminar_signup" => seminar_signup, @@ -141,7 +140,7 @@ class SeminarsController < ApplicationController # if gotcha_valid? && @seminar_signup.save if !params[:seminar_signup_values].nil? - params[:seminar_signup_values].each_with_index do |r,i| + 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 @@ -314,4 +313,8 @@ class SeminarsController < ApplicationController params.require(:seminar_signup_contribute).permit! end + def seminar_signup_values_params + params.require(:seminar_signup_values).permit! + end + end \ No newline at end of file diff --git a/app/models/seminar_signup_value.rb b/app/models/seminar_signup_value.rb index 9175137..c1a648f 100644 --- a/app/models/seminar_signup_value.rb +++ b/app/models/seminar_signup_value.rb @@ -158,7 +158,7 @@ class SeminarSignupValue @seminar_signup_field_value.update(field_value_param) rescue nil @seminar_signup_field_value.save rescue nil else - @seminar_signup_field_value = member.seminar_signup_values.build(field_value_param) rescue nil + @seminar_signup_field_value = member.seminar_signup_values.build(field_value_param) #rescue nil @seminar_signup_field_value.save end return @seminar_signup_field_value diff --git a/app/views/admin/seminars/export.xlsx.axlsx b/app/views/admin/seminars/export.xlsx.axlsx index 2291e44..5aff95b 100644 --- a/app/views/admin/seminars/export.xlsx.axlsx +++ b/app/views/admin/seminars/export.xlsx.axlsx @@ -23,7 +23,13 @@ wb.add_worksheet(name: @seminar.title) do |sheet| row << t('seminar_signup.note') @seminar.seminar_signup_fields.asc(:_id).each do |rf| - row << rf.title + if rf.can_muti_lang_input? + @site_in_use_locales.each do |l| + row << rf.title + " (#{t(l.to_s)})" + end + else + row << rf.title + end end sheet.add_row row @@ -43,7 +49,13 @@ wb.add_worksheet(name: @seminar.title) do |sheet| row2 << "#{signup.note} " @seminar.seminar_signup_fields.asc(:_id).each do |rf| - row2 << nl2br(show_attribute_value(@seminar.get_attribute_value(rf,signup.id).get_value_by_locale(I18n.locale))) rescue ' ' + if rf.can_muti_lang_input? + @site_in_use_locales.each do |l| + row2 << nl2br(show_attribute_value(@seminar.get_attribute_value(rf,signup.id).get_value_by_locale(l))) rescue ' ' + end + else + row2 << nl2br(show_attribute_value(@seminar.get_attribute_value(rf,signup.id).get_value_by_locale(I18n.locale))) rescue ' ' + end end sheet.add_row row2 diff --git a/app/views/seminars/show.html.erb b/app/views/seminars/show.html.erb index 6e64ab5..b567742 100644 --- a/app/views/seminars/show.html.erb +++ b/app/views/seminars/show.html.erb @@ -1,4 +1,3 @@ -<% # encoding: utf-8 %> <% data = action_data @seminar = data["seminar"] @@ -6,7 +5,6 @@ @time_now = data["time_now"] @form_index = 0 %> - <% 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 ) %> <%#= stylesheet_link_tag "lib/main-forms" %> @@ -186,12 +184,12 @@ -