mirror of
https://github.com/openSUSE/osem.git
synced 2026-08-13 19:54:02 +00:00
parent
a620950383
commit
ed55e2bf3a
25 changed files with 529 additions and 131 deletions
|
|
@ -7,12 +7,12 @@ $(function () {
|
|||
pickTime: false,
|
||||
format: "YYYY-MM-DD"
|
||||
});
|
||||
$("#conference-reg-start-datepicker").datetimepicker({
|
||||
$("#registration-period-start-datepicker").datetimepicker({
|
||||
format: "YYYY-MM-DD",
|
||||
pickTime: false,
|
||||
pickSeconds: false
|
||||
});
|
||||
$("#conference-reg-end-datepicker").datetimepicker({
|
||||
$("#registration-period-end-datepicker").datetimepicker({
|
||||
format: "YYYY-MM-DD",
|
||||
pickTime: false,
|
||||
pickSeconds: false
|
||||
|
|
|
|||
|
|
@ -73,7 +73,6 @@ $(function () {
|
|||
$('#' + $(this).data('name')).toggle();
|
||||
});
|
||||
|
||||
|
||||
$(".comment-reply-link").click(function(){
|
||||
$(".comment-reply", $(this).parent()).toggle();
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -80,12 +80,10 @@ module Admin
|
|||
@conference = Conference.find_by(short_title: params[:id])
|
||||
short_title = @conference.short_title
|
||||
@conference.assign_attributes(params[:conference])
|
||||
send_mail_on_conf_update = @conference.notify_on_dates_change?
|
||||
send_mail_on_reg_update = @conference.notify_on_registration_dates_changed?
|
||||
send_mail_on_conf_update = @conference.notify_on_dates_changed?
|
||||
|
||||
if @conference.update_attributes(params[:conference])
|
||||
Mailbot.delay.conference_date_update_mail(@conference) if send_mail_on_conf_update
|
||||
Mailbot.delay.conference_registration_date_update_mail(@conference) if send_mail_on_reg_update
|
||||
redirect_to(edit_admin_conference_path(id: @conference.short_title),
|
||||
notice: 'Conference was successfully updated.')
|
||||
else
|
||||
|
|
|
|||
57
app/controllers/admin/registration_periods_controller.rb
Normal file
57
app/controllers/admin/registration_periods_controller.rb
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
module Admin
|
||||
class RegistrationPeriodsController < ApplicationController
|
||||
load_and_authorize_resource :conference, find_by: :short_title
|
||||
load_and_authorize_resource through: :conference, singleton: true
|
||||
|
||||
def new
|
||||
@registration_period = @conference.build_registration_period
|
||||
end
|
||||
|
||||
def create
|
||||
@registration_period = @conference.build_registration_period(registration_period)
|
||||
send_mail_on_reg_update = @conference.notify_on_registration_dates_changed?
|
||||
|
||||
if @registration_period.save
|
||||
Mailbot.delay.conference_registration_date_update_mail(@conference) if send_mail_on_reg_update
|
||||
redirect_to admin_conference_registration_period_path(@conference.short_title),
|
||||
notice: 'Registration Period successfully updated.'
|
||||
else
|
||||
flash[:alert] = "A error prohibited the Registration Period from being saved: #{@registration_period.errors.full_messages.join('. ')}."
|
||||
render :new
|
||||
end
|
||||
end
|
||||
|
||||
def edit
|
||||
end
|
||||
|
||||
def show
|
||||
end
|
||||
|
||||
def update
|
||||
@registration_period.assign_attributes(registration_period)
|
||||
send_mail_on_reg_update = @conference.notify_on_registration_dates_changed?
|
||||
|
||||
if @registration_period.update(registration_period)
|
||||
Mailbot.delay.conference_registration_date_update_mail(@conference) if send_mail_on_reg_update
|
||||
redirect_to admin_conference_registration_period_path(@conference.short_title),
|
||||
notice: 'Registration Period successfully updated.'
|
||||
else
|
||||
flash[:alert] = "A error prohibited the Registration Period from being saved: " \
|
||||
"#{@registration_period.errors.full_messages.join('. ')}."
|
||||
render :edit
|
||||
end
|
||||
end
|
||||
|
||||
def destroy
|
||||
@registration_period.destroy
|
||||
redirect_to admin_conference_registration_period_path,
|
||||
notice: 'Registration Period was successfully destroyed.'
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def registration_period
|
||||
params[:registration_period]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -106,6 +106,7 @@ class Ability
|
|||
can :manage, Contact, conference_id: conf_ids_for_organizer
|
||||
can :manage, Campaign, conference_id: conf_ids_for_organizer
|
||||
can :manage, Photo, conference_id: conf_ids_for_organizer
|
||||
can :manage, RegistrationPeriod, conference_id: conf_ids_for_organizer
|
||||
end
|
||||
|
||||
def guest
|
||||
|
|
|
|||
|
|
@ -10,11 +10,11 @@ class Conference < ActiveRecord::Base
|
|||
:start_date, :end_date, :rooms_attributes, :tracks_attributes,
|
||||
:dietary_choices_attributes, :use_dietary_choices, :use_supporter_levels,
|
||||
:supporter_levels_attributes, :social_events_attributes, :event_types_attributes,
|
||||
:registration_start_date, :registration_end_date, :logo, :questions_attributes,
|
||||
:logo, :questions_attributes,
|
||||
:question_ids, :answers_attributes, :answer_ids, :difficulty_levels_attributes,
|
||||
:use_difficulty_levels, :use_vpositions, :use_vdays, :vdays_attributes,
|
||||
:vpositions_attributes, :use_volunteers, :color,
|
||||
:description, :registration_description, :ticket_description,
|
||||
:description, :ticket_description,
|
||||
:sponsorship_levels_attributes, :sponsors_attributes,
|
||||
:sponsor_description, :sponsor_email, :lodging_description,
|
||||
:include_registrations_in_splash, :include_sponsors_in_splash,
|
||||
|
|
@ -29,7 +29,7 @@ class Conference < ActiveRecord::Base
|
|||
has_and_belongs_to_many :questions
|
||||
|
||||
has_one :contact, dependent: :destroy
|
||||
|
||||
has_one :registration_period, dependent: :destroy
|
||||
has_one :email_settings, dependent: :destroy
|
||||
has_one :call_for_papers, dependent: :destroy
|
||||
has_many :social_events, dependent: :destroy
|
||||
|
|
@ -128,8 +128,8 @@ class Conference < ActiveRecord::Base
|
|||
# * +true+ -> If today is in the registration period.
|
||||
def registration_open?
|
||||
today = Date.current
|
||||
if registration_dates_given?
|
||||
(registration_start_date..registration_end_date).cover?(today)
|
||||
if registration_period && registration_dates_given?
|
||||
(registration_period.start_date..registration_period.end_date).cover?(today)
|
||||
else
|
||||
false
|
||||
end
|
||||
|
|
@ -142,7 +142,7 @@ class Conference < ActiveRecord::Base
|
|||
# * +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?
|
||||
if registration_period && (registration_period.start_date.blank? || registration_period.end_date.blank?)
|
||||
false
|
||||
else
|
||||
true
|
||||
|
|
@ -218,8 +218,9 @@ class Conference < ActiveRecord::Base
|
|||
result = []
|
||||
|
||||
if registrations &&
|
||||
registration_start_date &&
|
||||
registration_end_date
|
||||
registration_period &&
|
||||
registration_period.start_date &&
|
||||
registration_period.end_date
|
||||
|
||||
reg = registrations.group(:week).count
|
||||
start_week = get_registration_start_week
|
||||
|
|
@ -237,8 +238,10 @@ class Conference < ActiveRecord::Base
|
|||
def registration_weeks
|
||||
result = 0
|
||||
weeks = 0
|
||||
if registration_start_date && registration_end_date
|
||||
weeks = Date.new(registration_start_date.year, 12, 31).
|
||||
if registration_period &&
|
||||
registration_period.start_date &&
|
||||
registration_period.end_date
|
||||
weeks = Date.new(registration_period.start_date.year, 12, 31).
|
||||
strftime('%W').to_i
|
||||
|
||||
result = get_registration_end_week - get_registration_start_week + 1
|
||||
|
|
@ -265,7 +268,11 @@ class Conference < ActiveRecord::Base
|
|||
# ====Returns
|
||||
# * +Integer+ -> start week
|
||||
def get_registration_start_week
|
||||
registration_start_date.strftime('%W').to_i
|
||||
result = -1
|
||||
if registration_period
|
||||
result = registration_period.start_date.strftime('%W').to_i
|
||||
end
|
||||
result
|
||||
end
|
||||
|
||||
##
|
||||
|
|
@ -274,7 +281,11 @@ class Conference < ActiveRecord::Base
|
|||
# ====Returns
|
||||
# * +Integer+ -> start week
|
||||
def get_registration_end_week
|
||||
registration_end_date.strftime('%W').to_i
|
||||
result = -1
|
||||
if registration_period
|
||||
result = registration_period.end_date.strftime('%W').to_i
|
||||
end
|
||||
result
|
||||
end
|
||||
|
||||
##
|
||||
|
|
@ -430,13 +441,11 @@ class Conference < ActiveRecord::Base
|
|||
# * +ActiveRecord+
|
||||
def self.get_active_conferences_for_dashboard
|
||||
result = Conference.where('start_date > ?', Time.now).
|
||||
select('id, short_title, color, start_date,
|
||||
registration_end_date, registration_start_date')
|
||||
select('id, short_title, color, start_date')
|
||||
|
||||
if result.length == 0
|
||||
result = Conference.
|
||||
select('id, short_title, color, start_date, registration_end_date,
|
||||
registration_start_date').limit(2).
|
||||
select('id, short_title, color, start_date').limit(2).
|
||||
order(start_date: :desc)
|
||||
end
|
||||
result
|
||||
|
|
@ -448,8 +457,7 @@ class Conference < ActiveRecord::Base
|
|||
# ====Returns
|
||||
# * +ActiveRecord+
|
||||
def self.get_conferences_without_active_for_dashboard(active_conferences)
|
||||
result = Conference.select('id, short_title, color, start_date,
|
||||
registration_end_date, registration_start_date').order(start_date: :desc)
|
||||
result = Conference.select('id, short_title, color, start_date').order(start_date: :desc)
|
||||
result - active_conferences
|
||||
end
|
||||
|
||||
|
|
@ -525,11 +533,11 @@ class Conference < ActiveRecord::Base
|
|||
# ====Returns
|
||||
# * +True+ -> If conference is updated and all other parameters are set
|
||||
# * +False+ -> Either conference is not updated or one or more parameter is not set
|
||||
def notify_on_dates_change?
|
||||
(self.start_date_changed? || self.end_date_changed?)\
|
||||
&& self.email_settings.send_on_updated_conference_dates\
|
||||
&& !self.email_settings.updated_conference_dates_subject.blank?\
|
||||
&& self.email_settings.updated_conference_dates_template
|
||||
def notify_on_dates_changed?
|
||||
(self.start_date_changed? || self.end_date_changed?) &&
|
||||
self.email_settings.send_on_updated_conference_dates &&
|
||||
!self.email_settings.updated_conference_dates_subject.blank? &&
|
||||
self.email_settings.updated_conference_dates_template
|
||||
end
|
||||
|
||||
##
|
||||
|
|
@ -539,10 +547,11 @@ class Conference < ActiveRecord::Base
|
|||
# * +True+ -> If registration dates is updated and all other parameters are set
|
||||
# * +False+ -> Either registration date is not updated or one or more parameter is not set
|
||||
def notify_on_registration_dates_changed?
|
||||
(self.registration_start_date_changed? || self.registration_end_date_changed?)\
|
||||
&& self.email_settings.send_on_updated_conference_registration_dates\
|
||||
&& !self.email_settings.updated_conference_registration_dates_subject.blank?\
|
||||
&& self.email_settings.updated_conference_registration_dates_template
|
||||
registration_period &&
|
||||
(registration_period.start_date_changed? || registration_period.end_date_changed?) &&
|
||||
email_settings.send_on_updated_conference_registration_dates &&
|
||||
!email_settings.updated_conference_registration_dates_subject.blank? &&
|
||||
email_settings.updated_conference_registration_dates_template
|
||||
end
|
||||
|
||||
private
|
||||
|
|
@ -737,7 +746,7 @@ class Conference < ActiveRecord::Base
|
|||
# * +True+ -> If conference has a start and a end date.
|
||||
# * +False+ -> If conference has no start or end date.
|
||||
def registration_date_set?
|
||||
!!registration_start_date && !!registration_end_date
|
||||
!!registration_period && !!registration_period.start_date && !!registration_period.end_date
|
||||
end
|
||||
|
||||
# Calculates the distribution from events.
|
||||
|
|
|
|||
|
|
@ -19,8 +19,6 @@ class EmailSettings < ActiveRecord::Base
|
|||
'conference' => conference.title,
|
||||
'conference_start_date' => conference.start_date,
|
||||
'conference_end_date' => conference.end_date,
|
||||
'registration_start_date' => conference.registration_start_date,
|
||||
'registration_end_date' => conference.registration_end_date,
|
||||
'venue' => conference.venue.name,
|
||||
'venue_address' => conference.venue.address,
|
||||
'registrationlink' => Rails.application.routes.url_helpers.register_conference_url(
|
||||
|
|
@ -33,6 +31,11 @@ class EmailSettings < ActiveRecord::Base
|
|||
conference.short_title, host: CONFIG['url_for_emails'])
|
||||
}
|
||||
|
||||
if conference.registration_period
|
||||
h['registration_start_date'] = conference.registration_period.start_date
|
||||
h['registration_end_date'] = conference.registration_period.end_date
|
||||
end
|
||||
|
||||
if !event.nil?
|
||||
h['eventtitle'] = event.title
|
||||
h['proposalslink'] = Rails.application.routes.url_helpers.conference_proposal_url(
|
||||
|
|
|
|||
7
app/models/registration_period.rb
Normal file
7
app/models/registration_period.rb
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
class RegistrationPeriod < ActiveRecord::Base
|
||||
attr_accessible :description, :start_date, :end_date
|
||||
|
||||
validates :start_date, :end_date, presence: true
|
||||
|
||||
belongs_to :conference
|
||||
end
|
||||
|
|
@ -20,9 +20,6 @@
|
|||
= f.input :end_date, :as => :string, :input_html => { :id => "conference-end-datepicker", :readonly => "readonly" }
|
||||
= f.inputs name: 'Registration' do
|
||||
= f.input :include_registrations_in_splash, hint: 'On setting this true you will enable the registrations to be displayed on the splash page'
|
||||
= f.input :registration_start_date, :as => :string, :input_html => { :id => "conference-reg-start-datepicker", :readonly => "readonly" }
|
||||
= f.input :registration_end_date, :as => :string, :input_html => { :id => "conference-reg-end-datepicker", :readonly => "readonly" }
|
||||
= f.input :registration_description, hint: markdown_hint("This description will appear in registration segment of the splash."), input_html: { rows: 5, data: { provide: "markdown-editable" } }
|
||||
= f.input :ticket_description, hint: markdown_hint("This will appear in the Tickets segment of the splash."), input_html: { rows: 5, data: { provide: "markdown-editable" } }
|
||||
= f.input :sponsor_description, hint: markdown_hint("This will appear in the sponsor segment of the splash."), input_html: { rows: 5, data: { provide: "markdown-editable" } }
|
||||
= f.input :sponsor_email, hint: 'This will appear in the sponsor segment of the splash for the sponsors to contact to the organizers'
|
||||
|
|
|
|||
|
|
@ -8,8 +8,8 @@
|
|||
= conference_progress['process'] + '%'
|
||||
%li{'class'=>class_for_todo(conference_progress['registration'])}
|
||||
%span{'class'=>icon_for_todo(conference_progress['registration'])}
|
||||
- if can? :update, @conference.registrations.build
|
||||
= link_to 'Set up registration period', edit_admin_conference_path(conference_progress['short_title'], :anchor => 'conference-end-datepicker')
|
||||
- if can? :update, @conference
|
||||
= link_to 'Set up registration period', edit_admin_conference_registration_period_path(conference_progress['short_title'])
|
||||
- else
|
||||
Set up registration period
|
||||
%li{'class'=>class_for_todo(conference_progress['cfp'])}
|
||||
|
|
|
|||
8
app/views/admin/registration_periods/_form.html.haml
Normal file
8
app/views/admin/registration_periods/_form.html.haml
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
%h1 Registration Period
|
||||
.row
|
||||
.col-md-8
|
||||
= semantic_form_for(@registration_period, url: admin_conference_registration_period_path(@conference.short_title)) do |f|
|
||||
= f.input :start_date, as: :string, input_html: { id: 'registration-period-start-datepicker', readonly: 'readonly' }
|
||||
= f.input :end_date, as: :string, input_html: { id: 'registration-period-end-datepicker', readonly: 'readonly' }
|
||||
= f.input :description, hint: markdown_hint('This will appear in the Tickets segment of the splash.'), input_html: { rows: 5, data: { provide: 'markdown-editable' } }
|
||||
= f.submit 'Save Registration Period', class: 'btn btn-primary'
|
||||
27
app/views/admin/registration_periods/show.html.haml
Normal file
27
app/views/admin/registration_periods/show.html.haml
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
%h1 Registration Period
|
||||
- if @registration_period
|
||||
.row
|
||||
.col-md-6
|
||||
%dl.dl-horizontal
|
||||
%dt
|
||||
Start Date
|
||||
%dd
|
||||
= @registration_period.start_date
|
||||
%dt
|
||||
End Date
|
||||
%dd
|
||||
= @registration_period.end_date
|
||||
%dt
|
||||
Description
|
||||
%dd
|
||||
- if !@conference.registration_period.description.blank?
|
||||
= markdown(@conference.registration_period.description)
|
||||
|
||||
- if can? :update, @registration_period
|
||||
= link_to 'Edit', edit_admin_conference_registration_period_path, class: 'btn btn-primary'
|
||||
- if can? :destroy, @registration_period
|
||||
= link_to 'Delete', admin_conference_registration_period_path,
|
||||
method: :delete, data: { confirm: 'Are you sure?' }, class: 'btn btn-danger'
|
||||
- else
|
||||
- if can? :create, @conference
|
||||
= link_to 'New Registration Period', new_admin_conference_registration_period_path, class: 'btn btn-primary'
|
||||
|
|
@ -4,14 +4,14 @@
|
|||
%div.container.text-center
|
||||
%div.row
|
||||
%h1 Registration
|
||||
- if !@conference.registration_description.blank?
|
||||
- if @conference.registration_period && !@conference.registration_period.description.blank?
|
||||
.lead
|
||||
= markdown(@conference.registration_description)
|
||||
= markdown(@conference.registration_period.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) }
|
||||
-if @conference.registration_period.end_date >= Date.today
|
||||
%h4 Registration period #{ date_string(@conference.registration_period.start_date, @conference.registration_period.end_date) }
|
||||
-else
|
||||
%h4 Registration is Closed, it was from #{ date_string(@conference.registration_start_date, @conference.registration_end_date) }
|
||||
%h4 Registration is Closed, it was from #{ date_string(@conference.registration_period.start_date, @conference.registration_period.end_date) }
|
||||
- if @conference.registration_open?
|
||||
= link_to "Register for #{@conference.short_title}", conference_register_path(@conference.short_title), :class =>"btn btn-success btn-lg", target: '_blank'
|
||||
- if @conference.use_supporter_levels?
|
||||
|
|
|
|||
|
|
@ -48,6 +48,11 @@
|
|||
= link_to(admin_conference_photos_path(@conference.short_title)) do
|
||||
%span.fa.fa-picture-o
|
||||
Photos
|
||||
- if can? :update, @conference
|
||||
%li{:class=> active_nav_li( admin_conference_registration_period_path (@conference.short_title))}
|
||||
= link_to( admin_conference_registration_period_path (@conference.short_title)) do
|
||||
%span.fa.fa-male
|
||||
Registration Period
|
||||
- if can? :update, @conference.events.build
|
||||
%li{:class=> active_nav_li(admin_conference_events_path(@conference.short_title))}
|
||||
= link_to(admin_conference_events_path(@conference.short_title)) do
|
||||
|
|
|
|||
|
|
@ -30,6 +30,8 @@ Osem::Application.routes.draw do
|
|||
patch '/registrations/change_field' => 'registrations#change_field'
|
||||
resources :registrations
|
||||
|
||||
resource :registration_period
|
||||
|
||||
resources :difficulty_levels, only: [:show, :update, :index]
|
||||
|
||||
resources :rooms, only: [:show, :update, :index]
|
||||
|
|
|
|||
16
db/migrate/20140804185823_create_registration_periods.rb
Normal file
16
db/migrate/20140804185823_create_registration_periods.rb
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
class CreateRegistrationPeriods < ActiveRecord::Migration
|
||||
def up
|
||||
create_table :registration_periods do |t|
|
||||
t.integer :conference_id
|
||||
t.date :start_date
|
||||
t.date :end_date
|
||||
t.text :description
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
drop_table :registration_periods
|
||||
end
|
||||
end
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
class MoveConferenceRegistrationDataToRegistrationPeriods < ActiveRecord::Migration
|
||||
class TempConference < ActiveRecord::Base
|
||||
self.table_name = 'conferences'
|
||||
end
|
||||
|
||||
class TempRegistrationPeriod < ActiveRecord::Base
|
||||
self.table_name = 'registration_periods'
|
||||
attr_accessible :conference_id, :start_date, :end_date, :description
|
||||
end
|
||||
|
||||
def up
|
||||
# Move all the settings to the new object
|
||||
TempConference.all.each do |conference|
|
||||
unless TempRegistrationPeriod.exists?(conference_id: conference.id)
|
||||
TempRegistrationPeriod.create(conference_id: conference.id,
|
||||
start_date: conference.registration_start_date,
|
||||
end_date: conference.registration_end_date,
|
||||
description: conference.registration_description)
|
||||
end
|
||||
end
|
||||
|
||||
# Remove Columns
|
||||
remove_column :conferences, :registration_start_date
|
||||
remove_column :conferences, :registration_end_date
|
||||
remove_column :conferences, :registration_description
|
||||
end
|
||||
|
||||
def down
|
||||
add_column :conferences, :registration_start_date, :date
|
||||
add_column :conferences, :registration_end_date, :date
|
||||
add_column :conferences, :registration_description, :text
|
||||
end
|
||||
end
|
||||
36
db/schema.rb
36
db/schema.rb
|
|
@ -11,7 +11,7 @@
|
|||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(version: 20140801170430) do
|
||||
ActiveRecord::Schema.define(version: 20140812065531) do
|
||||
|
||||
create_table "ahoy_events", force: true do |t|
|
||||
t.uuid "visit_id"
|
||||
|
|
@ -94,8 +94,6 @@ ActiveRecord::Schema.define(version: 20140801170430) do
|
|||
t.integer "venue_id"
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
t.date "registration_start_date"
|
||||
t.date "registration_end_date"
|
||||
t.string "logo_file_name"
|
||||
t.string "logo_content_type"
|
||||
t.integer "logo_file_size"
|
||||
|
|
@ -109,17 +107,16 @@ ActiveRecord::Schema.define(version: 20140801170430) do
|
|||
t.boolean "use_volunteers"
|
||||
t.string "color"
|
||||
t.text "description"
|
||||
t.text "registration_description"
|
||||
t.text "ticket_description"
|
||||
t.text "sponsor_description"
|
||||
t.string "sponsor_email"
|
||||
t.text "lodging_description"
|
||||
t.boolean "make_conference_public", default: false
|
||||
t.boolean "include_registrations_in_splash", default: false
|
||||
t.boolean "include_sponsors_in_splash", default: false
|
||||
t.boolean "include_tracks_in_splash", default: false
|
||||
t.boolean "include_tickets_in_splash", default: false
|
||||
t.boolean "include_program_in_splash", default: false
|
||||
t.boolean "make_conference_public", default: false
|
||||
t.string "banner_photo_file_name"
|
||||
t.string "banner_photo_content_type"
|
||||
t.integer "banner_photo_file_size"
|
||||
|
|
@ -213,12 +210,12 @@ ActiveRecord::Schema.define(version: 20140801170430) do
|
|||
|
||||
create_table "event_attachments", force: true do |t|
|
||||
t.integer "event_id"
|
||||
t.string "title", null: false
|
||||
t.string "title", null: false
|
||||
t.string "attachment_file_name"
|
||||
t.string "attachment_content_type"
|
||||
t.integer "attachment_file_size"
|
||||
t.datetime "attachment_updated_at"
|
||||
t.boolean "public", default: true
|
||||
t.boolean "public", default: false
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
end
|
||||
|
|
@ -332,6 +329,15 @@ ActiveRecord::Schema.define(version: 20140801170430) do
|
|||
t.datetime "updated_at"
|
||||
end
|
||||
|
||||
create_table "registration_periods", force: true do |t|
|
||||
t.integer "conference_id"
|
||||
t.date "start_date"
|
||||
t.date "end_date"
|
||||
t.text "description"
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
end
|
||||
|
||||
create_table "registrations", force: true do |t|
|
||||
t.integer "conference_id"
|
||||
t.boolean "attending_social_events", default: true
|
||||
|
|
@ -363,11 +369,11 @@ ActiveRecord::Schema.define(version: 20140801170430) do
|
|||
|
||||
create_table "roles", force: true do |t|
|
||||
t.string "name"
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
t.string "description"
|
||||
t.integer "resource_id"
|
||||
t.string "resource_type"
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
end
|
||||
|
||||
add_index "roles", ["name", "resource_type", "resource_id"], name: "index_roles_on_name_and_resource_type_and_resource_id"
|
||||
|
|
@ -463,8 +469,8 @@ ActiveRecord::Schema.define(version: 20140801170430) do
|
|||
end
|
||||
|
||||
create_table "users", force: true do |t|
|
||||
t.string "email", default: "", null: false
|
||||
t.string "encrypted_password", default: "", null: false
|
||||
t.string "email", default: "", null: false
|
||||
t.string "encrypted_password", default: "", null: false
|
||||
t.string "reset_password_token"
|
||||
t.datetime "reset_password_sent_at"
|
||||
t.datetime "remember_created_at"
|
||||
|
|
@ -514,8 +520,8 @@ ActiveRecord::Schema.define(version: 20140801170430) do
|
|||
|
||||
create_table "venues", force: true do |t|
|
||||
t.string "guid"
|
||||
t.text "name"
|
||||
t.text "address"
|
||||
t.text "name", limit: 255
|
||||
t.text "address", limit: 255
|
||||
t.string "website"
|
||||
t.text "description"
|
||||
t.string "offline_map_url"
|
||||
|
|
@ -526,8 +532,8 @@ ActiveRecord::Schema.define(version: 20140801170430) do
|
|||
t.string "photo_content_type"
|
||||
t.integer "photo_file_size"
|
||||
t.datetime "photo_updated_at"
|
||||
t.boolean "include_venue_in_splash", default: false
|
||||
t.boolean "include_lodgings_in_splash", default: false
|
||||
t.boolean "include_venue_in_splash", default: false
|
||||
t.boolean "include_lodgings_in_splash", default: false
|
||||
end
|
||||
|
||||
create_table "versions", force: true do |t|
|
||||
|
|
|
|||
|
|
@ -48,16 +48,6 @@ describe Admin::ConferenceController do
|
|||
conference.reload
|
||||
allow(Mailbot).to receive(:conference_date_update_mail).and_return(mailer)
|
||||
end
|
||||
|
||||
it 'sends email notification on conference registration date update' do
|
||||
mailer = double
|
||||
allow(mailer).to receive(:deliver)
|
||||
conference.email_settings = create(:email_settings)
|
||||
patch :update, id: conference.short_title, conference:
|
||||
attributes_for(:conference, registration_start_date: Date.today + 2.days, registration_end_date: Date.today + 4.days)
|
||||
conference.reload
|
||||
allow(Mailbot).to receive(:conference_registration_date_update_mail).and_return(mailer)
|
||||
end
|
||||
end
|
||||
|
||||
context 'invalid attributes' do
|
||||
|
|
@ -141,13 +131,13 @@ describe Admin::ConferenceController do
|
|||
|
||||
describe 'GET #edit' do
|
||||
it 'assigns the requested conference to conference' do
|
||||
get :show, id: conference.short_title
|
||||
get :edit, id: conference.short_title
|
||||
expect(assigns(:conference)).to eq conference
|
||||
end
|
||||
|
||||
it 'renders the show template' do
|
||||
get :show, id: conference.short_title
|
||||
expect(response).to render_template :show
|
||||
get :edit, id: conference.short_title
|
||||
expect(response).to render_template :edit
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
165
spec/controllers/admin/registration_periods_controller_spec.rb
Normal file
165
spec/controllers/admin/registration_periods_controller_spec.rb
Normal file
|
|
@ -0,0 +1,165 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe Admin::RegistrationPeriodsController do
|
||||
|
||||
# It is necessary to use bang version of let to build roles before user
|
||||
let(:conference) { create(:conference) }
|
||||
let!(:first_user) { create(:user) }
|
||||
let!(:organizer_role) { create(:role, name: 'organizer', resource: conference) }
|
||||
|
||||
let(:organizer) { create(:user, role_ids: organizer_role.id) }
|
||||
let(:organizer2) { create(:user, email: 'organizer2@email.osem', role_ids: organizer_role.id) }
|
||||
let(:participant) { create(:user) }
|
||||
|
||||
shared_examples 'access as administration or organizer' do
|
||||
|
||||
before do
|
||||
conference.registration_period = create(:registration_period)
|
||||
end
|
||||
|
||||
describe 'PATCH #update' do
|
||||
|
||||
context 'valid attributes' do
|
||||
|
||||
it 'locates the requested audience object' do
|
||||
patch :update, conference_id: conference.short_title, conference: attributes_for(:registration_period)
|
||||
expect(assigns(:registration_period)).to eq(conference.registration_period)
|
||||
end
|
||||
|
||||
it 'changes audience attributes' do
|
||||
patch :update, conference_id: conference.short_title, registration_period:
|
||||
attributes_for(:registration_period,
|
||||
description: 'Test')
|
||||
|
||||
conference.reload
|
||||
expect(conference.registration_period.description).to eq('Test')
|
||||
end
|
||||
|
||||
it 'redirects to the updated conference' do
|
||||
patch :update, conference_id: conference.short_title, registration_period:
|
||||
attributes_for(:registration_period)
|
||||
conference.reload
|
||||
expect(response).to redirect_to admin_conference_registration_period_path(
|
||||
conference.short_title)
|
||||
end
|
||||
|
||||
it 'sends email notification on conference registration date update' do
|
||||
mailer = double
|
||||
allow(mailer).to receive(:deliver)
|
||||
conference.email_settings = create(:email_settings)
|
||||
conference.registration_period = create(:registration_period,
|
||||
start_date: Date.today,
|
||||
end_date: Date.today + 2.days)
|
||||
|
||||
patch :update, conference_id: conference.short_title, registration_period:
|
||||
attributes_for(:registration_period,
|
||||
start_date: Date.today + 2.days,
|
||||
end_date: Date.today + 4.days)
|
||||
conference.reload
|
||||
allow(Mailbot).to receive(:conference_registration_date_update_mail).and_return(mailer)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe 'POST #create' do
|
||||
context 'with valid attributes' do
|
||||
it 'saves the registration period to the database' do
|
||||
expected = expect do
|
||||
post :create,
|
||||
conference_id: conference.short_title,
|
||||
registration_period: attributes_for(:registration_period)
|
||||
end
|
||||
expected.to change { RegistrationPeriod.count }.by 1
|
||||
end
|
||||
|
||||
it 'redirects to registration_periods#show' do
|
||||
post :create,
|
||||
conference_id: conference.short_title,
|
||||
registration_period: attributes_for(:registration_period)
|
||||
|
||||
expect(response).to redirect_to admin_conference_registration_period_path(
|
||||
assigns[:conference].short_title)
|
||||
end
|
||||
end
|
||||
|
||||
context 'with invalid attributes' do
|
||||
it 'does not save the conference to the database' do
|
||||
expected = expect do
|
||||
post :create,
|
||||
conference_id: conference.short_title,
|
||||
registration_period: attributes_for(:registration_period,
|
||||
start_date: nil,
|
||||
end_date: nil)
|
||||
end
|
||||
expected.to_not change { Conference.count }
|
||||
end
|
||||
|
||||
it 're-renders the new template' do
|
||||
post :create,
|
||||
conference_id: conference.short_title,
|
||||
registration_period: attributes_for(:registration_period,
|
||||
start_date: nil,
|
||||
end_date: nil)
|
||||
expect(response).to be_success
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe 'GET #edit' do
|
||||
it 'assigns the requested conference to conference' do
|
||||
get :edit, conference_id: conference.short_title
|
||||
expect(assigns(:registration_period)).to eq conference.registration_period
|
||||
end
|
||||
|
||||
it 'renders the show template' do
|
||||
get :edit, conference_id: conference.short_title
|
||||
expect(response).to render_template :edit
|
||||
end
|
||||
end
|
||||
|
||||
describe 'GET #show' do
|
||||
it 'assigns the requested registration period to registration period' do
|
||||
get :show, conference_id: conference.short_title
|
||||
expect(assigns(:registration_period)).to eq conference.registration_period
|
||||
end
|
||||
|
||||
it 'renders the show template' do
|
||||
get :show, conference_id: conference.short_title
|
||||
expect(response).to render_template :show
|
||||
end
|
||||
end
|
||||
|
||||
describe 'GET #new' do
|
||||
it 'assigns a new conference to conference' do
|
||||
get :new, conference_id: conference.short_title
|
||||
expect(assigns(:registration_period)).to be_a_new(RegistrationPeriod)
|
||||
end
|
||||
|
||||
it 'renders the :new template' do
|
||||
get :new, conference_id: conference.short_title
|
||||
expect(response).to render_template :new
|
||||
end
|
||||
end
|
||||
|
||||
describe 'DELETE #destroy' do
|
||||
it 'it deletes the registration period' do
|
||||
expect { delete :destroy, conference_id: conference.short_title }.to change(RegistrationPeriod, :count).by(-1)
|
||||
end
|
||||
it 'redirects to users#show' do
|
||||
delete :destroy, conference_id: conference.short_title
|
||||
expect(response).to redirect_to admin_conference_registration_period_path
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe 'organizer access' do
|
||||
|
||||
before(:each) do
|
||||
sign_in(organizer)
|
||||
end
|
||||
|
||||
it_behaves_like 'access as administration or organizer'
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -7,8 +7,6 @@ FactoryGirl.define do
|
|||
timezone 'Amsterdam'
|
||||
start_date { Date.today }
|
||||
end_date { 6.days.from_now }
|
||||
registration_start_date { 3.days.from_now }
|
||||
registration_end_date { 5.days.from_now }
|
||||
make_conference_public true
|
||||
venue
|
||||
end
|
||||
|
|
|
|||
9
spec/factories/registration_periods.rb
Normal file
9
spec/factories/registration_periods.rb
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
# Read about factories at https://github.com/thoughtbot/factory_girl
|
||||
|
||||
FactoryGirl.define do
|
||||
factory :registration_period do
|
||||
start_date { 3.days.from_now }
|
||||
end_date { 5.days.from_now }
|
||||
description 'Lorem ipsum dolorem ...'
|
||||
end
|
||||
end
|
||||
47
spec/features/registration_periods_spec.rb
Normal file
47
spec/features/registration_periods_spec.rb
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
require 'spec_helper'
|
||||
|
||||
feature RegistrationPeriod do
|
||||
|
||||
# It is necessary to use bang version of let to build roles before user
|
||||
let!(:conference) { create(:conference) }
|
||||
let!(:organizer_role) { create(:organizer_role, resource: conference) }
|
||||
let!(:organizer) { create(:user, email: 'admin@example.com', role_ids: [organizer_role.id]) }
|
||||
|
||||
shared_examples 'successfully' do
|
||||
scenario 'create and update registration period', js: true do
|
||||
sign_in organizer
|
||||
visit admin_conference_registration_period_path(
|
||||
conference_id: conference.short_title)
|
||||
|
||||
click_link 'New Registration Period'
|
||||
fill_in 'registration_period_description', with: 'The description'
|
||||
|
||||
click_button 'Save Registration Period'
|
||||
expect(flash).
|
||||
to eq("A error prohibited the Registration Period from being saved: " \
|
||||
"Start date can't be blank. End date can't be blank.")
|
||||
|
||||
page.
|
||||
execute_script("$('#registration-period-start-datepicker').val('" +
|
||||
"#{Date.today.strftime('%d/%m/%Y')}')")
|
||||
page.
|
||||
execute_script("$('#registration-period-end-datepicker').val('" +
|
||||
"#{(Date.today + 7).strftime('%d/%m/%Y')}')")
|
||||
|
||||
click_button 'Save Registration Period'
|
||||
|
||||
expect(flash).to eq('Registration Period successfully updated.')
|
||||
expect(current_path).to eq(admin_conference_registration_period_path(conference.short_title))
|
||||
|
||||
registration_period = RegistrationPeriod.where(conference_id: conference.id).first
|
||||
registration_period.reload
|
||||
expect(registration_period.start_date).to eq(Date.today)
|
||||
expect(registration_period.end_date).to eq(Date.today + 7)
|
||||
expect(registration_period.description).to eq('The description')
|
||||
end
|
||||
end
|
||||
|
||||
describe 'organizer' do
|
||||
it_behaves_like 'successfully'
|
||||
end
|
||||
end
|
||||
|
|
@ -964,8 +964,6 @@ describe Conference do
|
|||
end
|
||||
|
||||
it 'calculates correct for new conference' do
|
||||
subject.registration_start_date = nil
|
||||
subject.registration_end_date = nil
|
||||
subject.call_for_papers = nil
|
||||
subject.venue = nil
|
||||
subject.rooms = []
|
||||
|
|
@ -978,8 +976,9 @@ describe Conference do
|
|||
end
|
||||
|
||||
it 'calculates correct for conference with registration' do
|
||||
subject.registration_start_date = Date.today
|
||||
subject.registration_end_date = Date.today + 14
|
||||
subject.registration_period = create(:registration_period,
|
||||
start_date: Date.today,
|
||||
end_date: Date.today + 14)
|
||||
subject.call_for_papers = nil
|
||||
subject.rooms = []
|
||||
subject.tracks = []
|
||||
|
|
@ -994,8 +993,9 @@ describe Conference do
|
|||
end
|
||||
|
||||
it 'calculates correct for conference with registration, cfp' do
|
||||
subject.registration_start_date = Date.today
|
||||
subject.registration_end_date = Date.today + 14
|
||||
subject.registration_period = create(:registration_period,
|
||||
start_date: Date.today,
|
||||
end_date: Date.today + 14)
|
||||
subject.call_for_papers = create(:call_for_papers)
|
||||
subject.rooms = []
|
||||
subject.tracks = []
|
||||
|
|
@ -1011,8 +1011,9 @@ describe Conference do
|
|||
end
|
||||
|
||||
it 'calculates correct for conference with registration, cfp, venue' do
|
||||
subject.registration_start_date = Date.today
|
||||
subject.registration_end_date = Date.today + 14
|
||||
subject.registration_period = create(:registration_period,
|
||||
start_date: Date.today,
|
||||
end_date: Date.today + 14)
|
||||
subject.call_for_papers = create(:call_for_papers)
|
||||
subject.venue = create(:venue)
|
||||
subject.rooms = []
|
||||
|
|
@ -1031,8 +1032,9 @@ describe Conference do
|
|||
|
||||
it 'calculates correct for conference with registration, cfp, venue, rooms' do
|
||||
subject.rooms = [create(:room)]
|
||||
subject.registration_start_date = Date.today
|
||||
subject.registration_end_date = Date.today + 14
|
||||
subject.registration_period = create(:registration_period,
|
||||
start_date: Date.today,
|
||||
end_date: Date.today + 14)
|
||||
subject.call_for_papers = create(:call_for_papers)
|
||||
subject.venue = create(:venue)
|
||||
subject.tracks = []
|
||||
|
|
@ -1052,8 +1054,9 @@ describe Conference do
|
|||
it 'calculates correct for conference with registration, cfp, venue, rooms, tracks' do
|
||||
subject.rooms = [create(:room)]
|
||||
subject.tracks = [create(:track)]
|
||||
subject.registration_start_date = Date.today
|
||||
subject.registration_end_date = Date.today + 14
|
||||
subject.registration_period = create(:registration_period,
|
||||
start_date: Date.today,
|
||||
end_date: Date.today + 14)
|
||||
subject.call_for_papers = create(:call_for_papers)
|
||||
subject.venue = create(:venue)
|
||||
subject.event_types = []
|
||||
|
|
@ -1075,8 +1078,9 @@ describe Conference do
|
|||
subject.rooms = [create(:room)]
|
||||
subject.tracks = [create(:track)]
|
||||
subject.event_types = [create(:event_type)]
|
||||
subject.registration_start_date = Date.today
|
||||
subject.registration_end_date = Date.today + 14
|
||||
subject.registration_period = create(:registration_period,
|
||||
start_date: Date.today,
|
||||
end_date: Date.today + 14)
|
||||
subject.call_for_papers = create(:call_for_papers)
|
||||
subject.venue = create(:venue)
|
||||
subject.difficulty_levels = []
|
||||
|
|
@ -1098,8 +1102,9 @@ describe Conference do
|
|||
subject.tracks = [create(:track)]
|
||||
subject.event_types = [create(:event_type)]
|
||||
subject.difficulty_levels = [create(:difficulty_level)]
|
||||
subject.registration_start_date = Date.today
|
||||
subject.registration_end_date = Date.today + 14
|
||||
subject.registration_period = create(:registration_period,
|
||||
start_date: Date.today,
|
||||
end_date: Date.today + 14)
|
||||
subject.venue = create(:venue)
|
||||
subject.call_for_papers = create(:call_for_papers)
|
||||
subject.venue = create(:venue)
|
||||
|
|
@ -1112,26 +1117,30 @@ describe Conference do
|
|||
describe '#registration_weeks' do
|
||||
|
||||
it 'calculates new year' do
|
||||
subject.registration_start_date = Date.new(2013, 12, 31)
|
||||
subject.registration_end_date = Date.new(2013, 12, 30) + 6
|
||||
subject.registration_period = create(:registration_period,
|
||||
start_date: Date.new(2013, 12, 31),
|
||||
end_date: Date.new(2013, 12, 30) + 6)
|
||||
expect(subject.registration_weeks).to eq(1)
|
||||
end
|
||||
|
||||
it 'is one if start and end are 6 days apart' do
|
||||
subject.registration_start_date = Date.new(2014, 05, 26)
|
||||
subject.registration_end_date = Date.new(2014, 05, 26) + 6
|
||||
subject.registration_period = create(:registration_period,
|
||||
start_date: Date.new(2014, 05, 26),
|
||||
end_date: Date.new(2014, 05, 26) + 6)
|
||||
expect(subject.registration_weeks).to eq(1)
|
||||
end
|
||||
|
||||
it 'is one if start and end date are the same' do
|
||||
subject.registration_start_date = Date.new(2014, 05, 26)
|
||||
subject.registration_end_date = Date.new(2014, 05, 26)
|
||||
subject.registration_period = create(:registration_period,
|
||||
start_date: Date.new(2014, 05, 26),
|
||||
end_date: Date.new(2014, 05, 26))
|
||||
expect(subject.registration_weeks).to eq(1)
|
||||
end
|
||||
|
||||
it 'is two if start and end are 10 days apart' do
|
||||
subject.registration_start_date = Date.new(2014, 05, 26)
|
||||
subject.registration_end_date = Date.new(2014, 05, 26) + 10
|
||||
subject.registration_period = create(:registration_period,
|
||||
start_date: Date.new(2014, 05, 26),
|
||||
end_date: Date.new(2014, 05, 26) + 10)
|
||||
expect(subject.registration_weeks).to eq(2)
|
||||
end
|
||||
end
|
||||
|
|
@ -1263,15 +1272,17 @@ describe Conference do
|
|||
describe '#get_registrations_per_week' do
|
||||
|
||||
it 'pads with zeros if there are no registrations' do
|
||||
subject.registration_start_date = Date.new(2014, 05, 26)
|
||||
subject.registration_end_date = Date.new(2014, 05, 26) + 21
|
||||
subject.registration_period = create(:registration_period,
|
||||
start_date: Date.new(2014, 05, 26),
|
||||
end_date: Date.new(2014, 05, 26) + 21)
|
||||
|
||||
expect(subject.get_registrations_per_week).to eq([0, 0, 0, 0])
|
||||
end
|
||||
|
||||
it 'summarized correct if there are no registrations in one week' do
|
||||
subject.registration_start_date = Date.new(2014, 05, 26)
|
||||
subject.registration_end_date = Date.new(2014, 05, 26) + 28
|
||||
subject.registration_period = create(:registration_period,
|
||||
start_date: Date.new(2014, 05, 26),
|
||||
end_date: Date.new(2014, 05, 26) + 28)
|
||||
|
||||
create(:registration, conference: subject,
|
||||
created_at: Date.new(2014, 05, 26) + 7)
|
||||
|
|
@ -1284,8 +1295,9 @@ describe Conference do
|
|||
end
|
||||
|
||||
it 'returns [1] if there is one registration on the first day' do
|
||||
subject.registration_start_date = Date.new(2014, 05, 26)
|
||||
subject.registration_end_date = Date.new(2014, 05, 26) + 7
|
||||
subject.registration_period = create(:registration_period,
|
||||
start_date: Date.new(2014, 05, 26),
|
||||
end_date: Date.new(2014, 05, 26) + 7)
|
||||
|
||||
create(:registration, conference: subject,
|
||||
created_at: Date.new(2014, 05, 26))
|
||||
|
|
@ -1293,8 +1305,9 @@ describe Conference do
|
|||
end
|
||||
|
||||
it 'summarized correct if there are registrations every week' do
|
||||
subject.registration_start_date = Date.new(2014, 05, 26)
|
||||
subject.registration_end_date = Date.new(2014, 05, 26) + 21
|
||||
subject.registration_period = create(:registration_period,
|
||||
start_date: Date.new(2014, 05, 26),
|
||||
end_date: Date.new(2014, 05, 26) + 21)
|
||||
|
||||
create(:registration, conference: subject, created_at: Date.new(2014, 05, 26))
|
||||
create(:registration, conference: subject,
|
||||
|
|
@ -1306,8 +1319,9 @@ describe Conference do
|
|||
end
|
||||
|
||||
it 'summarized correct if there are registrations every week except the first' do
|
||||
subject.registration_start_date = Date.new(2014, 05, 26)
|
||||
subject.registration_end_date = Date.new(2014, 05, 26) + 28
|
||||
subject.registration_period = create(:registration_period,
|
||||
start_date: Date.new(2014, 05, 26),
|
||||
end_date: Date.new(2014, 05, 26) + 28)
|
||||
|
||||
create(:registration, conference: subject,
|
||||
created_at: Date.new(2014, 05, 26) + 7)
|
||||
|
|
@ -1320,8 +1334,9 @@ describe Conference do
|
|||
end
|
||||
|
||||
it 'pads left' do
|
||||
subject.registration_start_date = Date.new(2014, 05, 26)
|
||||
subject.registration_end_date = Date.new(2014, 05, 26) + 35
|
||||
subject.registration_period = create(:registration_period,
|
||||
start_date: Date.new(2014, 05, 26),
|
||||
end_date: Date.new(2014, 05, 26) + 35)
|
||||
|
||||
create(:registration, conference: subject,
|
||||
created_at: Date.new(2014, 05, 26) + 21)
|
||||
|
|
@ -1334,8 +1349,9 @@ describe Conference do
|
|||
end
|
||||
|
||||
it 'pads middle' do
|
||||
subject.registration_start_date = Date.new(2014, 05, 26)
|
||||
subject.registration_end_date = Date.new(2014, 05, 26) + 35
|
||||
subject.registration_period = create(:registration_period,
|
||||
start_date: Date.new(2014, 05, 26),
|
||||
end_date: Date.new(2014, 05, 26) + 35)
|
||||
|
||||
create(:registration, conference: subject,
|
||||
created_at: Date.new(2014, 05, 26))
|
||||
|
|
@ -1346,8 +1362,9 @@ describe Conference do
|
|||
end
|
||||
|
||||
it 'pads right' do
|
||||
subject.registration_start_date = Date.new(2014, 05, 26)
|
||||
subject.registration_end_date = Date.new(2014, 05, 26) + 35
|
||||
subject.registration_period = create(:registration_period,
|
||||
start_date: Date.new(2014, 05, 26),
|
||||
end_date: Date.new(2014, 05, 26) + 35)
|
||||
|
||||
create(:registration, conference: subject,
|
||||
created_at: Date.new(2014, 05, 26))
|
||||
|
|
@ -1389,8 +1406,10 @@ describe Conference do
|
|||
context 'open registration' do
|
||||
|
||||
before do
|
||||
subject.registration_start_date = Date.today - 1
|
||||
subject.registration_end_date = Date.today + 7
|
||||
enrollment = create(:registration_period,
|
||||
start_date: Date.today - 1,
|
||||
end_date: Date.today + 7)
|
||||
subject.registration_period = enrollment
|
||||
end
|
||||
|
||||
it '#registration_open? is true' do
|
||||
|
|
|
|||
|
|
@ -2,24 +2,26 @@ require 'spec_helper'
|
|||
describe 'conference/show.html.haml' do
|
||||
before(:each) do
|
||||
allow(view).to receive(:date_string).and_return("January 17 - 21 2014")
|
||||
@conference = create(:conference, registration_description: 'Lorem Ipsum Dolor',
|
||||
registration_start_date: Date.today,
|
||||
registration_end_date: Date.tomorrow,
|
||||
description: 'Lorem Ipsum',
|
||||
sponsor_description: 'Lorem Ipsum Dolor',
|
||||
sponsor_email: 'example@example.com',
|
||||
include_registrations_in_splash: true,
|
||||
include_program_in_splash: true,
|
||||
include_sponsors_in_splash: true,
|
||||
include_tracks_in_splash: true,
|
||||
include_tickets_in_splash: true,
|
||||
include_banner_in_splash: true)
|
||||
@conference = create(:conference,
|
||||
description: 'Lorem Ipsum',
|
||||
sponsor_description: 'Lorem Ipsum Dolor',
|
||||
sponsor_email: 'example@example.com',
|
||||
include_registrations_in_splash: true,
|
||||
include_program_in_splash: true,
|
||||
include_sponsors_in_splash: true,
|
||||
include_tracks_in_splash: true,
|
||||
include_tickets_in_splash: true,
|
||||
include_banner_in_splash: true)
|
||||
@conference.contact.update(facebook: 'http://www.fbexample.com',
|
||||
googleplus: 'http://www.google-example.com',
|
||||
instagram: 'http://instagram.com',
|
||||
twitter: 'http://twitter.com',
|
||||
public: true
|
||||
)
|
||||
@conference.registration_period = create(:registration_period,
|
||||
description: 'Lorem Ipsum Dolor',
|
||||
start_date: Date.today,
|
||||
end_date: Date.tomorrow)
|
||||
@conference.call_for_papers = create(:call_for_papers, conference: @conference,
|
||||
include_cfp_in_splash: true)
|
||||
@conference.call_for_papers = create(:call_for_papers, conference: @conference,
|
||||
|
|
@ -45,7 +47,7 @@ describe 'conference/show.html.haml' do
|
|||
end
|
||||
|
||||
it 'renders registration partial' do
|
||||
expect(view.content_for(:splash)).to include("#{@conference.registration_description}")
|
||||
expect(view.content_for(:splash)).to include("#{@conference.registration_period.description}")
|
||||
expect(view).to render_template(partial: 'conference/_registration')
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue