mirror of
https://github.com/openSUSE/osem.git
synced 2026-08-13 19:54:02 +00:00
parent
7793497862
commit
fedb0753bf
42 changed files with 578 additions and 236 deletions
30
db/migrate/20140825091222_create_splashpages.rb
Normal file
30
db/migrate/20140825091222_create_splashpages.rb
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
class CreateSplashpages < ActiveRecord::Migration
|
||||
def change
|
||||
create_table :splashpages do |t|
|
||||
t.integer :conference_id
|
||||
|
||||
t.boolean :public
|
||||
t.boolean :include_tracks
|
||||
t.boolean :include_program
|
||||
t.boolean :include_social_media
|
||||
t.boolean :include_banner
|
||||
t.boolean :include_venue
|
||||
t.boolean :include_tickets
|
||||
t.text :ticket_description
|
||||
t.boolean :include_registrations
|
||||
t.text :registration_description
|
||||
t.boolean :include_sponsors
|
||||
t.text :sponsor_description
|
||||
t.boolean :include_lodgings
|
||||
t.text :lodging_description
|
||||
|
||||
t.text :banner_description
|
||||
t.string :banner_photo_file_name
|
||||
t.string :banner_photo_content_type
|
||||
t.integer :banner_photo_file_size
|
||||
t.datetime :banner_photo_updated_at
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -0,0 +1,89 @@
|
|||
class MoveSplashpageAttributesFromConferenceToSplashpage < ActiveRecord::Migration
|
||||
class TempConference < ActiveRecord::Base
|
||||
self.table_name = 'conferences'
|
||||
end
|
||||
|
||||
class TempRegistrationPeriod < ActiveRecord::Base
|
||||
self.table_name = 'registration_periods'
|
||||
end
|
||||
|
||||
class TempContact < ActiveRecord::Base
|
||||
self.table_name = 'contacts'
|
||||
end
|
||||
|
||||
class TempVenue < ActiveRecord::Base
|
||||
self.table_name = 'venues'
|
||||
end
|
||||
|
||||
class TempSplashpage < ActiveRecord::Base
|
||||
self.table_name = 'splashpages'
|
||||
attr_accessible :conference_id, :public, :include_registrations, :include_tracks, :include_program,
|
||||
:include_social_media, :include_banner, :include_tickets, :ticket_description, :include_sponsors,
|
||||
:sponsor_description, :lodging_description, :banner_photo_file_name, :banner_photo_content_type,
|
||||
:banner_photo_file_size, :banner_photo_updated_at, :banner_description
|
||||
end
|
||||
|
||||
def change
|
||||
# Copy values to splashpage
|
||||
TempConference.all.each do |conference|
|
||||
unless TempSplashpage.exists?(conference_id: conference.id)
|
||||
splash = TempSplashpage.create(conference_id: conference.id,
|
||||
public: conference.make_conference_public,
|
||||
include_registrations: conference.include_registrations_in_splash,
|
||||
include_tracks: conference.include_tracks_in_splash,
|
||||
include_program: conference.include_program_in_splash,
|
||||
include_banner: conference.include_banner_in_splash,
|
||||
include_tickets: conference.include_tickets_in_splash,
|
||||
ticket_description: conference.ticket_description,
|
||||
include_sponsors: conference.include_sponsors_in_splash,
|
||||
sponsor_description: conference.sponsor_description,
|
||||
lodging_description: conference.lodging_description,
|
||||
banner_description: conference.description,
|
||||
banner_photo_file_name: conference.banner_photo_file_name,
|
||||
banner_photo_content_type: conference.banner_photo_content_type,
|
||||
banner_photo_file_size: conference.banner_photo_file_size,
|
||||
banner_photo_updated_at: conference.banner_photo_updated_at)
|
||||
|
||||
contact = TempContact.find_by(conference_id: conference.id)
|
||||
if contact
|
||||
splash.include_social_media = contact.public
|
||||
splash.save
|
||||
end
|
||||
|
||||
registration = TempRegistrationPeriod.find_by(conference_id: conference.id)
|
||||
if registration
|
||||
splash.registration_description = registration.description
|
||||
splash.save
|
||||
end
|
||||
|
||||
venue = TempVenue.find_by(id: conference.venue_id)
|
||||
if venue
|
||||
splash.include_lodgings = venue.include_lodgings_in_splash
|
||||
splash.include_venue = venue.include_venue_in_splash
|
||||
splash.save
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Remove columns
|
||||
remove_column :contacts, :public
|
||||
remove_column :registration_periods, :description
|
||||
remove_column :venues, :include_lodgings_in_splash
|
||||
remove_column :venues, :include_venue_in_splash
|
||||
remove_column :conferences, :ticket_description
|
||||
remove_column :conferences, :sponsor_description
|
||||
remove_column :conferences, :lodging_description
|
||||
remove_column :conferences, :make_conference_public
|
||||
remove_column :conferences, :include_registrations_in_splash
|
||||
remove_column :conferences, :include_sponsors_in_splash
|
||||
remove_column :conferences, :include_tracks_in_splash
|
||||
remove_column :conferences, :include_tickets_in_splash
|
||||
remove_column :conferences, :include_program_in_splash
|
||||
remove_column :conferences, :banner_photo_file_name
|
||||
remove_column :conferences, :banner_photo_content_type
|
||||
remove_column :conferences, :banner_photo_file_size
|
||||
remove_column :conferences, :banner_photo_updated_at
|
||||
remove_column :conferences, :include_banner_in_splash
|
||||
remove_column :conferences, :description
|
||||
end
|
||||
end
|
||||
46
db/schema.rb
46
db/schema.rb
|
|
@ -11,7 +11,7 @@
|
|||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(version: 20140821103643) do
|
||||
ActiveRecord::Schema.define(version: 20140825093132) do
|
||||
|
||||
create_table "ahoy_events", force: true do |t|
|
||||
t.uuid "visit_id"
|
||||
|
|
@ -105,22 +105,7 @@ ActiveRecord::Schema.define(version: 20140821103643) do
|
|||
t.boolean "use_difficulty_levels", default: false
|
||||
t.boolean "use_volunteers"
|
||||
t.string "color"
|
||||
t.text "description"
|
||||
t.text "ticket_description"
|
||||
t.text "sponsor_description"
|
||||
t.string "sponsor_email"
|
||||
t.text "lodging_description"
|
||||
t.boolean "include_registrations_in_splash", default: false
|
||||
t.boolean "include_sponsors_in_splash", default: false
|
||||
t.boolean "include_tracks_in_splash", default: false
|
||||
t.boolean "include_tickets_in_splash", default: false
|
||||
t.boolean "include_program_in_splash", default: false
|
||||
t.boolean "make_conference_public", default: false
|
||||
t.string "banner_photo_file_name"
|
||||
t.string "banner_photo_content_type"
|
||||
t.integer "banner_photo_file_size"
|
||||
t.datetime "banner_photo_updated_at"
|
||||
t.boolean "include_banner_in_splash", default: false
|
||||
t.text "events_per_week"
|
||||
end
|
||||
|
||||
|
|
@ -136,7 +121,6 @@ ActiveRecord::Schema.define(version: 20140821103643) do
|
|||
t.string "googleplus"
|
||||
t.string "twitter"
|
||||
t.string "instagram"
|
||||
t.boolean "public"
|
||||
t.integer "conference_id"
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
|
|
@ -332,7 +316,6 @@ ActiveRecord::Schema.define(version: 20140821103643) do
|
|||
t.integer "conference_id"
|
||||
t.date "start_date"
|
||||
t.date "end_date"
|
||||
t.text "description"
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
end
|
||||
|
|
@ -400,6 +383,31 @@ ActiveRecord::Schema.define(version: 20140821103643) do
|
|||
t.date "date"
|
||||
end
|
||||
|
||||
create_table "splashpages", force: true do |t|
|
||||
t.integer "conference_id"
|
||||
t.boolean "public"
|
||||
t.boolean "include_tracks"
|
||||
t.boolean "include_program"
|
||||
t.boolean "include_social_media"
|
||||
t.boolean "include_banner"
|
||||
t.boolean "include_venue"
|
||||
t.boolean "include_tickets"
|
||||
t.text "ticket_description"
|
||||
t.boolean "include_registrations"
|
||||
t.text "registration_description"
|
||||
t.boolean "include_sponsors"
|
||||
t.text "sponsor_description"
|
||||
t.boolean "include_lodgings"
|
||||
t.text "lodging_description"
|
||||
t.text "banner_description"
|
||||
t.string "banner_photo_file_name"
|
||||
t.string "banner_photo_content_type"
|
||||
t.integer "banner_photo_file_size"
|
||||
t.datetime "banner_photo_updated_at"
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
end
|
||||
|
||||
create_table "sponsors", force: true do |t|
|
||||
t.string "name"
|
||||
t.text "description"
|
||||
|
|
@ -529,8 +537,6 @@ ActiveRecord::Schema.define(version: 20140821103643) do
|
|||
t.string "photo_content_type"
|
||||
t.integer "photo_file_size"
|
||||
t.datetime "photo_updated_at"
|
||||
t.boolean "include_venue_in_splash", default: false
|
||||
t.boolean "include_lodgings_in_splash", default: false
|
||||
end
|
||||
|
||||
create_table "versions", force: true do |t|
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue