Added localization to workshops, made login persist through subdomains
This commit is contained in:
@@ -168,3 +168,13 @@ Feature: Registration Page
|
||||
Then I should see email has been sent
|
||||
And I should see Preview
|
||||
And I should see My Subject
|
||||
|
||||
Scenario: Edit a conference
|
||||
Given There is an upcoming conference in Portland OR
|
||||
And Registration is open
|
||||
And I am logged in as somebody@bikebike.org
|
||||
And My name is John Doe
|
||||
And I am a conference host
|
||||
And I am registered for the conference
|
||||
And I am on the edit conference page
|
||||
Then I should see Edit Spanish
|
||||
|
||||
@@ -78,23 +78,23 @@ Given(/^There is an upcoming conference( in .+)?$/) do |location|
|
||||
end
|
||||
end
|
||||
|
||||
Given(/^an organization( named .+)? exists( in .+)?$/) do |name, location|
|
||||
Given(/^an organization( named .+)? exists in (.+)?$/) do |name, location|
|
||||
if location =~ /every country/i
|
||||
Carmen::World.instance.subregions.each { |country|
|
||||
if country.subregions?
|
||||
country.subregions.each { |region|
|
||||
org = Organization.new(name: rand(36**16).to_s(36), slug: rand(36**16).to_s(36))#create_org#(Forgery::LoremIpsum.sentence)
|
||||
org = Organization.new(name: rand(36**16).to_s(36), slug: rand(36**16).to_s(36))
|
||||
org.locations << Location.new(city: 'City', country: country.code, territory: region.code)
|
||||
org.save!
|
||||
}
|
||||
else
|
||||
org = Organization.new(name: rand(36**16).to_s(36), slug: rand(36**16).to_s(36))#create_org#(Forgery::LoremIpsum.sentence)
|
||||
org = Organization.new(name: rand(36**16).to_s(36), slug: rand(36**16).to_s(36))
|
||||
org.locations << Location.new(city: 'City', country: country.code)
|
||||
org.save!
|
||||
end
|
||||
}
|
||||
else
|
||||
create_org(name ? name.gsub(/^\s*named\s+(.*?)\s*$/, '\1') : nil, location ? location.gsub(/^\s*in\s+(.*?)\s*$/, '\1') : nil)
|
||||
create_org(name ? name.gsub(/^\s*named\s+(.*?)\s*$/, '\1') : nil, location)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -103,6 +103,7 @@ Given(/^a workshop( titled .+)? exists?$/) do |title|
|
||||
workshop.conference_id = @last_conference.id
|
||||
workshop.title = title ? title.gsub(/^\s*titled\s*(.*?)\s*$/, '\1') : Forgery::LoremIpsum.sentence({:random => true}).gsub(/\.$/, '').titlecase
|
||||
workshop.info = Forgery::LoremIpsum.paragraph({:random => true})
|
||||
workshop.locale = :en
|
||||
workshop.save
|
||||
@last_workshop = workshop
|
||||
end
|
||||
|
||||
+11
-4
@@ -109,8 +109,15 @@ end
|
||||
def create_org(name = nil, location = nil)
|
||||
org = FactoryGirl.create(:org)
|
||||
found_location = nil
|
||||
if !location.nil?
|
||||
l = Geocoder.search(location).first
|
||||
if location.present?
|
||||
cache_file = File.join(File.dirname(__FILE__), 'location_cache.yml')
|
||||
cache = File.exists?(cache_file) ? YAML.load_file(cache_file) : {}
|
||||
l = cache[location]
|
||||
if l.nil?
|
||||
l = Geocoder.search(location).first
|
||||
cache[location] = l
|
||||
File.open(cache_file, 'w') { |f| f.write cache.to_yaml }
|
||||
end
|
||||
begin
|
||||
found_location = Location.new(city: l.city, territory: l.province_code, country: l.country_code, latitude: l.latitude, longitude: l.longitude)
|
||||
rescue; end
|
||||
@@ -120,11 +127,11 @@ def create_org(name = nil, location = nil)
|
||||
return org
|
||||
end
|
||||
end
|
||||
if !name.nil?
|
||||
if name.present?
|
||||
org.name = name
|
||||
org.slug = org.generate_slug(name, found_location)
|
||||
end
|
||||
if !found_location.nil?
|
||||
if found_location.present?
|
||||
org.locations << found_location
|
||||
end
|
||||
org.save!
|
||||
|
||||
@@ -10,6 +10,7 @@ FactoryGirl.define do
|
||||
end_date Date.today - 26.days
|
||||
conference_type_id (ConferenceType.find_by(:slug => 'bikebike') || ConferenceType.create(:slug => 'bikebike')).id
|
||||
paypal_username 'joe'
|
||||
locale 'en'
|
||||
end
|
||||
|
||||
factory :org, :class => 'Organization' do
|
||||
|
||||
@@ -0,0 +1,300 @@
|
||||
---
|
||||
" in Halifax NS": !ruby/object:Geocoder::Result::Google
|
||||
data:
|
||||
address_components:
|
||||
- long_name: Halifax
|
||||
short_name: Halifax
|
||||
types:
|
||||
- locality
|
||||
- political
|
||||
- long_name: Halifax
|
||||
short_name: Halifax
|
||||
types:
|
||||
- administrative_area_level_3
|
||||
- political
|
||||
- long_name: Halifax Regional Municipality
|
||||
short_name: Halifax Regional Municipality
|
||||
types:
|
||||
- administrative_area_level_2
|
||||
- political
|
||||
- long_name: Nova Scotia
|
||||
short_name: NS
|
||||
types:
|
||||
- administrative_area_level_1
|
||||
- political
|
||||
- long_name: Canada
|
||||
short_name: CA
|
||||
types:
|
||||
- country
|
||||
- political
|
||||
formatted_address: Halifax, NS, Canada
|
||||
geometry:
|
||||
bounds:
|
||||
northeast:
|
||||
lat: 44.7035313
|
||||
lng: -63.5576784
|
||||
southwest:
|
||||
lat: 44.5949302
|
||||
lng: -63.68627009999999
|
||||
location:
|
||||
lat: 44.6488625
|
||||
lng: -63.5753196
|
||||
location_type: APPROXIMATE
|
||||
viewport:
|
||||
northeast:
|
||||
lat: 44.7035313
|
||||
lng: -63.5576784
|
||||
southwest:
|
||||
lat: 44.5949302
|
||||
lng: -63.68627009999999
|
||||
partial_match: true
|
||||
place_id: ChIJwfrbBxQhWksR3C2LQ6bja2Y
|
||||
types:
|
||||
- locality
|
||||
- political
|
||||
cache_hit:
|
||||
" in Sackville NB": !ruby/object:Geocoder::Result::Google
|
||||
data:
|
||||
address_components:
|
||||
- long_name: Sackville
|
||||
short_name: Sackville
|
||||
types:
|
||||
- locality
|
||||
- political
|
||||
- long_name: Westmorland County
|
||||
short_name: Westmorland County
|
||||
types:
|
||||
- administrative_area_level_2
|
||||
- political
|
||||
- long_name: New Brunswick
|
||||
short_name: NB
|
||||
types:
|
||||
- administrative_area_level_1
|
||||
- political
|
||||
- long_name: Canada
|
||||
short_name: CA
|
||||
types:
|
||||
- country
|
||||
- political
|
||||
formatted_address: Sackville, NB, Canada
|
||||
geometry:
|
||||
bounds:
|
||||
northeast:
|
||||
lat: 45.96934
|
||||
lng: -64.31345000000002
|
||||
southwest:
|
||||
lat: 45.86707
|
||||
lng: -64.4562439
|
||||
location:
|
||||
lat: 45.897903
|
||||
lng: -64.3682803
|
||||
location_type: APPROXIMATE
|
||||
viewport:
|
||||
northeast:
|
||||
lat: 45.96934
|
||||
lng: -64.31345000000002
|
||||
southwest:
|
||||
lat: 45.86707
|
||||
lng: -64.4562439
|
||||
partial_match: true
|
||||
place_id: ChIJA-OnietQX0sR3kWeYPsw4gs
|
||||
types:
|
||||
- locality
|
||||
- political
|
||||
cache_hit:
|
||||
" in Anchorage AK": !ruby/object:Geocoder::Result::Google
|
||||
data:
|
||||
address_components:
|
||||
- long_name: Anchorage
|
||||
short_name: Anchorage
|
||||
types:
|
||||
- locality
|
||||
- political
|
||||
- long_name: Anchorage
|
||||
short_name: Anchorage
|
||||
types:
|
||||
- administrative_area_level_2
|
||||
- political
|
||||
- long_name: Alaska
|
||||
short_name: AK
|
||||
types:
|
||||
- administrative_area_level_1
|
||||
- political
|
||||
- long_name: United States
|
||||
short_name: US
|
||||
types:
|
||||
- country
|
||||
- political
|
||||
formatted_address: Anchorage, AK, USA
|
||||
geometry:
|
||||
bounds:
|
||||
northeast:
|
||||
lat: 61.4838912
|
||||
lng: -148.460007
|
||||
southwest:
|
||||
lat: 60.733791
|
||||
lng: -150.2862833
|
||||
location:
|
||||
lat: 61.2180556
|
||||
lng: -149.9002778
|
||||
location_type: APPROXIMATE
|
||||
viewport:
|
||||
northeast:
|
||||
lat: 61.4838912
|
||||
lng: -148.460007
|
||||
southwest:
|
||||
lat: 60.733791
|
||||
lng: -150.2862833
|
||||
partial_match: true
|
||||
place_id: ChIJQT-zBHaRyFYR42iEp1q6fSU
|
||||
types:
|
||||
- locality
|
||||
- political
|
||||
cache_hit:
|
||||
" in San Marcos TX": !ruby/object:Geocoder::Result::Google
|
||||
data:
|
||||
address_components:
|
||||
- long_name: San Marcos
|
||||
short_name: San Marcos
|
||||
types:
|
||||
- locality
|
||||
- political
|
||||
- long_name: Hays County
|
||||
short_name: Hays County
|
||||
types:
|
||||
- administrative_area_level_2
|
||||
- political
|
||||
- long_name: Texas
|
||||
short_name: TX
|
||||
types:
|
||||
- administrative_area_level_1
|
||||
- political
|
||||
- long_name: United States
|
||||
short_name: US
|
||||
types:
|
||||
- country
|
||||
- political
|
||||
formatted_address: San Marcos, TX, USA
|
||||
geometry:
|
||||
bounds:
|
||||
northeast:
|
||||
lat: 29.9605819
|
||||
lng: -97.8419149
|
||||
southwest:
|
||||
lat: 29.777154
|
||||
lng: -98.012087
|
||||
location:
|
||||
lat: 29.8832749
|
||||
lng: -97.9413941
|
||||
location_type: APPROXIMATE
|
||||
viewport:
|
||||
northeast:
|
||||
lat: 29.9605819
|
||||
lng: -97.8419149
|
||||
southwest:
|
||||
lat: 29.777154
|
||||
lng: -98.012087
|
||||
partial_match: true
|
||||
place_id: ChIJWUZBNCqnXIYRJzGOU2wzOi8
|
||||
types:
|
||||
- locality
|
||||
- political
|
||||
cache_hit:
|
||||
" in Guadalajara Mexico": !ruby/object:Geocoder::Result::Google
|
||||
data:
|
||||
address_components:
|
||||
- long_name: Guadalajara
|
||||
short_name: Guadalajara
|
||||
types:
|
||||
- locality
|
||||
- political
|
||||
- long_name: Guadalajara
|
||||
short_name: Guadalajara
|
||||
types:
|
||||
- administrative_area_level_2
|
||||
- political
|
||||
- long_name: Jalisco
|
||||
short_name: Jal.
|
||||
types:
|
||||
- administrative_area_level_1
|
||||
- political
|
||||
- long_name: Mexico
|
||||
short_name: MX
|
||||
types:
|
||||
- country
|
||||
- political
|
||||
formatted_address: Guadalajara, Jalisco, Mexico
|
||||
geometry:
|
||||
bounds:
|
||||
northeast:
|
||||
lat: 20.7438464
|
||||
lng: -103.2637617
|
||||
southwest:
|
||||
lat: 20.6037373
|
||||
lng: -103.4070646
|
||||
location:
|
||||
lat: 20.6596988
|
||||
lng: -103.3496092
|
||||
location_type: APPROXIMATE
|
||||
viewport:
|
||||
northeast:
|
||||
lat: 20.7438464
|
||||
lng: -103.2637617
|
||||
southwest:
|
||||
lat: 20.6037373
|
||||
lng: -103.4070646
|
||||
partial_match: true
|
||||
place_id: ChIJm9MvtYyxKIQRUFeGvwKTPdY
|
||||
types:
|
||||
- locality
|
||||
- political
|
||||
cache_hit:
|
||||
" in Portland OR": !ruby/object:Geocoder::Result::Google
|
||||
data:
|
||||
address_components:
|
||||
- long_name: Portland
|
||||
short_name: Portland
|
||||
types:
|
||||
- locality
|
||||
- political
|
||||
- long_name: Multnomah County
|
||||
short_name: Multnomah County
|
||||
types:
|
||||
- administrative_area_level_2
|
||||
- political
|
||||
- long_name: Oregon
|
||||
short_name: OR
|
||||
types:
|
||||
- administrative_area_level_1
|
||||
- political
|
||||
- long_name: United States
|
||||
short_name: US
|
||||
types:
|
||||
- country
|
||||
- political
|
||||
formatted_address: Portland, OR, USA
|
||||
geometry:
|
||||
bounds:
|
||||
northeast:
|
||||
lat: 45.6524799
|
||||
lng: -122.4718489
|
||||
southwest:
|
||||
lat: 45.432393
|
||||
lng: -122.8369952
|
||||
location:
|
||||
lat: 45.5230622
|
||||
lng: -122.6764816
|
||||
location_type: APPROXIMATE
|
||||
viewport:
|
||||
northeast:
|
||||
lat: 45.6524799
|
||||
lng: -122.4718489
|
||||
southwest:
|
||||
lat: 45.432393
|
||||
lng: -122.8369952
|
||||
partial_match: true
|
||||
place_id: ChIJJ3SpfQsLlVQRkYXR9ua5Nhw
|
||||
types:
|
||||
- locality
|
||||
- political
|
||||
cache_hit:
|
||||
@@ -7,6 +7,8 @@ module NavigationHelpers
|
||||
path = :home
|
||||
when /^registration$/i
|
||||
path = "/conferences/#{@last_conference.slug}/register/"
|
||||
when /^edit conference$/i
|
||||
path = "/conferences/#{@last_conference.slug}/edit/"
|
||||
when /^(workshops|stats|broadcast)$/i
|
||||
path = "/conferences/#{@last_conference.slug}/#{path}/"
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user