diff --git a/app/models/conference.rb b/app/models/conference.rb index b1ee2b32..5f888ea6 100644 --- a/app/models/conference.rb +++ b/app/models/conference.rb @@ -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 ## diff --git a/app/views/conference/_registration.html.haml b/app/views/conference/_registration.html.haml index 23973993..b0b75011 100644 --- a/app/views/conference/_registration.html.haml +++ b/app/views/conference/_registration.html.haml @@ -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?