|
@ -508,6 +508,7 @@ class ConferencesController < ApplicationController |
|
|
column_types: { |
|
|
column_types: { |
|
|
name: :bold, |
|
|
name: :bold, |
|
|
date: :datetime, |
|
|
date: :datetime, |
|
|
|
|
|
email: :email, |
|
|
companion_email: :email, |
|
|
companion_email: :email, |
|
|
arrival: [:date, :day], |
|
|
arrival: [:date, :day], |
|
|
departure: [:date, :day], |
|
|
departure: [:date, :day], |
|
@ -532,7 +533,7 @@ class ConferencesController < ApplicationController |
|
|
bike: 'forms.labels.generic.bike', |
|
|
bike: 'forms.labels.generic.bike', |
|
|
food: 'forms.labels.generic.food', |
|
|
food: 'forms.labels.generic.food', |
|
|
companion: 'articles.conference_registration.terms.companion', |
|
|
companion: 'articles.conference_registration.terms.companion', |
|
|
companion_email: 'forms.labels.generic.email', |
|
|
companion_email: 'articles.conference_registration.terms.companion_email', |
|
|
allergies: 'forms.labels.generic.allergies', |
|
|
allergies: 'forms.labels.generic.allergies', |
|
|
registration_fees_paid: 'articles.conference_registration.headings.fees_paid', |
|
|
registration_fees_paid: 'articles.conference_registration.headings.fees_paid', |
|
|
other: 'articles.conference_registration.headings.other', |
|
|
other: 'articles.conference_registration.headings.other', |
|
@ -645,7 +646,7 @@ class ConferencesController < ApplicationController |
|
|
preferred_language: I18n.backend.enabled_locales.map { |l| [ |
|
|
preferred_language: I18n.backend.enabled_locales.map { |l| [ |
|
|
(view_context.language_name l), l |
|
|
(view_context.language_name l), l |
|
|
] }, |
|
|
] }, |
|
|
is_attending: yes_no, |
|
|
is_attending: [yes_no.first], |
|
|
can_provide_housing: yes_no, |
|
|
can_provide_housing: yes_no, |
|
|
first_day: view_context.conference_days_options_list(:before), |
|
|
first_day: view_context.conference_days_options_list(:before), |
|
|
last_day: view_context.conference_days_options_list(:after) |
|
|
last_day: view_context.conference_days_options_list(:after) |
|
@ -782,59 +783,80 @@ class ConferencesController < ApplicationController |
|
|
|
|
|
|
|
|
case params[:admin_step] |
|
|
case params[:admin_step] |
|
|
when 'stats' |
|
|
when 'stats' |
|
|
registration = ConferenceRegistration.where( |
|
|
if params[:button] == 'save' || params[:button] == 'update' |
|
|
id: params[:key].to_i, |
|
|
if params[:button] == 'save' |
|
|
conference_id: @this_conference.id |
|
|
return do_404 unless params[:email].present? && params[:name].present? |
|
|
).limit(1).first |
|
|
|
|
|
user_changed = false |
|
|
user = User.find_by_email(params[:email]) || User.create(email: params[:email]) |
|
|
params.each do | key, value | |
|
|
user.firstname = params[:name] |
|
|
case key.to_sym |
|
|
user.save! |
|
|
when :city |
|
|
registration = ConferenceRegistration.new( |
|
|
registration.city = value.present? ? view_context.location(Geocoder.search(value, language: @this_conference.locale).first, @this_conference.locale) : nil |
|
|
conference: @this_conference, |
|
|
when :housing, :bike, :food, :allergies, :other |
|
|
user_id: user.id, |
|
|
registration.send("#{key.to_s}=", value) |
|
|
steps_completed: [] |
|
|
when :registration_fees_paid |
|
|
) |
|
|
registration.registration_fees_paid = value.to_i |
|
|
|
|
|
when :can_provide_housing |
|
|
|
|
|
registration.send("#{key.to_s}=", value.present?) |
|
|
|
|
|
when :arrival, :departure |
|
|
|
|
|
registration.send("#{key.to_s}=", value.present? ? Date.parse(value) : nil) |
|
|
|
|
|
when :companion_email |
|
|
|
|
|
registration.housing_data ||= {} |
|
|
|
|
|
registration.housing_data['companions'] = [value] |
|
|
|
|
|
when :preferred_language |
|
|
|
|
|
registration.user.locale = value |
|
|
|
|
|
user_changed = true |
|
|
|
|
|
when :is_attending |
|
|
|
|
|
registration.is_attending = value.present? ? 'y' : 'n' |
|
|
|
|
|
when :address, :phone, :first_day, :last_day, :notes |
|
|
|
|
|
registration.housing_data ||= {} |
|
|
|
|
|
registration.housing_data[key.to_s] = value |
|
|
|
|
|
else |
|
|
else |
|
|
if key.start_with?('language_') |
|
|
registration = ConferenceRegistration.where( |
|
|
l = key.split('_').last |
|
|
id: params[:key].to_i, |
|
|
if User.AVAILABLE_LANGUAGES.include? l.to_sym |
|
|
conference_id: @this_conference.id |
|
|
registration.user.languages ||= [] |
|
|
).limit(1).first |
|
|
if value.present? |
|
|
end |
|
|
registration.user.languages |= [l] |
|
|
|
|
|
else |
|
|
user_changed = false |
|
|
registration.user.languages -= [l] |
|
|
params.each do | key, value | |
|
|
|
|
|
case key.to_sym |
|
|
|
|
|
when :city |
|
|
|
|
|
registration.city = value.present? ? view_context.location(Geocoder.search(value, language: @this_conference.locale).first, @this_conference.locale) : nil |
|
|
|
|
|
when :housing, :bike, :food, :allergies, :other |
|
|
|
|
|
registration.send("#{key.to_s}=", value) |
|
|
|
|
|
when :registration_fees_paid |
|
|
|
|
|
registration.registration_fees_paid = value.to_i |
|
|
|
|
|
when :can_provide_housing |
|
|
|
|
|
registration.send("#{key.to_s}=", value.present?) |
|
|
|
|
|
when :arrival, :departure |
|
|
|
|
|
registration.send("#{key.to_s}=", value.present? ? Date.parse(value) : nil) |
|
|
|
|
|
when :companion_email |
|
|
|
|
|
registration.housing_data ||= {} |
|
|
|
|
|
registration.housing_data['companions'] = [value] |
|
|
|
|
|
when :preferred_language |
|
|
|
|
|
registration.user.locale = value |
|
|
|
|
|
user_changed = true |
|
|
|
|
|
when :is_attending |
|
|
|
|
|
registration.is_attending = value.present? ? 'y' : 'n' |
|
|
|
|
|
when :address, :phone, :first_day, :last_day, :notes |
|
|
|
|
|
registration.housing_data ||= {} |
|
|
|
|
|
registration.housing_data[key.to_s] = value |
|
|
|
|
|
else |
|
|
|
|
|
if key.start_with?('language_') |
|
|
|
|
|
l = key.split('_').last |
|
|
|
|
|
if User.AVAILABLE_LANGUAGES.include? l.to_sym |
|
|
|
|
|
registration.user.languages ||= [] |
|
|
|
|
|
if value.present? |
|
|
|
|
|
registration.user.languages |= [l] |
|
|
|
|
|
else |
|
|
|
|
|
registration.user.languages -= [l] |
|
|
|
|
|
end |
|
|
|
|
|
user_changed = true |
|
|
end |
|
|
end |
|
|
user_changed = true |
|
|
elsif ConferenceRegistration.all_spaces.include? key.to_sym |
|
|
|
|
|
registration.housing_data ||= {} |
|
|
|
|
|
registration.housing_data['space'] ||= {} |
|
|
|
|
|
registration.housing_data['space'][key.to_s] = value |
|
|
end |
|
|
end |
|
|
elsif ConferenceRegistration.all_spaces.include? key.to_sym |
|
|
|
|
|
registration.housing_data ||= {} |
|
|
|
|
|
registration.housing_data['space'] ||= {} |
|
|
|
|
|
registration.housing_data['space'][key.to_s] = value |
|
|
|
|
|
end |
|
|
end |
|
|
end |
|
|
end |
|
|
|
|
|
registration.user.save! if user_changed |
|
|
|
|
|
registration.save! |
|
|
|
|
|
|
|
|
|
|
|
if params[:button] == 'save' |
|
|
|
|
|
return redirect_to register_step_path(@this_conference.slug, :administration) |
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
get_stats(true, params[:key].to_i) |
|
|
|
|
|
options = view_context.registrations_table_options |
|
|
|
|
|
options[:html] = true |
|
|
|
|
|
return render html: view_context.excel_rows(@excel_data, {}, options) |
|
|
end |
|
|
end |
|
|
registration.user.save! if user_changed |
|
|
|
|
|
registration.save! |
|
|
|
|
|
get_stats(true, params[:key].to_i) |
|
|
|
|
|
options = view_context.registrations_table_options |
|
|
|
|
|
options[:html] = true |
|
|
|
|
|
return render html: view_context.excel_rows(@excel_data, {}, options) |
|
|
|
|
|
when 'edit' |
|
|
when 'edit' |
|
|
case params[:button] |
|
|
case params[:button] |
|
|
when 'save' |
|
|
when 'save' |
|
|