Fixed registration status issues
This commit is contained in:
parent
6bd7f11c52
commit
5118fa7135
@ -69,9 +69,9 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function editTableCell(cell) {
|
function editTableCell(cell) {
|
||||||
if (selectorMatches(cell, 'tr[data-key].editable td')) {
|
if (cell && selectorMatches(cell, 'tr[data-key].editable td')) {
|
||||||
editTableRow(cell.parentElement, cell);
|
editTableRow(cell.parentElement, cell);
|
||||||
} else if (!selectorMatches(cell, 'tr[data-key].editable + tr, tr[data-key].editable + tr *')) {
|
} else if (!cell || !selectorMatches(cell, 'tr[data-key].editable + tr, tr[data-key].editable + tr *')) {
|
||||||
var currentRow = document.querySelector('tr[data-key].editable.editing');
|
var currentRow = document.querySelector('tr[data-key].editable.editing');
|
||||||
if (currentRow) {
|
if (currentRow) {
|
||||||
saveRow(currentRow);
|
saveRow(currentRow);
|
||||||
@ -131,6 +131,10 @@
|
|||||||
document.addEventListener("focus", function (event) { editTableCell(event.target); }, true);
|
document.addEventListener("focus", function (event) { editTableCell(event.target); }, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
window.onbeforeunload = function() {
|
||||||
|
editTableCell();
|
||||||
|
};
|
||||||
|
|
||||||
searchControl.addEventListener('keyup', filterTable);
|
searchControl.addEventListener('keyup', filterTable);
|
||||||
searchControl.addEventListener('search', filterTable);
|
searchControl.addEventListener('search', filterTable);
|
||||||
|
|
||||||
|
@ -867,7 +867,12 @@ class ConferenceAdministrationController < ApplicationController
|
|||||||
params.each do | key, value |
|
params.each do | key, value |
|
||||||
case key.to_sym
|
case key.to_sym
|
||||||
when :city
|
when :city
|
||||||
registration.city = value.present? ? view_context.location(Geocoder.search(value, language: @this_conference.locale).first, @this_conference.locale) : nil
|
if value.present?
|
||||||
|
city = City.search(value)
|
||||||
|
if city.present?
|
||||||
|
registration.city_id = city.id
|
||||||
|
end
|
||||||
|
end
|
||||||
when :housing, :bike, :food, :allergies, :other
|
when :housing, :bike, :food, :allergies, :other
|
||||||
registration.send("#{key.to_s}=", value)
|
registration.send("#{key.to_s}=", value)
|
||||||
when :registration_fees_paid
|
when :registration_fees_paid
|
||||||
|
@ -50,6 +50,14 @@ class City < ActiveRecord::Base
|
|||||||
return translation
|
return translation
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def to_s
|
||||||
|
([
|
||||||
|
city,
|
||||||
|
territory.present? && country.present? ? I18n.t("geography.subregions.#{country}.#{territory}") : '',
|
||||||
|
country.present? ? I18n.t("geography.countries.#{country}") : ''
|
||||||
|
] - ['', nil]).join(', ')
|
||||||
|
end
|
||||||
|
|
||||||
def self.search(str)
|
def self.search(str)
|
||||||
cache = CityCache.search(str)
|
cache = CityCache.search(str)
|
||||||
|
|
||||||
@ -66,7 +74,7 @@ class City < ActiveRecord::Base
|
|||||||
|
|
||||||
# if we didn't find a match by place id, collect the city, territory, and country from the result
|
# if we didn't find a match by place id, collect the city, territory, and country from the result
|
||||||
unless city.present?
|
unless city.present?
|
||||||
# google nsames things differently than we do, we'll look for these itesm
|
# google names things differently than we do, we'll look for these items
|
||||||
component_alises = {
|
component_alises = {
|
||||||
'locality' => :city,
|
'locality' => :city,
|
||||||
'administrative_area_level_1' => :territory,
|
'administrative_area_level_1' => :territory,
|
||||||
|
@ -34,9 +34,10 @@ class ConferenceRegistration < ActiveRecord::Base
|
|||||||
end
|
end
|
||||||
|
|
||||||
def status(was = false)
|
def status(was = false)
|
||||||
return :unregistered if user.nil? || user.firstname.blank? || self.send(was ? :city_was : :city).blank?
|
return :unregistered if user.nil?
|
||||||
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?)
|
steps = ((was ? steps_completed_was : steps_completed) || []).map(&:to_sym)
|
||||||
return :preregistered
|
return :registered if steps.include?(:hosting) || steps.include?(:questions)
|
||||||
|
return :preregistered if steps.include?(:contact_info)
|
||||||
end
|
end
|
||||||
|
|
||||||
around_update :check_status
|
around_update :check_status
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
#
|
#
|
||||||
# It's strongly recommended that you check this file into your version control system.
|
# It's strongly recommended that you check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema.define(version: 20170111013903) do
|
ActiveRecord::Schema.define(version: 20170111172147) do
|
||||||
|
|
||||||
# These are extensions that must be enabled in order to support this database
|
# These are extensions that must be enabled in order to support this database
|
||||||
enable_extension "plpgsql"
|
enable_extension "plpgsql"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user