From 2d76af89d94623d66be87530285ba84d5e05f4d6 Mon Sep 17 00:00:00 2001 From: Godwin Date: Tue, 16 Aug 2016 19:46:16 -0700 Subject: [PATCH] Added the option for housing providers to opt out of attending the conference --- app/controllers/conferences_controller.rb | 18 +++++++++++++++++- app/helpers/application_helper.rb | 8 ++++---- app/views/conferences/_hosting.html.haml | 1 + config/locales/en.yml | 4 ++-- config/locales/es.yml | 2 ++ 5 files changed, 26 insertions(+), 7 deletions(-) diff --git a/app/controllers/conferences_controller.rb b/app/controllers/conferences_controller.rb index 0a607ed..1259d3e 100644 --- a/app/controllers/conferences_controller.rb +++ b/app/controllers/conferences_controller.rb @@ -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, diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 1ce03fe..a1bca27 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -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 | diff --git a/app/views/conferences/_hosting.html.haml b/app/views/conferences/_hosting.html.haml index 07a44bc..d879af0 100644 --- a/app/views/conferences/_hosting.html.haml +++ b/app/views/conferences/_hosting.html.haml @@ -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 diff --git a/config/locales/en.yml b/config/locales/en.yml index 3a18265..cadbd4a 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -1021,8 +1021,6 @@ en: admin: edit: info: Info - payment: - message: XXX companion: Companion paragraphs: Policy_Agreement: Ensuring that all attendees feel welcome, safe, and respected at all times is especially important to us all. Please ensure that you have fully read and understand our safer spaces policy below, if you have any questions or concerns you can reach out to the organizers at any time. @@ -1051,6 +1049,7 @@ en: Verify_Account: In order to confirm that you are a real person and that we will be able to contact you later, please verify your email address. We will send you an email that will allow you to continue with the registration process. facebook_sign_in: Alternatively you can sign in using your Facebook account and skip waiting for us to send you an email. can_provide_housing: Hosting visiting conference attendees is an important part of Bike!Bike!, it allows many people who would not normally be able to afford the cost of accommodations the chance to come to the conference and lets attendees really get to know our city and its residents. You will need to grant access to your home to guests overnight keeping in mind that events can sometimes go late into the evening. If your home will not be accessible during the day you should make sure to clearly communicate this with your guests. + not_attending: If you are only providing housing and would not like to receive further updates about the conference, check this box. host: address: Your address and phone number will be shared with your guests and conference organizers. space: How much space do you have to share? @@ -1079,6 +1078,7 @@ en: quiet: Quiet household pets: House has dogs or cats can_provide_housing: I can provide housing + not_attending: I will not be attending the conference questions: bike: large: Large diff --git a/config/locales/es.yml b/config/locales/es.yml index 847a0a0..ad3c776 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -817,6 +817,7 @@ es: Policy_Agreement: Asegurar que todos los asistentes se sientan bienvenidos, seguro y respetada en todo momento es especialmente importante para todos nosotros. Por favor asegúrese de que plenamente ha leído y entendido nuestra política de espacios más seguros a continuación, si tiene alguna pregunta o preocupación que usted puede llegar a los organizadores en cualquier momento. facebook_sign_in: De manera alternativa puedes registrarte usando tu cuenta de Facebook y así evitarás tener que esperar a que te enviemos un correo electrónico can_provide_housing: Alojar a lxs asistentes a la conferencia es una parte importante de Bike!Bike!, proporciona a mucha gente que normalmente no podría costear el hospedaje, la oportunidad de venir a la conferencia, permitiéndoles conocer nuestra ciudad y a sus residentes. Tendrás que conceder acceso a tu casa a lxs huéspedes durante la noche, teniendo en cuenta que los eventos pueden terminar hasta muy tarde. Si no se puede acceder a tu casa durante el día, debes asegurarte de comunicar estoy muy claramente a tus invitadxs. + not_attending: Si sólo está proporcionando vivienda y no desea recibir más actualizaciones sobre la conferencia, marque esta casilla. Verify_Account: Con el fin de confirmar que eres una persona real y que podremos contactarte posteriormente, te pedimos que por favor verifiques tu dirección de correo electrónico. Te enviaremos un mensaje para que puedas continuar con el proceso de pre-registro. Pre_Registration_Details: Al completar el proceso de pre-registro nos estás haciendo saber que estás interesad@ en asistir, lo que nos permite contactarte cuando tengamos noticias, y planear mejor [el evento] sabiendo quienes podrían venir. Una vez que el registro esté completamente abierto, necesitaremos hacerte algunas preguntas más en donde podrás confirmar si asistirás o no. Registration_Details: Al completar el proceso de registro, estás confirmándonos que vendrás, lo que nos permite contactarte cuando tengamos noticias y nos posibilita planear mejor el hospedaje al saber cuántas personas vendrán. Una vez registradx, tendrás la opción de acceder a facilitar tu propio taller, y a ver detalles de los talleres ya existentes. Si ya estás registradx o preregistradx, puedes utilizas esta forma de inscripción y acceder a tu cuenta ó actualizarla. @@ -839,6 +840,7 @@ es: payment_confirm: Estás por confirmar tu pago de %{amount} para el registro. workshops: Ahora puedes revisar los talleres propuestos e incluso proponer uno si quieres. can_provide_housing: Puedo proporcionar hospedaje + not_attending: Yo no asistirá a la conferencia questions: food: meat: Carnívorx