Merge pull request #199 from gopesht/fix_registration_component
Fix registration component
This commit is contained in:
commit
59ef642bc4
3 changed files with 22 additions and 4 deletions
|
|
@ -102,11 +102,25 @@ class Conference < ActiveRecord::Base
|
||||||
# * +true+ -> If today is in the registration period.
|
# * +true+ -> If today is in the registration period.
|
||||||
def registration_open?
|
def registration_open?
|
||||||
today = Date.current
|
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
|
false
|
||||||
end
|
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
|
end
|
||||||
|
|
||||||
##
|
##
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,11 @@
|
||||||
- if !@conference.registration_description.blank?
|
- if !@conference.registration_description.blank?
|
||||||
%p
|
%p
|
||||||
= @conference.registration_description
|
= @conference.registration_description
|
||||||
|
- 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) }
|
%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?
|
- 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'
|
= 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?
|
- if @conference.use_supporter_levels?
|
||||||
|
|
|
||||||
|
|
@ -71,7 +71,7 @@ feature Conference do
|
||||||
set("#{Date.today.strftime('%B')}")
|
set("#{Date.today.strftime('%B')}")
|
||||||
page.
|
page.
|
||||||
find('div.nested-fields:nth-of-type(1) select:nth-of-type(3)').
|
find('div.nested-fields:nth-of-type(1) select:nth-of-type(3)').
|
||||||
set("#{Date.today.strftime('%d')}")
|
set("#{Date.today.strftime('%-d')}")
|
||||||
page.
|
page.
|
||||||
find('div.nested-fields:nth-of-type(1) div:nth-of-type(1) textarea').
|
find('div.nested-fields:nth-of-type(1) div:nth-of-type(1) textarea').
|
||||||
set('Example Person')
|
set('Example Person')
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue