Merge fae5981dc4 into a95a03c7e5
This commit is contained in:
commit
c321af6fb4
4 changed files with 24 additions and 7 deletions
|
|
@ -102,11 +102,24 @@ 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
|
||||
|
||||
(registration_start_date..registration_end_date).cover?(today)
|
||||
end
|
||||
##
|
||||
# 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 self.registration_start_date.blank? || self.registration_end_date.blank?
|
||||
false
|
||||
else
|
||||
true
|
||||
end
|
||||
end
|
||||
|
||||
##
|
||||
|
|
|
|||
|
|
@ -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?
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
= content_for :brand do
|
||||
= link_to @conference.title, conference_url(@conference.short_title), class: 'navbar-brand'
|
||||
|
||||
%div#program
|
||||
= render 'program'
|
||||
%div#registration
|
||||
= render 'registration'
|
||||
%div#callforpapers
|
||||
= render 'call_for_papers'
|
||||
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ describe 'conference/show.html.haml' do
|
|||
end
|
||||
|
||||
it 'renders program partial' do
|
||||
expect(render).to include("#{@conference.description}")
|
||||
expect(rendered).to include("#{@conference.description}")
|
||||
expect(view).to render_template(partial: 'conference/_program')
|
||||
end
|
||||
|
||||
|
|
@ -21,6 +21,6 @@ describe 'conference/show.html.haml' do
|
|||
end
|
||||
|
||||
it 'renders call_for_papers partial' do
|
||||
expect(render).to include("#{@conference.call_for_papers.description}")
|
||||
expect(rendered).to include("#{@conference.call_for_papers.description}")
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue