Registration alerts modified for splash

This commit is contained in:
Gopesh Tulsyan 2014-05-30 13:06:10 +05:30
parent 4d9f34c3cf
commit 0d3b0cfe2c
2 changed files with 16 additions and 5 deletions

View file

@ -100,13 +100,21 @@ class Conference < ActiveRecord::Base
# * +false+ -> If the conference dates are not set or today isn't in the
# registration period.
# * +true+ -> If today is in the registration period.
def registration_open?
today = Date.current
def registration_dates_given?
if self.registration_start_date.blank? || self.registration_end_date.blank?
false
else
true
end
end
(registration_start_date..registration_end_date).cover?(today)
def registration_open?
today = Date.current
if registration_dates_given?
(registration_start_date..registration_end_date).cover?(today)
else
false
end
end
##

View file

@ -7,8 +7,11 @@
- if !@conference.registration_description.blank?
%p
= @conference.registration_description
- if @conference.registration_open?
%h4 Registration period #{ date_string(@conference.registration_start_date, @conference.registration_end_date) }
- if @conference.registration_dates_given?
-if @conference.registration_end_date > Date.today
%h4 Registration period #{ date_string(@conference.registration_start_date, @conference.registration_end_date) }
-else
%h4 Registration is Closed, it was from #{ date_string(@conference.registration_start_date, @conference.registration_end_date) }
- if @conference.registration_open?
= link_to "Register for #{@conference.short_title}", register_conference_path(@conference.short_title), :class =>"btn btn-success btn-lg", target: '_blank'
- if @conference.use_supporter_levels?