Added conference list page, administration tools, and re-designed conference administration
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
class AddTypeToConference < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :conferences, :type, :string
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,14 @@
|
||||
class CreateCities < ActiveRecord::Migration
|
||||
def change
|
||||
create_table :cities do |t|
|
||||
t.string :city
|
||||
t.string :territory
|
||||
t.string :country
|
||||
t.float :latitude
|
||||
t.float :longitude
|
||||
t.string :locale
|
||||
|
||||
t.timestamps null: false
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,10 @@
|
||||
class CreateCityMatches < ActiveRecord::Migration
|
||||
def change
|
||||
create_table :city_matches do |t|
|
||||
t.string :search
|
||||
t.integer :city_id
|
||||
|
||||
t.timestamps null: false
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,5 @@
|
||||
class AddYearToConference < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :conferences, :year, :integer
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,5 @@
|
||||
class AddCityIdToConference < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :conferences, :city_id, :integer
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,9 @@
|
||||
class AddIsPublicToConference < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :conferences, :is_public, :boolean
|
||||
|
||||
Conference.all.each do |c|
|
||||
c.update_attribute :is_public, true
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,9 @@
|
||||
class AddIsFeaturedToConference < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :conferences, :is_featured, :boolean
|
||||
|
||||
Conference.all.each do |c|
|
||||
c.update_attribute :is_featured, (c.slug == 'Detroit2016')
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,9 @@
|
||||
class RenameConferenceType < ActiveRecord::Migration
|
||||
def change
|
||||
rename_column :conferences, :type, :conferencetype
|
||||
|
||||
Conference.all.each do |c|
|
||||
c.update_attribute :conferencetype, (c.conference_type == 5 ? 'regional' : 'annual')
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,39 @@
|
||||
require 'geocoder/calculations'
|
||||
|
||||
class RenameCityMatches < ActiveRecord::Migration
|
||||
def change
|
||||
rename_table :city_matches, :city_cache
|
||||
|
||||
Conference.all.each do |c|
|
||||
conference_location = c.location
|
||||
|
||||
if conference_location.present?
|
||||
location = Geocoder.search("#{conference_location.city}, #{conference_location.territory}, #{conference_location.country}", language: 'en').first
|
||||
|
||||
component_alises = {
|
||||
'locality' => :city,
|
||||
'administrative_area_level_1' => :territory,
|
||||
'country' => :country
|
||||
}
|
||||
city_data = {
|
||||
locale: :en,
|
||||
latitude: location.data['geometry']['location']['lat'],
|
||||
longitude: location.data['geometry']['location']['lng']
|
||||
}
|
||||
location.data['address_components'].each do | component |
|
||||
property = component_alises[component['types'].first]
|
||||
city_data[property] = component['short_name'] if property.present?
|
||||
end
|
||||
|
||||
city = City.where(city: city_data[:city], territory: city_data[:territory], country: city_data[:country]).first
|
||||
|
||||
unless city.present?
|
||||
city = City.new(city_data)
|
||||
city.save!
|
||||
end
|
||||
|
||||
c.update_attribute :city_id, city.id
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,13 @@
|
||||
require 'geocoder/calculations'
|
||||
|
||||
class AddPlaceIdToCity < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :cities, :place_id, :string
|
||||
|
||||
City.all.each do |c|
|
||||
location = Geocoder.search(c.address, language: 'en').first
|
||||
c.place_id = location.data['place_id']
|
||||
c.save!
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,11 @@
|
||||
class AddCityIdToLocation < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :locations, :city_id, :integer
|
||||
|
||||
Location.all.each do |l|
|
||||
city = City.search(([l.city, l.territory, l.country] - [nil, '']).join(', '))
|
||||
l.city_id = city.id
|
||||
l.save!
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,9 @@
|
||||
class AddSpanishCityTranslations < ActiveRecord::Migration
|
||||
def change
|
||||
City.all.each do |c|
|
||||
city = c.get_translation(:es)
|
||||
c.set_column_for_locale(:city, :es, city, 0) unless city.blank? || city == c.get_column_for_locale(:city, :es)
|
||||
c.save!
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,20 @@
|
||||
class SetConferenceTypes < ActiveRecord::Migration
|
||||
def change
|
||||
types = {
|
||||
'Bike!Bike! 2013' => :annual,
|
||||
'Bike!Bike! Southeast 2014' => :se,
|
||||
'Bike!Bike! North 2014' => :n,
|
||||
'Ohio! Ohio!' => :ne,
|
||||
'Bike!Bike! 2014' => :annual,
|
||||
'Bike!Bike! 2015' => :annual,
|
||||
'Bike!Bike! 2016' => :annual
|
||||
}
|
||||
Conference.all.each do |c|
|
||||
c.conferencetype = types[c.title] || :annual
|
||||
c.year ||= c.end_date.year
|
||||
c.slug = nil
|
||||
c.make_slug
|
||||
c.save!
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,10 @@
|
||||
class CreateConferenceAdministrators < ActiveRecord::Migration
|
||||
def change
|
||||
create_table :conference_administrators do |t|
|
||||
t.integer :conference_id
|
||||
t.integer :user_id
|
||||
|
||||
t.timestamps null: false
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,6 @@
|
||||
class ChangeConferenceDatetimesToDates < ActiveRecord::Migration
|
||||
def change
|
||||
change_column :conferences, :start_date, :date
|
||||
change_column :conferences, :end_date, :date
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,19 @@
|
||||
class ReplaceMissingLocales < ActiveRecord::Migration
|
||||
def change
|
||||
Conference.where(locale: nil).each do |c|
|
||||
c.update_attribute :locale, 'en'
|
||||
end
|
||||
|
||||
Workshop.where(locale: nil).each do |c|
|
||||
c.update_attribute :locale, 'en'
|
||||
end
|
||||
|
||||
Event.where(locale: nil).each do |c|
|
||||
c.update_attribute :locale, 'en'
|
||||
end
|
||||
|
||||
City.where(locale: nil).each do |c|
|
||||
c.update_attribute :locale, 'en'
|
||||
end
|
||||
end
|
||||
end
|
||||
+35
-3
@@ -11,7 +11,7 @@
|
||||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(version: 20161006021205) do
|
||||
ActiveRecord::Schema.define(version: 20161211065022) do
|
||||
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "plpgsql"
|
||||
@@ -24,6 +24,25 @@ ActiveRecord::Schema.define(version: 20161006021205) do
|
||||
t.datetime "updated_at"
|
||||
end
|
||||
|
||||
create_table "cities", force: :cascade do |t|
|
||||
t.string "city"
|
||||
t.string "territory"
|
||||
t.string "country"
|
||||
t.float "latitude"
|
||||
t.float "longitude"
|
||||
t.string "locale"
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.string "place_id"
|
||||
end
|
||||
|
||||
create_table "city_cache", force: :cascade do |t|
|
||||
t.string "search"
|
||||
t.integer "city_id"
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
end
|
||||
|
||||
create_table "comments", force: :cascade do |t|
|
||||
t.string "model_type"
|
||||
t.integer "model_id"
|
||||
@@ -33,6 +52,13 @@ ActiveRecord::Schema.define(version: 20161006021205) do
|
||||
t.integer "user_id"
|
||||
end
|
||||
|
||||
create_table "conference_administrators", force: :cascade do |t|
|
||||
t.integer "conference_id"
|
||||
t.integer "user_id"
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
end
|
||||
|
||||
create_table "conference_admins", force: :cascade do |t|
|
||||
t.integer "conference_id"
|
||||
t.integer "user_id"
|
||||
@@ -107,8 +133,8 @@ ActiveRecord::Schema.define(version: 20161006021205) do
|
||||
create_table "conferences", force: :cascade do |t|
|
||||
t.string "title"
|
||||
t.string "slug"
|
||||
t.datetime "start_date"
|
||||
t.datetime "end_date"
|
||||
t.date "start_date"
|
||||
t.date "end_date"
|
||||
t.text "info"
|
||||
t.string "poster"
|
||||
t.string "cover"
|
||||
@@ -139,6 +165,11 @@ ActiveRecord::Schema.define(version: 20161006021205) do
|
||||
t.json "workshop_blocks"
|
||||
t.text "payment_message"
|
||||
t.json "payment_amounts"
|
||||
t.string "conferencetype"
|
||||
t.integer "year"
|
||||
t.integer "city_id"
|
||||
t.boolean "is_public"
|
||||
t.boolean "is_featured"
|
||||
end
|
||||
|
||||
create_table "delayed_jobs", force: :cascade do |t|
|
||||
@@ -222,6 +253,7 @@ ActiveRecord::Schema.define(version: 20161006021205) do
|
||||
t.string "city"
|
||||
t.string "street"
|
||||
t.string "postal_code"
|
||||
t.integer "city_id"
|
||||
end
|
||||
|
||||
add_index "locations", ["latitude", "longitude"], name: "index_locations_on_latitude_and_longitude", using: :btree
|
||||
|
||||
Reference in New Issue
Block a user