views for call for booths
This commit is contained in:
parent
60ec569553
commit
5734c90d1e
9 changed files with 61 additions and 115 deletions
|
|
@ -3,6 +3,7 @@ class Booth < ActiveRecord::Base
|
|||
|
||||
belongs_to :conference
|
||||
has_many :booth_requests
|
||||
has_one :call_for_booths
|
||||
has_many :users, through: :booth_requests
|
||||
|
||||
has_one :submitter_booth_user, -> { where(role: 'submitter') }, class_name: 'BoothRequest'
|
||||
|
|
@ -21,11 +22,7 @@ class Booth < ActiveRecord::Base
|
|||
:conference_id,
|
||||
presence: true
|
||||
|
||||
validate :logo_link
|
||||
|
||||
include Gravtastic
|
||||
gravtastic size: 32
|
||||
|
||||
state_machine initial: :submitted do
|
||||
state :submitted
|
||||
state :withdrawn
|
||||
|
|
@ -67,4 +64,5 @@ class Booth < ActiveRecord::Base
|
|||
end
|
||||
alert
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,10 +1,16 @@
|
|||
class CallForBooth < ActiveRecord::Base
|
||||
belongs_to :conference
|
||||
|
||||
has_many :booths
|
||||
|
||||
validates :start_date, :end_date, :booth_limit, presence: true
|
||||
validate :before_end_of_conference
|
||||
validate :start_date_before_end_date
|
||||
|
||||
def remaining_days(date = Date.today)
|
||||
end_date - date > 0 ? (end_date - date) : 0
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def before_end_of_conference
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue