Merge pull request #708 from raluka/remaining_days

Issue #649: Wrong days remaining label when submitting a new proposal
This commit is contained in:
Christian Bruckmayer 2015-08-28 13:27:42 +02:00
commit 244ea9d34a
4 changed files with 23 additions and 18 deletions

View file

@ -63,6 +63,11 @@ class CallForPaper < ActiveRecord::Base
&& !self.conference.email_settings.call_for_papers_dates_updates_template.blank?
end
def remaining_days(date = Date.today)
result = (self.end_date - date).to_i
result > 0 ? result : 0
end
private
def before_end_of_conference

View file

@ -19,8 +19,7 @@
%dt
Days Left:
%dd
- days = (@call_for_paper.end_date - Date.today).to_i
= pluralize(days, 'days')
= pluralize(@call_for_paper.remaining_days, 'day')
%dt
Event types:
%dd

View file

@ -25,14 +25,15 @@
and closes
%em
= @conference.call_for_paper.end_date.strftime('%A, %B %-d. %Y.')
That means you have only
- days = (@conference.call_for_paper.end_date - Date.today).to_i
%b
= pluralize(days, 'days')
- if @conference.cfp_open?
That means you have only
%b= pluralize(@conference.call_for_paper.remaining_days, 'day')
left!
Remember
= @conference.short_title
will only be as good as the sessions you present. Submit early, submit often!
Remember
= @conference.short_title
will only be as good as the sessions you present. Submit early, submit often!
- else
The submission period is closed.
.row
.col-md-12.text-center
%p.cta-button

View file

@ -6,18 +6,18 @@
Proposals should fit in one of the
= "#{pluralize(@conference.tracks.count, 'track')}:"
= "#{tracks(@conference)}."
- if @conference.call_for_paper
- if @conference.cfp_open?
The submission period has begun
%em
= @conference.call_for_paper.start_date.strftime('%A, %B %-d. %Y')
and closes
%em
= @conference.call_for_paper.end_date.strftime('%A, %B %-d. %Y.')
That means you have only
- days = (@conference.call_for_paper.end_date - Date.today).to_i
%b
= pluralize(days, 'days')
left!
Remember
= @conference.title
will only be as good as the content you present. Submit early, submit often!
That means you have
%b= pluralize(@conference.call_for_paper.remaining_days, 'day')
left!
Remember
= @conference.title
will only be as good as the content you present. Submit early, submit often!
-else
The submission period is closed now.