diff --git a/app/controllers/conference_registration_controller.rb b/app/controllers/conference_registration_controller.rb index 0d3e45f6..4e692022 100644 --- a/app/controllers/conference_registration_controller.rb +++ b/app/controllers/conference_registration_controller.rb @@ -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.") diff --git a/app/models/event.rb b/app/models/event.rb index ff7369ee..2760e7ae 100644 --- a/app/models/event.rb +++ b/app/models/event.rb @@ -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 @@ -10,6 +10,8 @@ class Event < ActiveRecord::Base has_many :people, :through => :event_people 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 diff --git a/app/models/registration.rb b/app/models/registration.rb index 9f09da59..ca0c5f67 100644 --- a/app/models/registration.rb +++ b/app/models/registration.rb @@ -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 diff --git a/app/views/conference_registration/register.html.haml b/app/views/conference_registration/register.html.haml index f8ab2ae8..0304c80c 100644 --- a/app/views/conference_registration/register.html.haml +++ b/app/views/conference_registration/register.html.haml @@ -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" } diff --git a/app/views/proposal/_proposal_form.html.haml b/app/views/proposal/_proposal_form.html.haml index 501f6e94..c02a9fdc 100644 --- a/app/views/proposal/_proposal_form.html.haml +++ b/app/views/proposal/_proposal_form.html.haml @@ -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 diff --git a/db/migrate/20130711043459_create_events_registrations_table.rb b/db/migrate/20130711043459_create_events_registrations_table.rb new file mode 100644 index 00000000..3238c571 --- /dev/null +++ b/db/migrate/20130711043459_create_events_registrations_table.rb @@ -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 diff --git a/db/migrate/20130711044247_add_require_registration_to_events.rb b/db/migrate/20130711044247_add_require_registration_to_events.rb new file mode 100644 index 00000000..c89d042d --- /dev/null +++ b/db/migrate/20130711044247_add_require_registration_to_events.rb @@ -0,0 +1,5 @@ +class AddRequireRegistrationToEvents < ActiveRecord::Migration + def change + add_column :events, :require_registration, :boolean + end +end