Added the option for housing providers to opt out of attending the conference

This commit is contained in:
Godwin
2016-08-16 19:46:16 -07:00
parent 22375e73e0
commit 2d76af89d9
5 changed files with 26 additions and 7 deletions
+17 -1
View File
@@ -124,6 +124,17 @@ class ConferencesController < ApplicationController
current_user.save! unless @errors.present?
when :hosting
@registration.can_provide_housing = params[:can_provide_housing].present?
if params[:not_attending]
@registration.is_attending = 'n'
if current_user.is_subscribed.nil?
current_user.is_subscribed = false
current_user.save!
end
else
@registration.is_attending = 'y'
end
@registration.housing_data = {
address: params[:address],
phone: params[:phone],
@@ -1326,6 +1337,11 @@ class ConferencesController < ApplicationController
if @registration.present?
if view_context.same_city?(@registration.city, view_context.location(conference.location, conference.locale))
steps -= [:questions]
# if this is a housing provider that is not attending the conference, remove these steps
if @registration.is_attending == 'n'
steps -= [:payment, :workshops]
end
else
steps -= [:hosting]
end
@@ -1545,7 +1561,7 @@ class ConferencesController < ApplicationController
:conference_id => @conference.id,
:user_id => session[:registration][:user][:id],
:email => session[:registration][:email],
:is_attending => 'yes',
:is_attending => 'y',
:is_participant => session[:registration][:is_participant],
:is_volunteer => session[:registration][:is_volunteer],
:is_confirmed => false,
+4 -4
View File
@@ -896,11 +896,11 @@ module ApplicationHelper
case to.to_sym
when :registered
ConferenceRegistration.where(conference_id: conference.id).each do | r |
users << r.user if ((r.steps_completed || []).include? 'questions') && r.user.present?
users << r.user if ((r.steps_completed || []).include? 'questions') && r.user.present? && r.is_attending != 'n'
end
when :pre_registered
ConferenceRegistration.where(conference_id: conference.id).each do | r |
users << r.user if ((r.steps_completed || []).include? 'contact_info') && r.user.present?
users << r.user if ((r.steps_completed || []).include? 'contact_info') && r.user.present? && r.is_attending != 'n'
end
when :workshop_facilitators
user_hash = {}
@@ -912,7 +912,7 @@ module ApplicationHelper
users = user_hash.values
when :unregistered
ConferenceRegistration.where(conference_id: conference.id).each do | r |
users << r.user unless ((r.steps_completed || []).include? (conference.registration_status == :open ? 'questions' : 'contact_info')) || r.user.nil?
users << r.user unless ((r.steps_completed || []).include? (conference.registration_status == :open ? 'questions' : 'contact_info')) || r.user.nil? || r.is_attending == 'n'
end
when :housing_providers
ConferenceRegistration.where(conference_id: conference.id, can_provide_housing: true).each do | r |
@@ -920,7 +920,7 @@ module ApplicationHelper
end
when :guests
ConferenceRegistration.where(conference_id: conference.id, housing: 'house').each do | r |
users << r.user if r.user.present?
users << r.user if r.user.present? && r.is_attending != 'n'
end
when :all
User.all.each do | u |
+1
View File
@@ -2,6 +2,7 @@
= form_tag register_path(@this_conference.slug) do
= checkbox :can_provide_housing, @registration.can_provide_housing, 'articles.conference_registration.can_provide_housing', heading: 'articles.conference_registration.headings.can_provide_housing', help: 'articles.conference_registration.paragraphs.can_provide_housing', inline: true, toggles: 'hosting-options', centered: true
#hosting-options
= checkbox :not_attending, @registration.is_attending == 'n', 'articles.conference_registration.not_attending', help: 'articles.conference_registration.paragraphs.not_attending', inline: true, right_help: true
= textfield :address, @hosting_data['address'], required: true, heading: 'articles.conference_registration.headings.host.address', help: 'articles.conference_registration.paragraphs.host.address'
= telephonefield :phone, @hosting_data['phone'], required: true
= fieldset :space, heading: 'articles.conference_registration.headings.host.space', help: 'articles.conference_registration.paragraphs.host.space' do