Merge branch 'final_questions' of https://github.com/differentreality/osem into differentreality-final_questions

Conflicts:
	app/models/conference.rb
	config/routes.rb
This commit is contained in:
Henne Vogelsang 2014-03-03 10:43:38 +01:00
commit 243ea41456
28 changed files with 342 additions and 16 deletions

8
app/models/answer.rb Normal file
View file

@ -0,0 +1,8 @@
class Answer < ActiveRecord::Base
attr_accessible :title
has_many :qanswers
has_many :questions, :through => :qanswers
validates :title, :presence => true
end

View file

@ -2,10 +2,12 @@ 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, :social_events_attributes,
:event_types_attributes, :difficulty_levels_attributes, :use_difficulty_levels, :registration_start_date, :registration_end_date, :logo
:event_types_attributes, :registration_start_date, :registration_end_date, :logo, :questions_attributes, :question_ids, :answers_attributes, :answer_ids, :difficulty_levels_attributes, :use_difficulty_levels
has_paper_trail
has_and_belongs_to_many :questions
has_one :email_settings, :dependent => :destroy
has_one :call_for_papers, :dependent => :destroy
has_many :social_events, :dependent => :destroy
@ -30,6 +32,7 @@ class Conference < ActiveRecord::Base
accepts_nested_attributes_for :supporter_levels, :allow_destroy => true
accepts_nested_attributes_for :event_types, :allow_destroy => true
accepts_nested_attributes_for :email_settings
accepts_nested_attributes_for :questions, :allow_destroy => true
has_attached_file :logo,
:styles => {:thumb => "100x100>", :large => "300x300>" }
@ -119,4 +122,4 @@ class Conference < ActiveRecord::Base
self.guid = guid
end
end
end

8
app/models/qanswer.rb Normal file
View file

@ -0,0 +1,8 @@
class Qanswer < ActiveRecord::Base
attr_accessible :question_id, :answer_id
belongs_to :question
belongs_to :answer, :dependent => :delete
has_and_belongs_to_many :registrations
end

14
app/models/question.rb Normal file
View file

@ -0,0 +1,14 @@
class Question < ActiveRecord::Base
attr_accessible :title, :global, :answers_attributes, :answer_ids, :question_type_id
belongs_to :question_type
has_and_belongs_to_many :conferences
has_many :qanswers, :dependent => :delete_all
has_many :answers, :through => :qanswers, :dependent => :delete_all
validates :title, :presence => true
validates :answers, :presence => true
accepts_nested_attributes_for :answers, :allow_destroy => true
end

View file

@ -0,0 +1,5 @@
class QuestionType < ActiveRecord::Base
attr_accessible :title, :description
has_many :questions
end

View file

@ -7,15 +7,16 @@ class Registration < ActiveRecord::Base
has_one :supporter_level, :through => :supporter_registration
has_and_belongs_to_many :social_events
has_and_belongs_to_many :events
has_and_belongs_to_many :qanswers
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,
:event_ids, :attended
:handicapped_access_required, :supporter_registration_attributes, :social_event_ids, :other_special_needs, :event_ids, :attended, :qanswer_ids, :qanswers_attributes
accepts_nested_attributes_for :person
accepts_nested_attributes_for :supporter_registration
accepts_nested_attributes_for :social_events
accepts_nested_attributes_for :qanswers
delegate :first_name, :to => :person
delegate :last_name, :to => :person
@ -24,7 +25,5 @@ class Registration < ActiveRecord::Base
delegate :irc_nickname, :to => :person
delegate :company, :to => :person
alias_attribute :with_partner, :attending_with_partner
alias_attribute :need_access, :handicapped_access_required
alias_attribute :other_needs, :other_special_needs
end