mirror of
https://github.com/openSUSE/osem.git
synced 2026-01-24 05:48:40 -05:00
Adding social events, which can be used on the registration page
This commit is contained in:
18
app/controllers/admin/social_events_controller.rb
Normal file
18
app/controllers/admin/social_events_controller.rb
Normal file
@@ -0,0 +1,18 @@
|
||||
class Admin::SocialEventsController < ApplicationController
|
||||
before_filter :verify_organizer
|
||||
layout "admin"
|
||||
|
||||
def show
|
||||
render :social_events_list
|
||||
end
|
||||
|
||||
def update
|
||||
if @conference.update_attributes(params[:conference])
|
||||
redirect_to(admin_conference_social_events_path(:conference_id => @conference.short_title), :notice => 'Social events were successfully updated.')
|
||||
else
|
||||
redirect_to(admin_conference_social_events_path(:conference_id => @conference.short_title), :notice => 'Social events update failed.')
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
@@ -1,13 +1,14 @@
|
||||
class Conference < ActiveRecord::Base
|
||||
attr_accessible :title, :short_title, :social_tag, :contact_email, :timezone, :html_export_path,
|
||||
:start_date, :end_date, :rooms_attributes, :tracks_attributes, :dietary_choices_attributes,
|
||||
:use_dietary_choices, :use_supporter_levels, :supporter_levels_attributes,
|
||||
:use_dietary_choices, :use_supporter_levels, :supporter_levels_attributes, :social_events_attributes,
|
||||
:event_types_attributes, :registration_start_date, :registration_end_date, :logo
|
||||
|
||||
has_paper_trail
|
||||
|
||||
has_one :email_settings, :dependent => :destroy
|
||||
has_one :call_for_papers, :dependent => :destroy
|
||||
has_many :social_events, :dependent => :destroy
|
||||
has_many :supporter_registrations, :dependent => :destroy
|
||||
has_many :supporter_levels, :dependent => :destroy
|
||||
has_many :dietary_choices, :dependent => :destroy
|
||||
@@ -21,6 +22,7 @@ class Conference < ActiveRecord::Base
|
||||
|
||||
accepts_nested_attributes_for :rooms, :reject_if => proc {|r| r["name"].blank?}, :allow_destroy => true
|
||||
accepts_nested_attributes_for :tracks, :reject_if => proc {|r| r["name"].blank?}, :allow_destroy => true
|
||||
accepts_nested_attributes_for :social_events, :allow_destroy => true
|
||||
accepts_nested_attributes_for :venue
|
||||
accepts_nested_attributes_for :dietary_choices, :allow_destroy => true
|
||||
accepts_nested_attributes_for :supporter_levels, :allow_destroy => true
|
||||
|
||||
@@ -4,11 +4,13 @@ class Registration < ActiveRecord::Base
|
||||
belongs_to :dietary_choice
|
||||
|
||||
has_one :supporter_registration
|
||||
has_and_belongs_to_many :social_events
|
||||
|
||||
attr_accessible :person_id, :conference_id, :attending_social_events, :attending_with_partner,
|
||||
:using_affiliated_lodging, :arrival, :departure, :person_attributes, :other_dietary_choice, :dietary_choice_id,
|
||||
:handicapped_access_required, :supporter_registration_attributes
|
||||
:handicapped_access_required, :supporter_registration_attributes, :social_event_ids, :other_special_needs
|
||||
|
||||
accepts_nested_attributes_for :person
|
||||
accepts_nested_attributes_for :supporter_registration
|
||||
accepts_nested_attributes_for :social_events
|
||||
end
|
||||
6
app/models/social_event.rb
Normal file
6
app/models/social_event.rb
Normal file
@@ -0,0 +1,6 @@
|
||||
class SocialEvent < ActiveRecord::Base
|
||||
attr_accessible :title, :description, :date
|
||||
|
||||
belongs_to :conference
|
||||
has_and_belongs_to_many :registrations
|
||||
end
|
||||
@@ -28,6 +28,10 @@
|
||||
%li.active= link_to "Event Types", "#"
|
||||
- else
|
||||
%li= link_to "Event Types", admin_conference_eventtype_list_path(@conference.short_title)
|
||||
- if activated == "Social Events"
|
||||
%li.active= link_to "Social Events", "#"
|
||||
- else
|
||||
%li= link_to "Social Events", admin_conference_social_events_path(@conference.short_title)
|
||||
- if activated == "Emails"
|
||||
%li.active= link_to "Emails", "#"
|
||||
- else
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
<div class="nested-fields">
|
||||
<%= f.inputs do %>
|
||||
<%= f.input :title %>
|
||||
<%= f.input :description, :input_html => {:rows => 5} %>
|
||||
<%= remove_association_link :social_event, f %>
|
||||
<% end %>
|
||||
</div>
|
||||
@@ -0,0 +1,8 @@
|
||||
.container-fluid
|
||||
.row-fluid
|
||||
.span3
|
||||
= render 'admin/conference/sidebar', :activated => "Social Events"
|
||||
.span9
|
||||
= semantic_form_for(@conference, :url => admin_conference_social_events_path(@conference.short_title)) do |f|
|
||||
= dynamic_association :social_events, "Social Events", f
|
||||
= f.action :submit, :as => :button, :button_html => {:class => "btn btn-primary"}
|
||||
@@ -12,14 +12,20 @@
|
||||
.row-fluid
|
||||
.span12
|
||||
= semantic_form_for(@registration, :url => register_conference_path(@conference.short_title), :html => { :method => :put }) do |f|
|
||||
Public Name
|
||||
%br
|
||||
= f.fields_for :person do |p|
|
||||
= p.text_field :public_name, :for => :person
|
||||
= f.input :attending_with_partner, :label => false
|
||||
= f.input :attending_social_events, :label => false
|
||||
-# = f.input :attending_social_events, :label => false
|
||||
= f.input :using_affiliated_lodging, :label => false
|
||||
= f.input :handicapped_access_required, :label => false
|
||||
= f.input :other_special_needs, :label => "Any other special needs?", :input_html => {:rows => 2}
|
||||
= f.input :arrival, :as => :string, :input_html => {:value => (f.object.arrival.to_formatted_s(:db_without_seconds) unless f.object.arrival.nil?), :id => "registration-arrival-datepicker", :readonly => "readonly" }
|
||||
= f.input :departure, :as => :string, :input_html => {:value => (f.object.departure.to_formatted_s(:db_without_seconds) unless f.object.arrival.nil?), :id => "registration-departure-datepicker", :readonly => "readonly" }
|
||||
= f.input :departure, :as => :string, :input_html => {:value => (f.object.departure.to_formatted_s(:db_without_seconds) unless f.object.departure.nil?), :id => "registration-departure-datepicker", :readonly => "readonly" }
|
||||
- if @conference.social_events.count > 0
|
||||
Do you plan on attending any of the parties?
|
||||
= f.input :social_events, :as => :check_boxes, :label => false
|
||||
- if @conference.use_dietary_choices?
|
||||
= f.input :dietary_choice, :collection => [["None", nil]] + @conference.dietary_choices.map {|x| [x.title, x.id]},
|
||||
:include_blank => false, :label => "Special Dietary Restriction"
|
||||
|
||||
@@ -15,6 +15,8 @@ Osem::Application.routes.draw do
|
||||
put "/supporter_levels" => "SupporterLevels#update"
|
||||
get "/venue" => "venue#show", :as => "venue_info"
|
||||
put "/venue" => "venue#update", :as => "venue_update"
|
||||
get "/social_events" => "SocialEvents#show", :as => "social_events"
|
||||
put "/social_events" => "SocialEvents#update", :as => "social_events"
|
||||
get "/rooms" => "rooms#show", :as => "rooms_list"
|
||||
put "/rooms" => "rooms#update", :as => "rooms_update"
|
||||
get "/tracks" => "tracks#show", :as => "tracks_list"
|
||||
|
||||
14
db/migrate/20130216070725_create_social_events_table.rb
Normal file
14
db/migrate/20130216070725_create_social_events_table.rb
Normal file
@@ -0,0 +1,14 @@
|
||||
class CreateSocialEventsTable < ActiveRecord::Migration
|
||||
def up
|
||||
create_table :social_events do |t|
|
||||
t.references :conference
|
||||
t.string :title
|
||||
t.text :description
|
||||
t.date :date
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
drop_table :social_events
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,11 @@
|
||||
class CreateRegistrationsSocialEventsTable < ActiveRecord::Migration
|
||||
def up
|
||||
create_table :registrations_social_events, :id => false do |t|
|
||||
t.references :registration, :social_event
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
drop_table :registrations_social_events
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,8 @@
|
||||
class SetRegistrationDefaultsToFalse < ActiveRecord::Migration
|
||||
def up
|
||||
change_column :registrations, :using_affiliated_lodging, :boolean, :default => false
|
||||
end
|
||||
|
||||
def down
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,5 @@
|
||||
class AddSpecialNeedsFieldToRegistrations < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :registrations, :other_special_needs, :text
|
||||
end
|
||||
end
|
||||
17
db/schema.rb
17
db/schema.rb
@@ -11,7 +11,7 @@
|
||||
#
|
||||
# It's strongly recommended to check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(:version => 20130211170728) do
|
||||
ActiveRecord::Schema.define(:version => 20130216122417) do
|
||||
|
||||
create_table "call_for_papers", :force => true do |t|
|
||||
t.date "start_date", :null => false
|
||||
@@ -168,7 +168,7 @@ ActiveRecord::Schema.define(:version => 20130211170728) do
|
||||
t.integer "conference_id"
|
||||
t.boolean "attending_social_events", :default => true
|
||||
t.boolean "attending_with_partner", :default => false
|
||||
t.boolean "using_affiliated_lodging", :default => true
|
||||
t.boolean "using_affiliated_lodging", :default => false
|
||||
t.datetime "arrival"
|
||||
t.datetime "departure"
|
||||
t.text "additional_speakers"
|
||||
@@ -177,6 +177,12 @@ ActiveRecord::Schema.define(:version => 20130211170728) do
|
||||
t.integer "dietary_choice_id"
|
||||
t.text "other_dietary_choice"
|
||||
t.boolean "handicapped_access_required", :default => false
|
||||
t.text "other_special_needs"
|
||||
end
|
||||
|
||||
create_table "registrations_social_events", :id => false, :force => true do |t|
|
||||
t.integer "registration_id"
|
||||
t.integer "social_event_id"
|
||||
end
|
||||
|
||||
create_table "roles", :force => true do |t|
|
||||
@@ -198,6 +204,13 @@ ActiveRecord::Schema.define(:version => 20130211170728) do
|
||||
t.boolean "public", :default => true
|
||||
end
|
||||
|
||||
create_table "social_events", :force => true do |t|
|
||||
t.integer "conference_id"
|
||||
t.string "title"
|
||||
t.text "description"
|
||||
t.date "date"
|
||||
end
|
||||
|
||||
create_table "supporter_levels", :force => true do |t|
|
||||
t.integer "conference_id"
|
||||
t.string "title", :null => false
|
||||
|
||||
Reference in New Issue
Block a user