Fixed hosting bug
This commit is contained in:
parent
bf11544c2a
commit
8bdb96777a
@ -123,13 +123,13 @@ class ConferencesController < ApplicationController
|
||||
@errors[:name] = :empty
|
||||
end
|
||||
|
||||
if params[:location].present? && params[:location].gsub(/[\s\W]/, '').present? && (l = Geocoder.search(params[:location], language: 'en')).present?
|
||||
corrected = view_context.location(l.first, @this_conference.locale)
|
||||
if params[:location].present? && params[:location].gsub(/[\s\W]/, '').present?
|
||||
city = City.search(params[:location])
|
||||
|
||||
if corrected.present?
|
||||
@registration.city = corrected
|
||||
if params[:location].gsub(/[\s,]/, '').downcase != @registration.city.gsub(/[\s,]/, '').downcase
|
||||
@warnings << view_context._('warnings.messages.location_corrected', vars: {original: params[:location], corrected: corrected})
|
||||
if city.present?
|
||||
@registration.city_id = city.id
|
||||
if params[:location].gsub(/[\s,]/, '').downcase != view_context.location(city).gsub(/[\s,]/, '').downcase
|
||||
@warnings << view_context._('warnings.messages.location_corrected', vars: {original: params[:location], corrected: view_context.location(city)})
|
||||
end
|
||||
else
|
||||
@errors[:location] = :unknown
|
||||
@ -330,7 +330,7 @@ class ConferencesController < ApplicationController
|
||||
steps -= [:questions] unless status == :open
|
||||
steps -= [:payment] unless status == :open && conference.paypal_email_address.present? && conference.paypal_username.present? && conference.paypal_password.present? && conference.paypal_signature.present?
|
||||
if @registration.present?
|
||||
if view_context.same_city?(@registration.city, view_context.location(conference.location, conference.locale))
|
||||
if @registration.city_id == conference.city_id
|
||||
steps -= [:questions]
|
||||
|
||||
# if this is a housing provider that is not attending the conference, remove these steps
|
||||
|
@ -239,7 +239,7 @@ module ApplicationHelper
|
||||
def registration_steps(conference = @conference)
|
||||
{
|
||||
pre: [:policy, :contact_info, :workshops],
|
||||
open: [:policy, :contact_info, :questions, :payment, :workshops]
|
||||
open: [:policy, :contact_info, :questions, :hosting, :payment, :workshops]
|
||||
}[@this_conference.registration_status]
|
||||
end
|
||||
|
||||
|
@ -7,6 +7,13 @@ module RegistrationHelper
|
||||
disable_steps = false
|
||||
completed_steps = registration.steps_completed || []
|
||||
registration_complete = registration_complete?(registration)
|
||||
|
||||
if registration.city_id == registration.conference.city_id
|
||||
steps -= [:questions]
|
||||
else
|
||||
steps -= [:hosting]
|
||||
end
|
||||
|
||||
steps.each do | step |
|
||||
# disable the step if we've already found an incomplete step
|
||||
enabled = !disable_steps || registration_complete
|
||||
|
@ -29,6 +29,10 @@ class ConferenceRegistration < ActiveRecord::Base
|
||||
[:vegan, :smoking, :pets, :quiet]
|
||||
end
|
||||
|
||||
def city
|
||||
city_id.present? ? City.find(city_id) : nil
|
||||
end
|
||||
|
||||
def status(was = false)
|
||||
return :unregistered if user.nil? || user.firstname.blank? || self.send(was ? :city_was : :city).blank?
|
||||
return :registered if self.send(was ? :housing_was : :housing).present? || (self.send(was ? :can_provide_housing_was : :can_provide_housing) && (self.send(was ? :housing_data_was : :housing_data) || {})['availability'].present?)
|
||||
|
@ -2,7 +2,7 @@
|
||||
%p=_'articles.conference_registration.paragraphs.Contact_Info', :s, 2
|
||||
= form_tag register_path(@this_conference.slug) do
|
||||
= textfield :name, @name, required: true, heading: 'articles.conference_registration.headings.name', big: true
|
||||
= textfield :location, (params[:location] || @registration.city || location(lookup_ip_location)), required: true, heading: 'articles.conference_registration.headings.location'
|
||||
= textfield :location, (params[:location] || location(@registration.city ||lookup_ip_location)), required: true, heading: 'articles.conference_registration.headings.location'
|
||||
= checkboxes :languages, User.AVAILABLE_LANGUAGES, (current_user.languages || [I18n.locale]).map(&:to_sym), 'languages', heading: 'articles.conference_registration.headings.languages'
|
||||
.actions.next-prev
|
||||
= button_tag (params[:step] == :save ? :save : :next), value: :contact_info
|
||||
|
@ -1364,6 +1364,7 @@ en:
|
||||
forms:
|
||||
labels:
|
||||
generic:
|
||||
hosting_dates: When will you be in town?
|
||||
type: Type
|
||||
year: Year
|
||||
is_public: Public
|
||||
|
@ -996,6 +996,7 @@ es:
|
||||
forms:
|
||||
labels:
|
||||
generic:
|
||||
hosting_dates: ¿Cuándo estarás en la ciudad?
|
||||
title: Título de la taller
|
||||
info: Descripción
|
||||
allergies: Alérgicx
|
||||
|
@ -0,0 +1,5 @@
|
||||
class AddCityIdToConferenceRegistrations < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :conference_registrations, :city_id, :integer
|
||||
end
|
||||
end
|
12
db/schema.rb
12
db/schema.rb
@ -11,11 +11,20 @@
|
||||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(version: 20161211065022) do
|
||||
ActiveRecord::Schema.define(version: 20170110061048) do
|
||||
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "plpgsql"
|
||||
|
||||
create_table "applications", force: :cascade do |t|
|
||||
t.string "slug"
|
||||
t.string "name"
|
||||
t.string "path"
|
||||
t.string "url"
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
end
|
||||
|
||||
create_table "authentications", force: :cascade do |t|
|
||||
t.integer "user_id", null: false
|
||||
t.string "provider", null: false
|
||||
@ -120,6 +129,7 @@ ActiveRecord::Schema.define(version: 20161211065022) do
|
||||
t.json "steps_completed"
|
||||
t.boolean "can_provide_housing"
|
||||
t.json "housing_data"
|
||||
t.integer "city_id"
|
||||
end
|
||||
|
||||
create_table "conference_types", force: :cascade do |t|
|
||||
|
Loading…
x
Reference in New Issue
Block a user