Merge pull request #199 from gopesht/fix_registration_component

Fix registration component
This commit is contained in:
James Mason 2014-06-05 07:39:21 -07:00
commit 59ef642bc4
3 changed files with 22 additions and 4 deletions

View file

@ -102,11 +102,25 @@ class Conference < ActiveRecord::Base
# * +true+ -> If today is in the registration period.
def registration_open?
today = Date.current
if self.registration_start_date.blank? || self.registration_end_date.blank?
if registration_dates_given?
(registration_start_date..registration_end_date).cover?(today)
else
false
end
end
(registration_start_date..registration_end_date).cover?(today)
##
# Checks if the registration dates for the conference are provided
#
# ====Returns
# * +false+ -> If the conference registration dates are not set
# * +true+ -> If conference registration dates are set
def registration_dates_given?
if registration_start_date.blank? || registration_end_date.blank?
false
else
true
end
end
##

View file

@ -7,7 +7,11 @@
- if !@conference.registration_description.blank?
%p
= @conference.registration_description
%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?

View file

@ -71,7 +71,7 @@ feature Conference do
set("#{Date.today.strftime('%B')}")
page.
find('div.nested-fields:nth-of-type(1) select:nth-of-type(3)').
set("#{Date.today.strftime('%d')}")
set("#{Date.today.strftime('%-d')}")
page.
find('div.nested-fields:nth-of-type(1) div:nth-of-type(1) textarea').
set('Example Person')