Merge pull request #13 from differentreality/event_registration

Event registration
This commit is contained in:
Henne Vogelsang 2013-07-11 02:47:32 -07:00
commit 00af4e0aee
7 changed files with 29 additions and 2 deletions

View file

@ -4,6 +4,7 @@ class ConferenceRegistrationController < ApplicationController
def register
# TODO Figure out how to change the route's id from :id to :conference_id
@conference = Conference.find_all_by_short_title(params[:id]).first
@workshops = @conference.events.where("require_registration = ? AND state LIKE ?", true, 'confirmed')
@person = current_user.person
if @person.first_name.blank? || @person.last_name.blank?
redirect_to(edit_user_registration_path, :alert => "Please fill in your first and last name before registering.")

View file

@ -2,7 +2,7 @@ class Event < ActiveRecord::Base
include ActiveRecord::Transitions
has_paper_trail
attr_accessible :title, :subtitle, :abstract, :description, :event_type_id, :people_attributes, :person,
:proposal_additional_speakers, :track_id, :video_id, :video_type
:proposal_additional_speakers, :track_id, :video_id, :video_type, :require_registration
acts_as_commentable
has_many :event_people, :dependent => :destroy
@ -11,6 +11,8 @@ class Event < ActiveRecord::Base
has_many :speakers, :through => :event_people, :source => :person, :conditions => {"event_people.event_role" => "speaker"}
belongs_to :event_type
has_and_belongs_to_many :registrations
belongs_to :track
belongs_to :room
belongs_to :conference

View file

@ -5,10 +5,12 @@ class Registration < ActiveRecord::Base
has_one :supporter_registration
has_and_belongs_to_many :social_events
has_and_belongs_to_many :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, :social_event_ids, :other_special_needs
:handicapped_access_required, :supporter_registration_attributes, :social_event_ids, :other_special_needs,
:event_ids
accepts_nested_attributes_for :person
accepts_nested_attributes_for :supporter_registration

View file

@ -26,6 +26,11 @@
= 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}
- if @workshops.count > 0
=f.inputs "Register to workshops" do
= f.input :events, :as => :check_boxes, :label => false, :collection => @workshops
= f.inputs "Travel Info" do
= 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.departure.nil?), :id => "registration-departure-datepicker", :readonly => "readonly" }

View file

@ -6,6 +6,7 @@
%section#details
- unless @event.state === "unconfirmed" || @event.state === "confirmed"
= f.input :event_type_id,:as => :select, :collection => @event_types, :include_blank => false, :label => "Session Type"
= f.input :require_registration
= f.input :abstract, :input_html => {:rows => 5, :class => "span11"},
:required => true, :label => "Session Abstract"
You have used

View file

@ -0,0 +1,11 @@
class CreateEventsRegistrationsTable < ActiveRecord::Migration
def up
create_table :events_registrations, :id => false do |t|
t.references :registration, :event
end
end
def down
drop_table :events_registrations
end
end

View file

@ -0,0 +1,5 @@
class AddRequireRegistrationToEvents < ActiveRecord::Migration
def change
add_column :events, :require_registration, :boolean
end
end