Added paper_trail, also starting work on the scheduler

This commit is contained in:
Matt Barringer 2013-01-07 16:45:48 +01:00
parent 90b30db9e8
commit f86232bedf
35 changed files with 523 additions and 32137 deletions

View file

@ -1,7 +1,9 @@
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, :cfp_open, :registration_open,
:event_types_attributes
:start_date, :end_date, :rooms_attributes, :tracks_attributes,
:event_types_attributes, :registration_start_date, :registration_end_date
has_paper_trail
has_one :call_for_papers, :dependent => :destroy
has_many :events, :dependent => :destroy
@ -61,6 +63,15 @@ class Conference < ActiveRecord::Base
end
end
def registration_open?
today = Date.current
if self.registration_start_date.nil? || self.registration_end_date.nil?
false
end
(registration_start_date..registration_end_date).cover?(today)
end
def cfp_open?
today = Date.current
cfp = self.call_for_papers

View file

@ -1,6 +1,6 @@
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
acts_as_commentable

View file

@ -1,4 +1,6 @@
class EventAttachment < ActiveRecord::Base
has_paper_trail
belongs_to :event
scope :public, where(:public => true)
attr_accessible :public, :attachment, :event_id, :title

View file

@ -32,8 +32,9 @@ class Person < ActiveRecord::Base
:person_id => self.id).count
end
def proposals conference
self.events.where("conference_id = ? AND state != ? AND state != ?", conference.id, "withdrawn", "rejected")
self.events.where("conference_id = ? AND state != ? AND state != ? AND event_people.event_role=?", conference.id, "withdrawn", "rejected", "submitter")
end
def proposal_count conference
@ -48,6 +49,10 @@ class Person < ActiveRecord::Base
end
end
def self.find_person_by_user_id user_id
Person.where(:user_id => user_id).first
end
private
def biography_limit
if self.biography.split.size > 150