Introduce Program to include cfp/rooms/tracks/events/event_types/difficulty_levels

This commit is contained in:
Stella Rouzi 2015-10-25 13:29:02 +02:00 committed by Henne Vogelsang
parent 028b82fda8
commit 444356fbc7
117 changed files with 1812 additions and 905 deletions

View file

@ -0,0 +1,58 @@
module Admin
class CfpsController < Admin::BaseController
load_and_authorize_resource :conference, find_by: :short_title
load_and_authorize_resource :program, through: :conference, singleton: true
load_and_authorize_resource through: :program, singleton: true
def show; end
def new
@cfp = @program.build_cfp
end
def edit; end
def create
@cfp = @program.build_cfp(cfp_params)
if @cfp.save
redirect_to admin_conference_program_cfp_path,
notice: 'Call for papers successfully created.'
else
flash[:error] = "Creating the call for papers failed. #{@cfp.errors.full_messages.join('. ')}."
render :new
end
end
def update
@cfp = @program.cfp
@cfp.assign_attributes(params[:cfp])
send_mail_on_cfp_dates_updates = @cfp.notify_on_cfp_date_update?
if @cfp.update_attributes(params[:cfp])
Mailbot.delay.send_on_cfps_dates_updates(@conference) if send_mail_on_cfp_dates_updates
redirect_to(admin_conference_program_cfp_path(@conference.short_title),
notice: 'Call for papers successfully updated.')
else
flash[:error] = "Updating call for papers failed. #{@cfp.errors.to_a.join('. ')}."
render :new
end
end
def destroy
if @cfp.destroy
redirect_to admin_conference_program_cfp_path, notice: 'Call for Papers was successfully deleted.'
else
redirect_to admin_conference_program_cfp_path, error: 'An error prohibited this Call for Papers from being destroyed: '\
"#{@cfp.errors.full_messages.join('. ')}."
end
end
private
def cfp_params
params[:cfp]
end
end
end

View file

@ -22,7 +22,7 @@ module Admin
# Grouping all comments by conference, and by event. It returns {:conference => {:event => [{comment_2}, {comment_1 }]}} # Grouping all comments by conference, and by event. It returns {:conference => {:event => [{comment_2}, {comment_1 }]}}
def grouped_comments(remarks) def grouped_comments(remarks)
remarks.group_by{ |comment| comment.commentable.conference }.map {|conference, comments| [conference, comments.group_by{|comment| comment.commentable}]}.to_h remarks.group_by{ |comment| comment.commentable.program.conference }.map {|conference, comments| [conference, comments.group_by{|comment| comment.commentable}]}.to_h
end end
end end
end end

View file

@ -1,6 +1,7 @@
module Admin module Admin
class ConferenceController < Admin::BaseController class ConferenceController < Admin::BaseController
load_and_authorize_resource :conference, find_by: :short_title load_and_authorize_resource :conference, find_by: :short_title
load_resource :program, through: :conference, singleton: true, except: :index
load_resource :user, only: [:remove_user] load_resource :user, only: [:remove_user]
def index def index
@ -94,14 +95,17 @@ module Admin
end end
def show def show
@conference = Conference.find_by(short_title: params[:id]) @program = @conference.program
unless @conference.program
@program = Program.new(conference_id: @conference.id)
end
# Overview and since last login information # Overview and since last login information
@total_reg = @conference.registrations.count @total_reg = @conference.registrations.count
@new_reg = @conference.registrations.where('created_at > ?', current_user.last_sign_in_at).count @new_reg = @conference.registrations.where('created_at > ?', current_user.last_sign_in_at).count
@total_submissions = @conference.events.count @total_submissions = @program.events.count
@new_submissions = @conference.events. @new_submissions = @program.events.
where('created_at > ?', current_user.last_sign_in_at).count where('created_at > ?', current_user.last_sign_in_at).count
@program_length = @conference.current_program_hours @program_length = @conference.current_program_hours
@ -141,7 +145,7 @@ module Admin
@tracks_distribution_confirmed = @conference.tracks_distribution(:confirmed) @tracks_distribution_confirmed = @conference.tracks_distribution(:confirmed)
# Recent actions information # Recent actions information
@recent_events = @conference.events.limit(5).order(created_at: :desc) @recent_events = @conference.program.events.limit(5).order(created_at: :desc)
@recent_registrations = @conference.registrations.limit(5).order(created_at: :desc) @recent_registrations = @conference.registrations.limit(5).order(created_at: :desc)
@top_submitter = @conference.get_top_submitter @top_submitter = @conference.get_top_submitter

View file

@ -1,23 +1,24 @@
module Admin module Admin
class DifficultyLevelsController < Admin::BaseController class DifficultyLevelsController < Admin::BaseController
load_and_authorize_resource :conference, find_by: :short_title load_and_authorize_resource :conference, find_by: :short_title
load_and_authorize_resource :difficulty_level, through: :conference load_and_authorize_resource :program, through: :conference, singleton: true
load_and_authorize_resource through: :program
def index def index
authorize! :index, DifficultyLevel.new(conference_id: @conference.id) # authorize! :index, DifficultyLevel.new(program_id: @program.id)
end end
def edit; end def edit; end
def new def new
@difficulty_level = @conference.difficulty_levels.new @difficulty_level = @conference.program.difficulty_levels.new
end end
def create def create
@difficulty_level = @conference.difficulty_levels.new(difficulty_level_params) @difficulty_level = @conference.program.difficulty_levels.new(difficulty_level_params)
if @difficulty_level.save if @difficulty_level.save
flash[:notice] = 'Difficulty level successfully created.' flash[:notice] = 'Difficulty level successfully created.'
redirect_to(admin_conference_difficulty_levels_path(conference_id: @conference.short_title)) redirect_to(admin_conference_program_difficulty_levels_path(conference_id: @conference.short_title))
else else
flash[:error] = "Creating difficulty level failed: #{@difficulty_level.errors.full_messages.join('. ')}." flash[:error] = "Creating difficulty level failed: #{@difficulty_level.errors.full_messages.join('. ')}."
render :new render :new
@ -27,7 +28,7 @@ module Admin
def update def update
if @difficulty_level.update_attributes(difficulty_level_params) if @difficulty_level.update_attributes(difficulty_level_params)
flash[:notice] = 'Difficulty level successfully updated.' flash[:notice] = 'Difficulty level successfully updated.'
redirect_to(admin_conference_difficulty_levels_path(conference_id: @conference.short_title)) redirect_to(admin_conference_program_difficulty_levels_path(conference_id: @conference.short_title))
else else
flash[:error] = "Update difficulty level failed: #{@difficulty_level.errors.full_messages.join('. ')}." flash[:error] = "Update difficulty level failed: #{@difficulty_level.errors.full_messages.join('. ')}."
render :edit render :edit
@ -37,11 +38,11 @@ module Admin
def destroy def destroy
if @difficulty_level.destroy if @difficulty_level.destroy
flash[:notice] = 'Difficulty level successfully deleted.' flash[:notice] = 'Difficulty level successfully deleted.'
redirect_to(admin_conference_difficulty_levels_path(conference_id: @conference.short_title)) redirect_to(admin_conference_program_difficulty_levels_path(conference_id: @conference.short_title))
else else
flash[:error] = 'Deleting difficulty level type failed! ' \ flash[:error] = 'Deleting difficulty level type failed! ' \
"#{@difficulty_level.errors.full_messages.join('. ')}." "#{@difficulty_level.errors.full_messages.join('. ')}."
redirect_to(admin_conference_difficulty_levels_path(conference_id: @conference.short_title)) redirect_to(admin_conference_program_difficulty_levels_path(conference_id: @conference.short_title))
end end
end end

View file

@ -1,23 +1,22 @@
module Admin module Admin
class EventTypesController < Admin::BaseController class EventTypesController < Admin::BaseController
load_and_authorize_resource :conference, find_by: :short_title load_and_authorize_resource :conference, find_by: :short_title
load_and_authorize_resource :event_type, through: :conference load_and_authorize_resource :program, through: :conference, singleton: true
load_and_authorize_resource :event_type, through: :program
def index def index; end
authorize! :index, EventType.new(conference_id: @conference.id)
end
def edit; end def edit; end
def new def new
@event_type = @conference.event_types.new @event_type = @conference.program.event_types.new
end end
def create def create
@event_type = @conference.event_types.new(event_type_params) @event_type = @conference.program.event_types.new(event_type_params)
if @event_type.save if @event_type.save
flash[:notice] = 'Event type successfully created.' flash[:notice] = 'Event type successfully created.'
redirect_to(admin_conference_event_types_path(conference_id: @conference.short_title)) redirect_to(admin_conference_program_event_types_path(conference_id: @conference.short_title))
else else
flash[:error] = "Creating event type failed: #{@event_type.errors.full_messages.join('. ')}." flash[:error] = "Creating event type failed: #{@event_type.errors.full_messages.join('. ')}."
render :new render :new
@ -27,7 +26,7 @@ module Admin
def update def update
if @event_type.update_attributes(event_type_params) if @event_type.update_attributes(event_type_params)
flash[:notice] = 'Event type successfully updated.' flash[:notice] = 'Event type successfully updated.'
redirect_to(admin_conference_event_types_path(conference_id: @conference.short_title)) redirect_to(admin_conference_program_event_types_path(conference_id: @conference.short_title))
else else
flash[:error] = "Update event type failed: #{@event_type.errors.full_messages.join('. ')}." flash[:error] = "Update event type failed: #{@event_type.errors.full_messages.join('. ')}."
render :edit render :edit
@ -37,11 +36,11 @@ module Admin
def destroy def destroy
if @event_type.destroy if @event_type.destroy
flash[:notice] = 'Event type successfully deleted.' flash[:notice] = 'Event type successfully deleted.'
redirect_to(admin_conference_event_types_path(conference_id: @conference.short_title)) redirect_to(admin_conference_program_event_types_path(conference_id: @conference.short_title))
else else
flash[:error] = 'Destroying event type failed! ' \ flash[:error] = 'Destroying event type failed! ' \
"#{@event_type.errors.full_messages.join('. ')}." "#{@event_type.errors.full_messages.join('. ')}."
redirect_to(admin_conference_event_types_path(conference_id: @conference.short_title)) redirect_to(admin_conference_program_event_types_path(conference_id: @conference.short_title))
end end
end end

View file

@ -1,7 +1,8 @@
module Admin module Admin
class EventsController < Admin::BaseController class EventsController < Admin::BaseController
load_and_authorize_resource :conference, find_by: :short_title load_and_authorize_resource :conference, find_by: :short_title
load_and_authorize_resource :event, through: :conference load_and_authorize_resource :program, through: :conference, singleton: true
load_and_authorize_resource :event, through: :program
before_action :get_event, except: [:index, :create] before_action :get_event, except: [:index, :create]
@ -14,13 +15,11 @@ module Admin
end end
def index def index
authorize! :index, @conference.events.build @events = @program.events
@conference = Conference.find_by(short_title: params[:conference_id]) @tracks = @program.tracks
@events = @conference.events @difficulty_levels = @program.difficulty_levels
@tracks = @conference.tracks
@difficulty_levels = @conference.difficulty_levels
@machine_states = @events.state_machine.states.map @machine_states = @events.state_machine.states.map
@event_types = @conference.event_types @event_types = @program.event_types
@mystates = [] @mystates = []
@mytypes = [] @mytypes = []
@ -72,26 +71,26 @@ module Admin
respond_to do |format| respond_to do |format|
format.html format.html
# Explicity call #to_json to avoid the use of EventSerializer # Explicity call #to_json to avoid the use of EventSerializer
format.json { render json: Event.where(state: :confirmed, conference: @conference).to_json } format.json { render json: Event.where(state: :confirmed, program: @program).to_json }
end end
end end
def show def show
@tracks = @conference.tracks @tracks = @program.tracks
@event_types = @conference.event_types @event_types = @program.event_types
@comments = @event.root_comments @comments = @event.root_comments
@comment_count = @event.comment_threads.count @comment_count = @event.comment_threads.count
@ratings = @event.votes.includes(:user) @ratings = @event.votes.includes(:user)
@difficulty_levels = @conference.difficulty_levels @difficulty_levels = @program.difficulty_levels
end end
def edit def edit
@event_types = @conference.event_types @event_types = @program.event_types
@tracks = Track.all @tracks = Track.all
@comments = @event.root_comments @comments = @event.root_comments
@comment_count = @event.comment_threads.count @comment_count = @event.comment_threads.count
@user = @event.submitter @user = @event.submitter
@url = admin_conference_event_path(@conference.short_title, @event) @url = admin_conference_program_event_path(@conference.short_title, @event)
end end
def comment def comment
@ -101,7 +100,7 @@ module Admin
comment.move_to_child_of(params[:parent]) comment.move_to_child_of(params[:parent])
end end
redirect_to admin_conference_event_path(conference_id: @conference.short_title) redirect_to admin_conference_program_event_path(@conference.short_title, @event)
end end
def update def update
@ -111,10 +110,10 @@ module Admin
render js: 'index' render js: 'index'
else else
flash[:notice] = "Successfully updated event with ID #{@event.id}." flash[:notice] = "Successfully updated event with ID #{@event.id}."
redirect_back_or_to(admin_conference_event_path(@conference.short_title, @event)) redirect_back_or_to(admin_conference_program_event_path(@conference.short_title, @event))
end end
else else
@url = admin_conference_event_path(@conference.short_title, @event) @url = admin_conference_program_event_path(@conference.short_title, @event)
flash[:notice] = 'Update not successful. ' + @event.errors.full_messages.to_sentence flash[:notice] = 'Update not successful. ' + @event.errors.full_messages.to_sentence
render :edit render :edit
end end
@ -123,8 +122,8 @@ module Admin
def create; end def create; end
def accept def accept
send_mail = @event.conference.email_settings.send_on_accepted send_mail = @event.program.conference.email_settings.send_on_accepted
subject = @event.conference.email_settings.accepted_subject.blank? subject = @event.program.conference.email_settings.accepted_subject.blank?
update_state(:accept, 'Event accepted!', true, subject, send_mail) update_state(:accept, 'Event accepted!', true, subject, send_mail)
end end
@ -137,8 +136,8 @@ module Admin
end end
def reject def reject
send_mail = @event.conference.email_settings.send_on_rejected send_mail = @event.program.conference.email_settings.send_on_rejected
subject = @event.conference.email_settings.rejected_subject.blank? subject = @event.program.conference.email_settings.rejected_subject.blank?
update_state(:reject, 'Event rejected!', true, subject, send_mail) update_state(:reject, 'Event rejected!', true, subject, send_mail)
end end
@ -159,7 +158,7 @@ module Admin
end end
respond_to do |format| respond_to do |format|
format.html { redirect_to admin_conference_event_path(@conference.short_title, @event) } format.html { redirect_to admin_conference_program_event_path(@conference.short_title, @event) }
format.js format.js
end end
end end
@ -181,9 +180,9 @@ module Admin
end end
def get_event def get_event
@event = @conference.events.find_by_id(params[:id]) @event = @conference.program.events.find(params[:id])
if !@event if !@event
redirect_to(admin_conference_events_path(conference_id: @conference.short_title), redirect_to(admin_conference_program_events_path(conference_id: @conference.short_title),
alert: 'Error! Could not find event!') && return alert: 'Error! Could not find event!') && return
end end
@event @event
@ -194,10 +193,10 @@ module Admin
if alert.blank? if alert.blank?
flash[:notice] = notice flash[:notice] = notice
redirect_back_or_to(admin_conference_events_path(conference_id: @conference.short_title)) && return redirect_back_or_to(admin_conference_program_events_path(conference_id: @conference.short_title)) && return
else else
flash[:error] = alert flash[:error] = alert
return redirect_back_or_to(admin_conference_events_path(conference_id: @conference.short_title)) && return return redirect_back_or_to(admin_conference_program_events_path(conference_id: @conference.short_title)) && return
end end
end end
end end

View file

@ -0,0 +1,32 @@
module Admin
class ProgramsController < Admin::BaseController
load_and_authorize_resource :conference, find_by: :short_title
load_and_authorize_resource through: :conference, singleton: true
def show; end
def edit; end
def update
authorize! :update, @conference.program
@program = @conference.program
@program.assign_attributes(params[:program])
# send_mail_on_schedule_public = @program.notify_on_schedule_public?
if @program.update_attributes(params[:program])
# Mailbot.delay.send_on_schedule_public(@conference) if send_mail_on_schedule_public
redirect_to(admin_conference_program_path(@conference.short_title),
notice: 'The program was successfully updated.')
else
flash[:error] = "Updating program failed. #{@program.errors.to_a.join('. ')}."
render :new
end
end
private
def program_params
params[:program]
end
end
end

View file

@ -1,23 +1,22 @@
module Admin module Admin
class RoomsController < Admin::BaseController class RoomsController < Admin::BaseController
load_and_authorize_resource :conference, find_by: :short_title load_and_authorize_resource :conference, find_by: :short_title
load_and_authorize_resource through: :conference load_and_authorize_resource :program, through: :conference, singleton: true
load_and_authorize_resource through: :program
def index def index; end
authorize! :index, Room.new(conference_id: @conference.id)
end
def edit; end def edit; end
def new def new
@room = @conference.rooms.new @room = @program.rooms.new
end end
def create def create
@room = @conference.rooms.new(room_params) @room = @program.rooms.new(room_params)
if @room.save if @room.save
flash[:notice] = 'Room successfully created.' flash[:notice] = 'Room successfully created.'
redirect_to(admin_conference_rooms_path(conference_id: @conference.short_title)) redirect_to(admin_conference_program_rooms_path(conference_id: @conference.short_title))
else else
flash[:error] = "Creating Room failed: #{@room.errors.full_messages.join('. ')}." flash[:error] = "Creating Room failed: #{@room.errors.full_messages.join('. ')}."
render :new render :new
@ -27,7 +26,7 @@ module Admin
def update def update
if @room.update_attributes(room_params) if @room.update_attributes(room_params)
flash[:notice] = 'Room successfully updated.' flash[:notice] = 'Room successfully updated.'
redirect_to(admin_conference_rooms_path(conference_id: @conference.short_title)) redirect_to(admin_conference_program_rooms_path(conference_id: @conference.short_title))
else else
flash[:error] = "Update Room failed: #{@room.errors.full_messages.join('. ')}." flash[:error] = "Update Room failed: #{@room.errors.full_messages.join('. ')}."
render :edit render :edit
@ -37,10 +36,10 @@ module Admin
def destroy def destroy
if @room.destroy if @room.destroy
flash[:notice] = 'Room successfully deleted.' flash[:notice] = 'Room successfully deleted.'
redirect_to(admin_conference_rooms_path(conference_id: @conference.short_title)) redirect_to(admin_conference_program_rooms_path(conference_id: @conference.short_title))
else else
flash[:error] = "Destroying room failed! #{@room.errors.full_messages.join('. ')}." flash[:error] = "Destroying room failed! #{@room.errors.full_messages.join('. ')}."
redirect_to(admin_conference_rooms_path(conference_id: @conference.short_title)) redirect_to(admin_conference_program_rooms_path(conference_id: @conference.short_title))
end end
end end

View file

@ -3,23 +3,24 @@ module Admin
# By authorizing 'conference' resource, we can ensure there will be no unauthorized access to # By authorizing 'conference' resource, we can ensure there will be no unauthorized access to
# the schedule of a conference, which should not be accessed in the first place # the schedule of a conference, which should not be accessed in the first place
load_and_authorize_resource :conference, find_by: :short_title load_and_authorize_resource :conference, find_by: :short_title
load_and_authorize_resource :program, through: :conference, singleton: true
skip_before_filter :verify_authenticity_token, only: [:update] skip_before_filter :verify_authenticity_token, only: [:update]
layout 'schedule' layout 'schedule'
def show def show
authorize! :update, @conference.events.new authorize! :update, @program.events.new
if @conference.nil? if @conference.nil?
redirect_to admin_conference_index_path redirect_to admin_conference_index_path
return return
end end
@dates = @conference.start_date..@conference.end_date @dates = @conference.start_date..@conference.end_date
@rooms = @conference.rooms @rooms = @program.rooms
end end
def update def update
authorize! :update, @conference.events.new authorize! :update, @program.events.new
event = Event.where(guid: event_params).first event = Event.where(guid: params[:event]).first
error_message = nil error_message = nil
if event.nil? if event.nil?
error_message = "Could not find event GUID: #{params[:event]}" error_message = "Could not find event GUID: #{params[:event]}"

View file

@ -1,7 +1,8 @@
module Admin module Admin
class TracksController < Admin::BaseController class TracksController < Admin::BaseController
load_and_authorize_resource :conference, find_by: :short_title load_and_authorize_resource :conference, find_by: :short_title
load_and_authorize_resource :track, through: :conference load_and_authorize_resource :program, through: :conference, singleton: true
load_and_authorize_resource through: :program
def index; end def index; end
@ -13,14 +14,14 @@ module Admin
end end
def new def new
@track = @conference.tracks.new @track = @program.tracks.new
end end
def create def create
@track = @conference.tracks.new(track_params) @track = @program.tracks.new(track_params)
if @track.save if @track.save
flash[:notice] = 'Track successfully created.' flash[:notice] = 'Track successfully created.'
redirect_to(admin_conference_tracks_path(conference_id: @conference.short_title)) redirect_to(admin_conference_program_tracks_path(conference_id: @conference.short_title))
else else
flash[:error] = "Creating Track failed: #{@track.errors.full_messages.join('. ')}." flash[:error] = "Creating Track failed: #{@track.errors.full_messages.join('. ')}."
render :new render :new
@ -32,7 +33,7 @@ module Admin
def update def update
if @track.update_attributes(track_params) if @track.update_attributes(track_params)
flash[:notice] = 'Track successfully updated.' flash[:notice] = 'Track successfully updated.'
redirect_to(admin_conference_tracks_path(conference_id: @conference.short_title)) redirect_to(admin_conference_program_tracks_path(conference_id: @conference.short_title))
else else
flash[:error] = "Track update failed: #{@track.errors.full_messages.join('. ')}." flash[:error] = "Track update failed: #{@track.errors.full_messages.join('. ')}."
render :edit render :edit
@ -42,10 +43,10 @@ module Admin
def destroy def destroy
if @track.destroy if @track.destroy
flash[:notice] = 'Track successfully deleted.' flash[:notice] = 'Track successfully deleted.'
redirect_to(admin_conference_tracks_path(conference_id: @conference.short_title)) redirect_to(admin_conference_program_tracks_path(conference_id: @conference.short_title))
else else
flash[:error] = "Track couldn't be deleted. #{@track.errors.full_messages.join('. ')}." flash[:error] = "Track couldn't be deleted. #{@track.errors.full_messages.join('. ')}."
redirect_to(admin_conference_tracks_path(conference_id: @conference.short_title)) redirect_to(admin_conference_program_tracks_path(conference_id: @conference.short_title))
end end
end end

View file

@ -8,7 +8,7 @@ class CommercialsController < ApplicationController
authorize! :create, @commercial authorize! :create, @commercial
if @commercial.save if @commercial.save
redirect_to edit_conference_proposal_path(conference_id: @conference.short_title, id: @event.id, anchor: 'commercials-content'), redirect_to edit_conference_program_proposal_path(conference_id: @conference.short_title, id: @event.id, anchor: 'commercials-content'),
notice: 'Commercial was successfully created.' notice: 'Commercial was successfully created.'
else else
flash[:error] = "An error prohibited this Commercial from being saved: #{@commercial.errors.full_messages.join('. ')}." flash[:error] = "An error prohibited this Commercial from being saved: #{@commercial.errors.full_messages.join('. ')}."
@ -18,7 +18,7 @@ class CommercialsController < ApplicationController
def update def update
if @commercial.update(commercial_params) if @commercial.update(commercial_params)
redirect_to edit_conference_proposal_path(conference_id: @conference.short_title, id: @event.id, anchor: 'commercials-content'), redirect_to edit_conference_program_proposal_path(conference_id: @conference.short_title, id: @event.id, anchor: 'commercials-content'),
notice: 'Commercial was successfully updated.' notice: 'Commercial was successfully updated.'
else else
flash[:error] = "An error prohibited this Commercial from being saved: #{@commercial.errors.full_messages.join('. ')}." flash[:error] = "An error prohibited this Commercial from being saved: #{@commercial.errors.full_messages.join('. ')}."
@ -28,7 +28,7 @@ class CommercialsController < ApplicationController
def destroy def destroy
@commercial.destroy @commercial.destroy
redirect_to edit_conference_proposal_path(conference_id: @conference.short_title, id: @event.id, anchor: 'commercials-content'), redirect_to edit_conference_program_proposal_path(conference_id: @conference.short_title, id: @event.id),
notice: 'Commercial was successfully destroyed.' notice: 'Commercial was successfully destroyed.'
end end
@ -44,7 +44,7 @@ class CommercialsController < ApplicationController
private private
def set_event def set_event
@event = @conference.events.find(params[:proposal_id]) @event = @conference.program.events.find(params[:proposal_id])
end end
def commercial_params def commercial_params

View file

@ -1,6 +1,7 @@
class ConferenceController < ApplicationController class ConferenceController < ApplicationController
before_filter :respond_to_options before_filter :respond_to_options
load_and_authorize_resource find_by: :short_title load_and_authorize_resource find_by: :short_title
load_resource :program, through: :conference, singleton: true, except: :index
def index def index
@current = Conference.where('end_date >= ?', Date.current).order('start_date ASC') @current = Conference.where('end_date >= ?', Date.current).order('start_date ASC')
@ -10,8 +11,8 @@ class ConferenceController < ApplicationController
def show; end def show; end
def schedule def schedule
@rooms = @conference.rooms @rooms = @conference.program.rooms
@events = @conference.events @events = @conference.program.events
@dates = @conference.start_date..@conference.end_date @dates = @conference.start_date..@conference.end_date
if @dates == Date.current if @dates == Date.current

View file

@ -1,7 +1,8 @@
class ProposalController < ApplicationController class ProposalController < ApplicationController
before_filter :authenticate_user!, except: [:show, :new, :create] before_filter :authenticate_user!, except: [:show, :new, :create]
load_resource :conference, find_by: :short_title load_resource :conference, find_by: :short_title
load_and_authorize_resource :event, parent: false, through: :conference load_resource :program, through: :conference, singleton: true
load_and_authorize_resource :event, parent: false, through: :program
def index def index
@events = current_user.proposals(@conference) @events = current_user.proposals(@conference)
@ -14,16 +15,16 @@ class ProposalController < ApplicationController
def new def new
@user = User.new @user = User.new
@url = conference_proposal_index_path(@conference.short_title) @url = conference_program_proposal_index_path(@conference.short_title)
end end
def edit def edit
authorize! :edit, @event authorize! :edit, @event
@url = conference_proposal_path(@conference.short_title, params[:id]) @url = conference_program_proposal_path(@conference.short_title, params[:id])
end end
def create def create
@url = conference_proposal_index_path(@conference.short_title) @url = conference_program_proposal_index_path(@conference.short_title)
unless current_user unless current_user
@user = User.new(user_params) @user = User.new(user_params)
@ -38,8 +39,8 @@ class ProposalController < ApplicationController
params[:event].delete :user params[:event].delete :user
@event = Event.new(event_params) @event = Event.new(params[:event])
@event.conference = @conference @event.program = @program
@event.event_users.new(user: current_user, @event.event_users.new(user: current_user,
event_role: 'submitter') event_role: 'submitter')
@ -55,12 +56,12 @@ class ProposalController < ApplicationController
ahoy.track 'Event submission', title: 'New submission' ahoy.track 'Event submission', title: 'New submission'
flash[:notice] = 'Proposal was successfully submitted.' flash[:notice] = 'Proposal was successfully submitted.'
redirect_to conference_proposal_index_path(@conference.short_title) redirect_to conference_program_proposal_index_path(@conference.short_title)
end end
def update def update
authorize! :update, @event authorize! :update, @event
@url = conference_proposal_path(@conference.short_title, params[:id]) @url = conference_program_proposal_path(@conference.short_title, params[:id])
if !@event.update(event_params) if !@event.update(event_params)
flash[:error] = "Could not update proposal: #{@event.errors.full_messages.join(', ')}" flash[:error] = "Could not update proposal: #{@event.errors.full_messages.join(', ')}"
@ -68,13 +69,13 @@ class ProposalController < ApplicationController
return return
end end
redirect_to(conference_proposal_index_path(conference_id: @conference.short_title), redirect_to(conference_program_proposal_index_path(conference_id: @conference.short_title),
notice: 'Proposal was successfully updated.') notice: 'Proposal was successfully updated.')
end end
def destroy def destroy
authorize! :destroy, @event authorize! :destroy, @event
@url = conference_proposal_path(@conference.short_title, params[:id]) @url = conference_program_proposal_path(@conference.short_title, params[:id])
begin begin
@event.withdraw @event.withdraw
@ -84,13 +85,13 @@ class ProposalController < ApplicationController
end end
@event.save(validate: false) @event.save(validate: false)
redirect_to(conference_proposal_index_path(conference_id: @conference.short_title), redirect_to(conference_program_proposal_index_path(conference_id: @conference.short_title),
notice: 'Proposal was successfully withdrawn.') notice: 'Proposal was successfully withdrawn.')
end end
def confirm def confirm
authorize! :update, @event authorize! :update, @event
@url = conference_proposal_path(@conference.short_title, params[:id]) @url = conference_program_proposal_path(@conference.short_title, params[:id])
begin begin
@event.confirm! @event.confirm!
@ -106,7 +107,7 @@ class ProposalController < ApplicationController
end end
if @conference.user_registered?(current_user) if @conference.user_registered?(current_user)
redirect_to(conference_proposal_index_path(@conference.short_title), redirect_to(conference_program_proposal_index_path(@conference.short_title),
notice: 'The proposal was confirmed.') notice: 'The proposal was confirmed.')
else else
redirect_to(new_conference_conference_registrations_path(conference_id: @conference.short_title), redirect_to(new_conference_conference_registrations_path(conference_id: @conference.short_title),
@ -116,12 +117,12 @@ class ProposalController < ApplicationController
def restart def restart
authorize! :update, @event authorize! :update, @event
@url = conference_proposal_path(@conference.short_title, params[:id]) @url = conference_program_proposal_path(@conference.short_title, params[:id])
begin begin
@event.restart @event.restart
rescue Transitions::InvalidTransition rescue Transitions::InvalidTransition
redirect_to(conference_proposal_index_path(conference_id: @conference.short_title), redirect_to(conference_program_proposal_index_path(conference_id: @conference.short_title),
error: "The proposal can't be re-submitted.") error: "The proposal can't be re-submitted.")
return return
end end
@ -132,7 +133,7 @@ class ProposalController < ApplicationController
return return
end end
redirect_to(conference_proposal_index_path(conference_id: @conference.short_title), redirect_to(conference_program_proposal_index_path(conference_id: @conference.short_title),
notice: "The proposal was re-submitted. The #{@conference.short_title} organizers will review it again.") notice: "The proposal was re-submitted. The #{@conference.short_title} organizers will review it again.")
end end

View file

@ -159,7 +159,7 @@ module ApplicationHelper
end end
def pre_registered(event) def pre_registered(event)
@conference.events.joins(:registrations).where('events.id = ?', event.id) @conference.program.events.joins(:registrations).where('events.id = ?', event.id)
end end
def add_association_link(association_name, form_builder, div_class, html_options = {}) def add_association_link(association_name, form_builder, div_class, html_options = {})
@ -184,7 +184,7 @@ module ApplicationHelper
end end
def event_types(conference) def event_types(conference)
all = conference.event_types.map { |et | et.title.pluralize } all = conference.program.event_types.map { |et | et.title.pluralize }
first = all[0...-1] first = all[0...-1]
last = all[-1] last = all[-1]
ets = '' ets = ''
@ -198,7 +198,21 @@ module ApplicationHelper
end end
def tracks(conference) def tracks(conference)
all = conference.tracks.map {|t| t.name} all = conference.program.tracks.map {|t| t.name}
first = all[0...-1]
last = all[-1]
ts = ''
if all.length > 1
ts << first.join(', ')
ts << " and #{last}"
else
ts = all.join
end
return ts
end
def difficulty_levels(conference)
all = conference.program.difficulty_levels.map {|t| t.title}
first = all[0...-1] first = all[0...-1]
last = all[-1] last = all[-1]
ts = '' ts = ''

View file

@ -66,17 +66,17 @@ class Mailbot < ActionMailer::Base
User.joins(:subscriptions).merge(conference.subscriptions) do |user| User.joins(:subscriptions).merge(conference.subscriptions) do |user|
build_email(conference, build_email(conference,
user.email, user.email,
conference.email_settings.call_for_papers_schedule_public_subject, conference.email_settings.program_schedule_public_subject,
conference.email_settings.generate_email_on_conf_updates(conference, user, conference.email_settings.call_for_papers_schedule_public_body)) conference.email_settings.generate_email_on_conf_updates(conference, user, conference.email_settings.program_schedule_public_body))
end end
end end
def send_on_call_for_papers_dates_updated(conference) def send_on_cfp_dates_updates(conference)
User.joins(:subscriptions).merge(conference.subscriptions) do |user| User.joins(:subscriptions).merge(conference.subscriptions) do |user|
build_email(conference, build_email(conference,
user.email, user.email,
conference.email_settings.call_for_papers_dates_updated_subject, conference.email_settings.cfp_dates_updated_subject,
conference.email_settings.generate_email_on_conf_updates(conference, user, conference.email_settings.call_for_papers_dates_updated_body)) conference.email_settings.generate_email_on_conf_updates(conference, user, conference.email_settings.cfp_dates_updated_body))
end end
end end

View file

@ -39,7 +39,7 @@ class Ability
end end
# Can view the schedule # Can view the schedule
can [:schedule], Conference do |conference| can [:schedule], Conference do |conference|
conference.call_for_paper && conference.call_for_paper.schedule_public conference.program.cfp && conference.program.schedule_public
end end
can :show, Event do |event| can :show, Event do |event|
@ -53,9 +53,13 @@ class Ability
can [:show, :create], Registration do |registration| can [:show, :create], Registration do |registration|
registration.new_record? registration.new_record?
end end
can [:show, :create], Event do |event| can :show, Event do |event|
event.new_record? event.new_record?
end end
can [:new, :create], Event do |event|
event.program.cfp_open? && event.new_record?
end
end end
end end
@ -77,7 +81,7 @@ class Ability
event.users.include?(user) event.users.include?(user)
end end
# can create an event until the last day of a conference # can create an event until the last day of a conference
can :create, Event, conference_id: Conference.where('end_date >= ?', Date.today).pluck(:id) can :create, Event, program_id: Conference.where('end_date >= ?', Date.today).map { |conference| conference.program.id}.compact
# can manage the commercials of their own events # can manage the commercials of their own events
can :manage, Commercial, commercialable_type: 'Event', commercialable_id: user.events.pluck(:id) can :manage, Commercial, commercialable_type: 'Event', commercialable_id: user.events.pluck(:id)
@ -100,6 +104,8 @@ class Ability
cannot [:edit, :update, :destroy], Question, global: true cannot [:edit, :update, :destroy], Question, global: true
# for admins # for admins
can :manage, :all if user.is_admin can :manage, :all if user.is_admin
cannot :destroy, Program
end end
def signed_in_with_organizer_role(user) def signed_in_with_organizer_role(user)
@ -125,21 +131,22 @@ class Ability
end end
can :manage, Vposition, conference_id: conf_ids_for_organizer can :manage, Vposition, conference_id: conf_ids_for_organizer
can :manage, Vday, conference_id: conf_ids_for_organizer can :manage, Vday, conference_id: conf_ids_for_organizer
can :manage, CallForPaper, conference_id: conf_ids_for_organizer can :manage, Program, conference_id: conf_ids_for_organizer
can :manage, Event, conference_id: conf_ids_for_organizer can :manage, Cfp, program: { conference_id: conf_ids_for_organizer}
can :manage, EventType, conference_id: conf_ids_for_organizer can :manage, Event, program: { conference_id: conf_ids_for_organizer}
can :manage, Track, conference_id: conf_ids_for_organizer can :manage, EventType, program: { conference_id: conf_ids_for_organizer}
can :manage, DifficultyLevel, conference_id: conf_ids_for_organizer can :manage, Track, program: { conference_id: conf_ids_for_organizer}
can :manage, DifficultyLevel, program: { conference_id: conf_ids_for_organizer}
can :manage, Commercial, commercialable_type: 'Event', can :manage, Commercial, commercialable_type: 'Event',
commercialable_id: Event.where(conference_id: conf_ids_for_organizer).pluck(:id) commercialable_id: Event.where(program_id: Program.where(conference_id: conf_ids_for_organizer).pluck(:id)).pluck(:id)
can :manage, Venue, conference_id: conf_ids_for_organizer can :manage, Venue, conference_id: conf_ids_for_organizer
can :manage, Lodging, conference_id: conf_ids_for_organizer can :manage, Lodging, conference_id: conf_ids_for_organizer
can :manage, Room, conference_id: conf_ids_for_organizer can :manage, Room, program: { conference_id: conf_ids_for_organizer}
can :manage, Sponsor, conference_id: conf_ids_for_organizer can :manage, Sponsor, conference_id: conf_ids_for_organizer
can :manage, SponsorshipLevel, conference_id: conf_ids_for_organizer can :manage, SponsorshipLevel, conference_id: conf_ids_for_organizer
can :manage, Ticket, conference_id: conf_ids_for_organizer can :manage, Ticket, conference_id: conf_ids_for_organizer
can :index, Comment, commentable_type: 'Event', can :index, Comment, commentable_type: 'Event',
commentable_id: Event.where(conference_id: conf_ids_for_organizer).pluck(:id) commentable_id: Event.where(program_id: Program.where(conference_id: conf_ids_for_organizer).pluck(:id)).pluck(:id)
end end
def signed_in_with_cfp_role(user) def signed_in_with_cfp_role(user)
@ -148,18 +155,19 @@ class Ability
conf_ids_for_cfp = conf_ids_for_cfp =
Conference.with_role(:cfp, user).pluck(:id) if user.has_role? :cfp, :any Conference.with_role(:cfp, user).pluck(:id) if user.has_role? :cfp, :any
can :manage, Event, conference_id: conf_ids_for_cfp can :manage, Event, program: { conference_id: conf_ids_for_cfp }
can :manage, EventType, conference_id: conf_ids_for_cfp can :manage, EventType, program: { conference_id: conf_ids_for_cfp }
can :manage, Track, conference_id: conf_ids_for_cfp can :manage, Track, program: { conference_id: conf_ids_for_cfp }
can :manage, DifficultyLevel, conference_id: conf_ids_for_cfp can :manage, DifficultyLevel, program: { conference_id: conf_ids_for_cfp }
can :manage, EmailSettings, conference_id: conf_ids_for_cfp can :manage, EmailSettings, conference_id: conf_ids_for_cfp
can :manage, Room, conference_id: conf_ids_for_cfp can :manage, Room, program: { conference_id: conf_ids_for_cfp }
can :show, Venue, conference_id: conf_ids_for_cfp can :index, Venue, conference_id: conf_ids_for_cfp
can :manage, CallForPaper, conference_id: conf_ids_for_cfp can :manage, Cfp, program: { conference_id: conf_ids_for_cfp }
can :manage, Program, conference_id: conf_ids_for_cfp
can :manage, Commercial, commercialable_type: 'Event', can :manage, Commercial, commercialable_type: 'Event',
commercialable_id: Event.where(conference_id: conf_ids_for_cfp).pluck(:id) commercialable_id: Event.where(program_id: Program.where(conference_id: conf_ids_for_cfp).pluck(:id)).pluck(:id)
can :index, Comment, commentable_type: 'Event', can :index, Comment, commentable_type: 'Event',
commentable_id: Event.where(conference_id: conf_ids_for_cfp).pluck(:id) commentable_id: Event.where(program_id: Program.where(conference_id: conf_ids_for_cfp).pluck(:id)).pluck(:id)
end end
def signed_in_with_info_desk_role(user) def signed_in_with_info_desk_role(user)

117
app/models/ahoy/program.rb Normal file
View file

@ -0,0 +1,117 @@
# cannot delete program if there are events submitted
class Program < ActiveRecord::Base
belongs_to :conference
has_one :cfp, dependent: :destroy
has_many :event_types, dependent: :destroy
has_many :tracks, dependent: :destroy
has_many :difficulty_levels, dependent: :destroy
has_many :rooms, dependent: :destroy
has_many :events, dependent: :destroy do
def workshops
where(require_registration: true, state: :confirmed)
end
def confirmed
where(state: :confirmed)
end
def scheduled
where.not(start_time: nil)
end
def highlights
where(state: :confirmed, is_highlight: true)
end
end
has_many :event_users, through: :events
has_many :speakers, -> { distinct }, through: :event_users, source: :user do
def confirmed
joins(:events).where(events: { state: :confirmed })
end
end
accepts_nested_attributes_for :event_types, allow_destroy: true
accepts_nested_attributes_for :tracks, reject_if: proc { |r| r['name'].blank? }, allow_destroy: true
accepts_nested_attributes_for :difficulty_levels, allow_destroy: true
accepts_nested_attributes_for :rooms, reject_if: proc { |r| r['name'].blank? }, allow_destroy: true
attr_accessible :schedule_fluid, :rating,
:schedule_public, :include_cfp_in_splash, :conference_id,
:event_types_attributes, :difficulty_levels_attributes, :rooms_attributes, :tracks_attributes
# validates :conference_id, presence: true, uniqueness: true
validates :rating, numericality: { greater_than_or_equal_to: 0, less_than_or_equal_to: 10 }
before_create :create_event_types
before_create :create_difficulty_levels
##
# Checcks if the program has rating enabled
#
# ====Returns
# * +false+ -> If rating is not enabled
# * +true+ -> If rating is enabled
def rating_enabled?
self.rating && self.rating > 0
end
##
# Checks if the call for papers for the conference is currently open
#
# ====Returns
# * +false+ -> If the CFP is not set or today isn't in the CFP period.
# * +true+ -> If today is in the CFP period.
def cfp_open?
cfp = self.cfp
cfp.present? && (cfp.start_date..cfp.end_date).cover?(Date.current)
end
##
# Checks whether cfp dates is updated
#
# ====Returns
# * +True+ -> If cfp dates is updated and all other parameters are set
# * +False+ -> Either cfp date is not updated or one or more parameter is not set
def notify_on_schedule_public?
self.cfp && !self.cfp.end_date.blank? && !self.cfp.start_date.blank?\
&& (self.cfp.start_date_changed? || self.cfp.end_date_changed?)\
&& self.conference.email_settings.send_on_cfp_dates_updates\
&& !self.conference.email_settings.cfp_dates_updates_subject.blank?\
&& !self.conference.email_settings.cfp_dates_updates_template.blank?
end
private
##
# Creates default EventTypes for this Conference. Used as before_create.
#
def create_event_types
event_types << EventType.create(title: 'Talk', length: 30, color: '#FF0000', description: 'Presentation in lecture format',
minimum_abstract_length: 0,
maximum_abstract_length: 500)
event_types << EventType.create(title: 'Workshop', length: 60, color: '#0000FF', description: 'Interactive hands-on practice',
minimum_abstract_length: 0,
maximum_abstract_length: 500)
true
end
##
# Creates default DifficultyLevels for this Conference. Used as before_create.
#
def create_difficulty_levels
difficulty_levels << DifficultyLevel.create(title: 'Easy',
description: 'Events are understandable for everyone without knowledge of the topic.',
color: '#70EF69')
difficulty_levels << DifficultyLevel.create(title: 'Medium',
description: 'Events require a basic understanding of the topic.',
color: '#EEEF69')
difficulty_levels << DifficultyLevel.create(title: 'Hard',
description: 'Events require expert knowledge of the topic.',
color: '#EF6E69')
true
end
end

73
app/models/cfp.rb Normal file
View file

@ -0,0 +1,73 @@
# cannot delete program if there are events submitted
class Cfp < ActiveRecord::Base
belongs_to :program
attr_accessible :start_date, :end_date, :program_id
validates :program_id, presence: true, uniqueness: true
validates :start_date, :end_date, presence: true
validate :before_end_of_conference
validate :start_after_end_date
##
# Checks whether cfp date is updated
#
# ====Returns
# * +True+ -> If cfp dates is updated and all other parameters are set
# * +False+ -> Either cfp date is not updated or one or more parameter is not set
def notify_on_cfp_date_update?
!self.end_date.blank? && !self.start_date.blank?\
&& (self.start_date_changed? || self.end_date_changed?)\
&& self.program.conference.email_settings.send_on_cfp_dates_updates\
&& !self.program.conference.email_settings.cfp_dates_updates_subject.blank?\
&& !self.program.conference.email_settings.cfp_dates_updates_template.blank?
end
##
# Calculates how many weeks the call for paper is.
#
# ====Returns
# * +Integer+ -> start week
def weeks
result = end_week - start_week + 1
weeks = Date.new(start_date.year, 12, 31).strftime('%W').to_i
result < 0 ? result + weeks : result
end
##
# Calculates the end week of the cfp
#
# ====Returns
def start_week
start_date.strftime('%W').to_i
end
##
# Calculates the end week of the cfp
#
# ====Returns
def end_week
end_date.strftime('%W').to_i
end
def remaining_days(date = Date.today)
result = (self.end_date - date).to_i
result > 0 ? result : 0
end
private
def before_end_of_conference
errors.
add(:end_date, "can't be after the conference end date (#{program.conference.end_date})") if program.conference && program.conference.end_date && end_date && (end_date > program.conference.end_date)
errors.
add(:start_date, "can't be after the conference end date (#{program.conference.end_date})") if program.conference && program.conference.end_date && start_date && (start_date > program.conference.end_date)
end
def start_after_end_date
errors.
add(:start_date, "can't be after the end date") if start_date && end_date && start_date > end_date
end
end

View file

@ -16,40 +16,14 @@ class Conference < ActiveRecord::Base
has_one :contact, dependent: :destroy has_one :contact, dependent: :destroy
has_one :registration_period, dependent: :destroy has_one :registration_period, dependent: :destroy
has_one :email_settings, dependent: :destroy has_one :email_settings, dependent: :destroy
has_one :call_for_paper, dependent: :destroy has_one :program, dependent: :destroy
has_one :venue, dependent: :destroy has_one :venue, dependent: :destroy
has_many :social_events, dependent: :destroy has_many :social_events, dependent: :destroy
has_many :ticket_purchases, dependent: :destroy has_many :ticket_purchases, dependent: :destroy
has_many :supporters, through: :ticket_purchases, source: :user has_many :supporters, through: :ticket_purchases, source: :user
has_many :tickets, dependent: :destroy has_many :tickets, dependent: :destroy
has_many :dietary_choices, dependent: :destroy has_many :dietary_choices, dependent: :destroy
has_many :events, dependent: :destroy do
def workshops
where(require_registration: true, state: :confirmed)
end
def confirmed
where(state: :confirmed)
end
def scheduled
where.not(start_time: nil)
end
def highlights
where(state: :confirmed, is_highlight: true)
end
end
has_many :event_users, through: :events
has_many :speakers, -> { distinct }, through: :event_users, source: :user do
def confirmed
joins(:events).where(events: { state: :confirmed })
end
end
has_many :event_types, dependent: :destroy
has_many :tracks, dependent: :destroy
has_many :difficulty_levels, dependent: :destroy
has_many :rooms, dependent: :destroy
has_many :lodgings, dependent: :destroy has_many :lodgings, dependent: :destroy
has_many :registrations, dependent: :destroy has_many :registrations, dependent: :destroy
has_many :participants, through: :registrations, source: :user has_many :participants, through: :registrations, source: :user
@ -63,16 +37,12 @@ class Conference < ActiveRecord::Base
has_many :commercials, as: :commercialable, dependent: :destroy has_many :commercials, as: :commercialable, dependent: :destroy
has_many :subscriptions, dependent: :destroy has_many :subscriptions, dependent: :destroy
accepts_nested_attributes_for :rooms, reject_if: proc { |r| r['name'].blank? }, allow_destroy: true
accepts_nested_attributes_for :tracks, reject_if: proc { |r| r['name'].blank? }, allow_destroy: true
accepts_nested_attributes_for :difficulty_levels, allow_destroy: true
accepts_nested_attributes_for :social_events, allow_destroy: true accepts_nested_attributes_for :social_events, allow_destroy: true
accepts_nested_attributes_for :venue accepts_nested_attributes_for :venue
accepts_nested_attributes_for :dietary_choices, allow_destroy: true accepts_nested_attributes_for :dietary_choices, allow_destroy: true
accepts_nested_attributes_for :tickets, allow_destroy: true accepts_nested_attributes_for :tickets, allow_destroy: true
accepts_nested_attributes_for :sponsorship_levels, allow_destroy: true accepts_nested_attributes_for :sponsorship_levels, allow_destroy: true
accepts_nested_attributes_for :sponsors, allow_destroy: true accepts_nested_attributes_for :sponsors, allow_destroy: true
accepts_nested_attributes_for :event_types, allow_destroy: true
accepts_nested_attributes_for :email_settings accepts_nested_attributes_for :email_settings
accepts_nested_attributes_for :questions, allow_destroy: true accepts_nested_attributes_for :questions, allow_destroy: true
accepts_nested_attributes_for :vdays, allow_destroy: true accepts_nested_attributes_for :vdays, allow_destroy: true
@ -99,10 +69,8 @@ class Conference < ActiveRecord::Base
# This validation is needed since a conference with a start date greater than the end date is not possible # This validation is needed since a conference with a start date greater than the end date is not possible
validate :valid_date_range? validate :valid_date_range?
before_create :generate_guid before_create :generate_guid
before_create :create_event_types
before_create :create_difficulty_levels
before_create :create_email_settings
before_create :add_color before_create :add_color
before_create :create_email_settings
def date_range_string def date_range_string
startstr = 'Unknown - ' startstr = 'Unknown - '
@ -158,18 +126,6 @@ class Conference < ActiveRecord::Base
registration_period.end_date.present? registration_period.end_date.present?
end end
##
# Checks if the call for papers for the conference is currently open
#
# ====Returns
# * +false+ -> If the CFP is not set or today isn't in the CFP period.
# * +true+ -> If today is in the CFP period.
def cfp_open?
cfp = self.call_for_paper
cfp.present? && (cfp.start_date..cfp.end_date).cover?(Date.current)
end
## ##
# Returns an array with the summarized event submissions per week. # Returns an array with the summarized event submissions per week.
# #
@ -178,10 +134,10 @@ class Conference < ActiveRecord::Base
def get_submissions_per_week def get_submissions_per_week
result = [] result = []
if call_for_paper && events if program && program.cfp && program.events
submissions = events.group(:week).count submissions = program.events.group(:week).count
start_week = call_for_paper.start_week start_week = program.cfp.start_week
weeks = call_for_paper.weeks weeks = program.cfp.weeks
result = calculate_items_per_week(start_week, weeks, submissions) result = calculate_items_per_week(start_week, weeks, submissions)
end end
result result
@ -195,10 +151,10 @@ class Conference < ActiveRecord::Base
# * +Array+ -> e.g. 'Submitted' => [0, 3, 3, 5] -> first week 0 events, second week 3 events. # * +Array+ -> e.g. 'Submitted' => [0, 3, 3, 5] -> first week 0 events, second week 3 events.
def get_submissions_data def get_submissions_data
result = {} result = {}
if call_for_paper && events if program && program.cfp && program.events
result = get_events_per_week_by_state result = get_events_per_week_by_state
start_week = call_for_paper.start_week start_week = program.cfp.start_week
end_week = end_date.strftime('%W').to_i end_week = end_date.strftime('%W').to_i
weeks = weeks(start_week, end_week) weeks = weeks(start_week, end_week)
@ -260,8 +216,8 @@ class Conference < ActiveRecord::Base
# ====Returns # ====Returns
# * +Integer+ -> weeks # * +Integer+ -> weeks
def cfp_weeks def cfp_weeks
if call_for_paper if program
call_for_paper.weeks program.cfp.weeks
else else
0 0
end end
@ -344,7 +300,7 @@ class Conference < ActiveRecord::Base
# * +hash+ -> user: submissions # * +hash+ -> user: submissions
def get_top_submitter(limit = 5) def get_top_submitter(limit = 5)
submitter = EventUser.joins(:event). submitter = EventUser.joins(:event).
where('event_role = ? and conference_id = ?', 'submitter', id). where('event_role = ? and program_id = ?', 'submitter', Conference.find(id).program.id).
limit(limit).group(:user_id) limit(limit).group(:user_id)
counter = submitter.order('count_all desc').count counter = submitter.order('count_all desc').count
Conference.calculate_user_submission_hash(submitter, counter) Conference.calculate_user_submission_hash(submitter, counter)
@ -366,7 +322,7 @@ class Conference < ActiveRecord::Base
# ====Returns # ====Returns
# * +hash+ -> hash # * +hash+ -> hash
def event_distribution def event_distribution
Conference.calculate_event_distribution_hash(events.select(:state).group(:state).count) Conference.calculate_event_distribution_hash(program.events.select(:state).group(:state).count)
end end
## ##
@ -391,7 +347,7 @@ class Conference < ActiveRecord::Base
# ====Returns # ====Returns
# * +hash+ -> Fixnum minutes # * +hash+ -> Fixnum minutes
def current_program_minutes def current_program_minutes
events_grouped = events.select(:event_type_id).group(:event_type_id) events_grouped = program.events.select(:event_type_id).group(:event_type_id)
events_counted = events_grouped.count events_counted = events_grouped.count
calculate_program_minutes(events_grouped, events_counted) calculate_program_minutes(events_grouped, events_counted)
end end
@ -411,7 +367,7 @@ class Conference < ActiveRecord::Base
# ====Returns # ====Returns
# * +hash+ -> Fixnum minutes # * +hash+ -> Fixnum minutes
def new_program_minutes(date) def new_program_minutes(date)
events_grouped = events.select(:event_type_id).where('created_at > ?', date).group(:event_type_id) events_grouped = program.events.select(:event_type_id).where('created_at > ?', date).group(:event_type_id)
events_counted = events_grouped.count events_counted = events_grouped.count
calculate_program_minutes(events_grouped, events_counted) calculate_program_minutes(events_grouped, events_counted)
end end
@ -450,9 +406,9 @@ class Conference < ActiveRecord::Base
# * +hash+ -> track => {color, value} # * +hash+ -> track => {color, value}
def tracks_distribution(state = nil) def tracks_distribution(state = nil)
if state if state
tracks_grouped = events.select(:track_id).where('state = ?', state).group(:track_id) tracks_grouped = program.events.select(:track_id).where('state = ?', state).group(:track_id)
else else
tracks_grouped = events.select(:track_id).group(:track_id) tracks_grouped = program.events.select(:track_id).group(:track_id)
end end
tracks_counted = tracks_grouped.count tracks_counted = tracks_grouped.count
@ -539,7 +495,7 @@ class Conference < ActiveRecord::Base
Conference.where('end_date > ?', Date.today).each do |conference| Conference.where('end_date > ?', Date.today).each do |conference|
result = {} result = {}
Event.state_machine.states.each do |state| Event.state_machine.states.each do |state|
count = conference.events.where('state = ?', state.name).count count = conference.program.events.where('state = ?', state.name).count
result[state.name] = count result[state.name] = count
end end
@ -584,6 +540,7 @@ class Conference < ActiveRecord::Base
after_create do after_create do
self.create_contact self.create_contact
self.create_program
end end
## ##
@ -631,10 +588,10 @@ class Conference < ActiveRecord::Base
# Actual week # Actual week
this_week = Date.today.end_of_week.strftime('%W').to_i this_week = Date.today.end_of_week.strftime('%W').to_i
result['Confirmed'][this_week] = events.where('state = ?', :confirmed).count result['Confirmed'][this_week] = program.events.where('state = ?', :confirmed).count
result['Unconfirmed'][this_week] = events.where('state = ?', :unconfirmed).count result['Unconfirmed'][this_week] = program.events.where('state = ?', :unconfirmed).count
result['Submitted'] = events.select(:week).group(:week).count result['Submitted'] = program.events.select(:week).group(:week).count
result['Submitted'][this_week] = events.where(week: this_week).count result['Submitted'][this_week] = program.events.where(week: this_week).count
result result
end end
@ -720,7 +677,7 @@ class Conference < ActiveRecord::Base
# * +True+ -> One difficulty level or more # * +True+ -> One difficulty level or more
# * +False+ -> No diffculty level # * +False+ -> No diffculty level
def difficulty_levels_set? def difficulty_levels_set?
difficulty_levels.count > 0 program.difficulty_levels.count > 0
end end
## ##
@ -730,7 +687,7 @@ class Conference < ActiveRecord::Base
# * +True+ -> One difficulty level or more # * +True+ -> One difficulty level or more
# * +False+ -> No diffculty level # * +False+ -> No diffculty level
def event_types_set? def event_types_set?
event_types.count > 0 program.event_types.count > 0
end end
## ##
@ -740,7 +697,7 @@ class Conference < ActiveRecord::Base
# * +True+ -> One track or more # * +True+ -> One track or more
# * +False+ -> No track # * +False+ -> No track
def tracks_set? def tracks_set?
tracks.count > 0 program.tracks.count > 0
end end
## ##
@ -750,7 +707,7 @@ class Conference < ActiveRecord::Base
# * +True+ -> One room or more # * +True+ -> One room or more
# * +False+ -> No room # * +False+ -> No room
def rooms_set? def rooms_set?
rooms.count > 0 program.rooms.count > 0
end end
# Checks if the conference has a venue object. # Checks if the conference has a venue object.
@ -769,7 +726,7 @@ class Conference < ActiveRecord::Base
# * +True+ -> If conference has a cfp object. # * +True+ -> If conference has a cfp object.
# * +False+ -> If conference has no cfp object. # * +False+ -> If conference has no cfp object.
def cfp_set? def cfp_set?
!!call_for_paper !!program.cfp
end end
## ##
@ -788,9 +745,9 @@ class Conference < ActiveRecord::Base
# * +hash+ -> object_type => {color, value} # * +hash+ -> object_type => {color, value}
def calculate_event_distribution(group_by_id, association_symbol, state = nil) def calculate_event_distribution(group_by_id, association_symbol, state = nil)
if state if state
grouped = events.select(group_by_id).where('state = ?', 'confirmed').group(group_by_id) grouped = program.events.select(group_by_id).where('state = ?', 'confirmed').group(group_by_id)
else else
grouped = events.select(group_by_id).group(group_by_id) grouped = program.events.select(group_by_id).group(group_by_id)
end end
counted = grouped.count counted = grouped.count
@ -910,35 +867,6 @@ class Conference < ActiveRecord::Base
result result
end end
##
# Creates default EventTypes for this Conference. Used as before_create.
#
def create_event_types
event_types << EventType.create(title: 'Talk', length: 30, color: '#FF0000', description: 'Presentation in lecture format',
minimum_abstract_length: 0,
maximum_abstract_length: 500)
event_types << EventType.create(title: 'Workshop', length: 60, color: '#0000FF', description: 'Interactive hands-on practice',
minimum_abstract_length: 0,
maximum_abstract_length: 500)
true
end
##
# Creates default DifficultyLevels for this Conference. Used as before_create.
#
def create_difficulty_levels
difficulty_levels << DifficultyLevel.create(title: 'Easy',
description: 'Events are understandable for everyone without knowledge of the topic.',
color: '#70EF69')
difficulty_levels << DifficultyLevel.create(title: 'Medium',
description: 'Events require a basic understanding of the topic.',
color: '#EEEF69')
difficulty_levels << DifficultyLevel.create(title: 'Hard',
description: 'Events require expert knowledge of the topic.',
color: '#EF6E69')
true
end
## ##
# Creates a EmailSettings association proxy. Used as before_create. # Creates a EmailSettings association proxy. Used as before_create.
# #

View file

@ -1,5 +1,5 @@
class DifficultyLevel < ActiveRecord::Base class DifficultyLevel < ActiveRecord::Base
belongs_to :conference belongs_to :program
has_many :events, dependent: :nullify has_many :events, dependent: :nullify
validates :title, presence: true validates :title, presence: true

View file

@ -15,9 +15,9 @@ class EmailSettings < ActiveRecord::Base
conference.short_title, host: CONFIG['url_for_emails']) conference.short_title, host: CONFIG['url_for_emails'])
} }
if conference.call_for_paper if conference.program.cfp
h['cfp_start_date'] = conference.call_for_paper.start_date h['cfp_start_date'] = conference.program.cfp.start_date
h['cfp_end_date'] = conference.call_for_paper.end_date h['cfp_end_date'] = conference.program.cfp.end_date
else else
h['cfp_start_date'] = 'Unknown' h['cfp_start_date'] = 'Unknown'
h['cfp_end_date'] = 'Unknown' h['cfp_end_date'] = 'Unknown'

View file

@ -19,7 +19,7 @@ class Event < ActiveRecord::Base
belongs_to :track belongs_to :track
belongs_to :room belongs_to :room
belongs_to :difficulty_level belongs_to :difficulty_level
belongs_to :conference belongs_to :program
accepts_nested_attributes_for :event_users, allow_destroy: true accepts_nested_attributes_for :event_users, allow_destroy: true
accepts_nested_attributes_for :users accepts_nested_attributes_for :users
@ -31,7 +31,7 @@ class Event < ActiveRecord::Base
validates :title, presence: true validates :title, presence: true
validates :abstract, presence: true validates :abstract, presence: true
validates :event_type, presence: true validates :event_type, presence: true
validates :conference, presence: true validates :program, presence: true
scope :confirmed, -> { where(state: 'confirmed') } scope :confirmed, -> { where(state: 'confirmed') }
scope :highlighted, -> { where(is_highlight: true) } scope :highlighted, -> { where(is_highlight: true) }
@ -108,9 +108,9 @@ class Event < ActiveRecord::Base
end end
def process_confirmation def process_confirmation
if conference.email_settings.send_on_confirmed_without_registration? && if program.conference.email_settings.send_on_confirmed_without_registration? &&
conference.email_settings.confirmed_without_registration_body && program.conference.email_settings.confirmed_without_registration_body &&
conference.email_settings.confirmed_without_registration_subject program.conference.email_settings.confirmed_without_registration_subject
if conference.registrations.where(user_id: submitter.id).first.nil? if conference.registrations.where(user_id: submitter.id).first.nil?
Mailbot.delay.confirm_reminder_mail(self) Mailbot.delay.confirm_reminder_mail(self)
end end
@ -118,9 +118,9 @@ class Event < ActiveRecord::Base
end end
def process_acceptance(options) def process_acceptance(options)
if conference.email_settings.send_on_accepted && if program.conference.email_settings.send_on_accepted &&
conference.email_settings.accepted_body && program.conference.email_settings.accepted_body &&
conference.email_settings.accepted_subject && program.conference.email_settings.accepted_subject &&
!options[:send_mail].blank? !options[:send_mail].blank?
Rails.logger.debug 'Sending event acceptance mail' Rails.logger.debug 'Sending event acceptance mail'
Mailbot.delay.acceptance_mail(self) Mailbot.delay.acceptance_mail(self)
@ -128,9 +128,9 @@ class Event < ActiveRecord::Base
end end
def process_rejection(options) def process_rejection(options)
if conference.email_settings.send_on_rejected && if program.conference.email_settings.send_on_rejected &&
conference.email_settings.rejected_body && program.conference.email_settings.rejected_body &&
conference.email_settings.rejected_subject && program.conference.email_settings.rejected_subject &&
!options[:send_mail].blank? !options[:send_mail].blank?
Rails.logger.debug 'Sending rejected mail' Rails.logger.debug 'Sending rejected mail'
Mailbot.delay.rejection_mail(self) Mailbot.delay.rejection_mail(self)
@ -190,7 +190,7 @@ class Event < ActiveRecord::Base
# Returns +Hash+ # Returns +Hash+
def progress_status def progress_status
{ {
registered: self.conference.user_registered?(self.submitter), registered: self.program.conference.user_registered?(self.submitter),
commercials: self.commercials.any?, commercials: self.commercials.any?,
biography: !self.submitter.biography.blank?, biography: !self.submitter.biography.blank?,
subtitle: !self.subtitle.blank?, subtitle: !self.subtitle.blank?,
@ -241,7 +241,7 @@ class Event < ActiveRecord::Base
def before_end_of_conference def before_end_of_conference
errors. errors.
add(:created_at, "can't be after the conference end date!") if conference.end_date && add(:created_at, "can't be after the conference end date!") if program.conference && program.conference.end_date &&
(Date.today > conference.end_date) (Date.today > program.conference.end_date)
end end
end end

View file

@ -1,5 +1,5 @@
class EventType < ActiveRecord::Base class EventType < ActiveRecord::Base
belongs_to :conference belongs_to :program
has_many :events, dependent: :restrict_with_error has_many :events, dependent: :restrict_with_error
validates :title, presence: true validates :title, presence: true

103
app/models/program.rb Normal file
View file

@ -0,0 +1,103 @@
# cannot delete program if there are events submitted
class Program < ActiveRecord::Base
belongs_to :conference
has_one :cfp, dependent: :destroy
has_many :event_types, dependent: :destroy
has_many :tracks, dependent: :destroy
has_many :difficulty_levels, dependent: :destroy
has_many :rooms, dependent: :destroy
has_many :events, dependent: :destroy do
def workshops
where(require_registration: true, state: :confirmed)
end
def confirmed
where(state: :confirmed)
end
def scheduled
where.not(start_time: nil)
end
def highlights
where(state: :confirmed, is_highlight: true)
end
end
has_many :event_users, through: :events
has_many :speakers, -> { distinct }, through: :event_users, source: :user do
def confirmed
joins(:events).where(events: { state: :confirmed })
end
end
accepts_nested_attributes_for :event_types, allow_destroy: true
accepts_nested_attributes_for :tracks, reject_if: proc { |r| r['name'].blank? }, allow_destroy: true
accepts_nested_attributes_for :difficulty_levels, allow_destroy: true
accepts_nested_attributes_for :rooms, reject_if: proc { |r| r['name'].blank? }, allow_destroy: true
attr_accessible :schedule_fluid, :rating,
:schedule_public, :include_cfp_in_splash, :conference_id,
:event_types_attributes, :difficulty_levels_attributes, :rooms_attributes, :tracks_attributes
# validates :conference_id, presence: true, uniqueness: true
validates :rating, numericality: { greater_than_or_equal_to: 0, less_than_or_equal_to: 10 }
before_create :create_event_types
before_create :create_difficulty_levels
##
# Checcks if the program has rating enabled
#
# ====Returns
# * +false+ -> If rating is not enabled
# * +true+ -> If rating is enabled
def rating_enabled?
self.rating && self.rating > 0
end
##
# Checks if the call for papers for the conference is currently open
#
# ====Returns
# * +false+ -> If the CFP is not set or today isn't in the CFP period.
# * +true+ -> If today is in the CFP period.
def cfp_open?
cfp = self.cfp
cfp.present? && (cfp.start_date..cfp.end_date).cover?(Date.current)
end
private
##
# Creates default EventTypes for this Conference. Used as before_create.
#
def create_event_types
event_types << EventType.create(title: 'Talk', length: 30, color: '#FF0000', description: 'Presentation in lecture format',
minimum_abstract_length: 0,
maximum_abstract_length: 500)
event_types << EventType.create(title: 'Workshop', length: 60, color: '#0000FF', description: 'Interactive hands-on practice',
minimum_abstract_length: 0,
maximum_abstract_length: 500)
true
end
##
# Creates default DifficultyLevels for this Conference. Used as before_create.
#
def create_difficulty_levels
difficulty_levels << DifficultyLevel.create(title: 'Easy',
description: 'Events are understandable for everyone without knowledge of the topic.',
color: '#70EF69')
difficulty_levels << DifficultyLevel.create(title: 'Medium',
description: 'Events require a basic understanding of the topic.',
color: '#EEEF69')
difficulty_levels << DifficultyLevel.create(title: 'Hard',
description: 'Events require expert knowledge of the topic.',
color: '#EF6E69')
true
end
end

View file

@ -1,5 +1,5 @@
class Room < ActiveRecord::Base class Room < ActiveRecord::Base
belongs_to :conference belongs_to :program
has_many :events, dependent: :nullify has_many :events, dependent: :nullify
before_create :generate_guid before_create :generate_guid

View file

@ -29,7 +29,7 @@ class Target < ActiveRecord::Base
numerator = numerator =
case unit case unit
when Target.units[:submissions] when Target.units[:submissions]
conference.events.where('created_at < ?', due_date).count conference.program.events.where('created_at < ?', due_date).count
when Target.units[:registrations] when Target.units[:registrations]
conference.registrations.where('created_at < ?', due_date).count conference.registrations.where('created_at < ?', due_date).count
when Target.units[:program_minutes] when Target.units[:program_minutes]

View file

@ -1,5 +1,5 @@
class Track < ActiveRecord::Base class Track < ActiveRecord::Base
belongs_to :conference belongs_to :program
has_many :events, dependent: :nullify has_many :events, dependent: :nullify
before_create :generate_guid before_create :generate_guid

View file

@ -177,7 +177,7 @@ class User < ActiveRecord::Base
end end
def proposals(conference) def proposals(conference)
events.where('conference_id = ? AND event_users.event_role=?', conference.id, 'submitter') events.where('program_id = ? AND event_users.event_role=?', conference.program.id, 'submitter')
end end
def proposal_count(conference) def proposal_count(conference)

View file

@ -1,14 +0,0 @@
.row
.col-md-12
.page-header
%h1 Call for Papers
.row
.col-md-8
= semantic_form_for(@call_for_paper, :url => admin_conference_call_for_paper_path(@conference.short_title),:html => {:multipart => true}) do |f|
= f.input :start_date, :as => :string, :input_html => { :id => "conference-start-datepicker", :readonly => "readonly" }
= f.input :end_date, :as => :string, :input_html => { :id => "conference-end-datepicker", :readonly => "readonly" }
= f.input :schedule_public, label: "Show Schedule on the home and splash page"
= f.input :schedule_changes, label: "Allow submitters to change their event after it is scheduled"
= f.input :rating, :hint => "Enter the number of different rating levels you want to have for voting on proposals. Enter 0 if you do not want to vote on proposals."
%p.text-right
= f.action :submit, :as => :button, :button_html => {:class => "btn btn-primary"}

View file

@ -0,0 +1,11 @@
.row
.col-md-12
.page-header
%h1 Call for Papers
.row
.col-md-8
= semantic_form_for(@cfp, :url => admin_conference_program_cfp_path(@conference.short_title),:html => {:multipart => true}) do |f|
= f.input :start_date, :as => :string, :input_html => { :id => "conference-start-datepicker", :readonly => "readonly" }
= f.input :end_date, :as => :string, :input_html => { :id => "conference-end-datepicker", :readonly => "readonly" }
%p.text-right
= f.action :submit, :as => :button, :button_html => {:class => "btn btn-primary"}

View file

@ -4,22 +4,22 @@
%h1 Call for Papers %h1 Call for Papers
%p.text-muted %p.text-muted
Call for people to submit events to your conference Call for people to submit events to your conference
- if @call_for_paper - if @cfp
.row .row
.col-md-8 .col-md-8
%dl.dl-horizontal %dl.dl-horizontal
%dt %dt
Start Date: Start Date:
%dd#start_date %dd#start_date
= @call_for_paper.start_date.strftime('%A, %B %-d. %Y') = @cfp.start_date.strftime('%A, %B %-d. %Y')
%dt %dt
End Date: End Date:
%dd#end_date %dd#end_date
= @call_for_paper.end_date.strftime('%A, %B %-d. %Y') = @cfp.end_date.strftime('%A, %B %-d. %Y')
%dt %dt
Days Left: Days Left:
%dd %dd
= pluralize(@call_for_paper.remaining_days, 'day') = pluralize(@cfp.remaining_days, 'day')
%dt %dt
Event types: Event types:
%dd %dd
@ -31,28 +31,28 @@
%dt %dt
Public Schedule Public Schedule
%dd#schedule_public %dd#schedule_public
- if @call_for_paper.schedule_public - if @program.schedule_public
Yes Yes
- else - else
No No
%dt %dt
Schedule changeable? Schedule changeable?
%dd#schedule_changes %dd#schedule_changes
- if @call_for_paper.schedule_changes - if @program.schedule_fluid
Yes Yes
- else - else
No No
%dt %dt
Rating Levels Rating Levels
%dd#rating %dd#rating
= @call_for_paper.rating = @program.rating
.row .row
.col-md-12.text-right .col-md-12.text-right
= link_to(edit_admin_conference_call_for_paper_path(@conference.short_title), class: 'btn btn-primary') do = link_to(edit_admin_conference_program_cfp_path(@conference.short_title), class: 'btn btn-primary') do
Edit Edit
= link_to(admin_conference_call_for_paper_path(@conference.short_title), method: 'delete', class: 'btn btn-danger') do = link_to(admin_conference_program_cfp_path(@conference.short_title), method: 'delete', class: 'btn btn-danger', data: { confirm: 'Are you sure you want to delete the CfP?' }) do
Delete Delete
-else -else
.row .row
.col-md-12.text-right .col-md-12.text-right
= link_to 'Create Call for Papers', new_admin_conference_call_for_paper_path(@conference.short_title), class: 'btn btn-primary' = link_to 'Create Call for Papers', new_admin_conference_program_cfp_path(@conference.short_title), class: 'btn btn-primary'

View file

@ -5,7 +5,7 @@
.panel-body .panel-body
- events.each do |event, comments| - events.each do |event, comments|
.notifications .notifications
%h4.title= link_to event.title, admin_conference_event_path(event.conference.short_title, event) %h4.title= link_to event.title, admin_conference_program_event_path(event.program.conference.short_title, event)
%hr %hr
- comments.each do |comment| - comments.each do |comment|
%h5.strong Posted by: #{comment.user.name} | Created at: #{comment.created_at} %h5.strong Posted by: #{comment.user.name} | Created at: #{comment.created_at}

View file

@ -5,7 +5,7 @@
.panel-body .panel-body
- events.each do |event, comments| - events.each do |event, comments|
.notifications .notifications
%h4.title= link_to event.title, admin_conference_event_path(event.conference.short_title, event) %h4.title= link_to event.title, admin_conference_program_event_path(event.program.conference.short_title, event)
%hr %hr
- comments.each do |comment| - comments.each do |comment|
%h5.strong Created at: #{comment.created_at} %h5.strong Created at: #{comment.created_at}

View file

@ -5,7 +5,7 @@
.panel-body .panel-body
- events.each do |event, comments| - events.each do |event, comments|
.notifications .notifications
%h4.title= link_to event.title, admin_conference_event_path(event.conference.short_title, event) %h4.title= link_to event.title, admin_conference_program_event_path(event.program.conference.short_title, event)
%hr %hr
- comments.each do |comment| - comments.each do |comment|
%h5.strong Posted by: #{comment.user.name} | Created at: #{comment.created_at} %h5.strong Posted by: #{comment.user.name} | Created at: #{comment.created_at}

View file

@ -16,8 +16,8 @@
%td= link_to event.submitter.name, admin_user_path(event.submitter.id) %td= link_to event.submitter.name, admin_user_path(event.submitter.id)
- else - else
%td Unknown Submitter %td Unknown Submitter
%td= link_to event.title, admin_conference_event_path(event.conference.short_title, event) %td= link_to event.title, admin_conference_program_event_path(event.program.conference.short_title, event)
%td= link_to event.conference.title, admin_conference_path(event.conference.short_title) %td= link_to event.program.conference.title, admin_conference_path(event.program.conference.short_title)
%td %td
.span{'class'=>label_for(event.state)} #{event.state.humanize} .span{'class'=>label_for(event.state)} #{event.state.humanize}
- else - else

View file

@ -17,8 +17,8 @@
Set up registration period Set up registration period
%li{'class'=>"list-group-item #{class_for_todo(conference_progress['cfp'])}"} %li{'class'=>"list-group-item #{class_for_todo(conference_progress['cfp'])}"}
%span{'class'=>icon_for_todo(conference_progress['cfp'])} %span{'class'=>icon_for_todo(conference_progress['cfp'])}
- if can? :update, CallForPaper.new(conference_id: @conference.id) - if can? :update, Cfp.new(program_id: @program.id)
= link_to 'Set up call for papers', admin_conference_call_for_paper_path(conference_progress['short_title']) = link_to 'Set up call for papers', admin_conference_program_cfp_path(conference_progress['short_title'])
- else - else
Set up call for papers Set up call for papers
%li{'class'=>"list-group-item #{class_for_todo(conference_progress['venue'])}"} %li{'class'=>"list-group-item #{class_for_todo(conference_progress['venue'])}"}
@ -32,26 +32,26 @@
Add venue Add venue
%li{'class'=>"list-group-item #{class_for_todo(conference_progress['rooms'])}"} %li{'class'=>"list-group-item #{class_for_todo(conference_progress['rooms'])}"}
%span{'class'=>icon_for_todo(conference_progress['rooms'])} %span{'class'=>icon_for_todo(conference_progress['rooms'])}
- if can? :update, @conference.rooms.build - if can? :update, @conference.program.rooms.build
= link_to 'Add rooms', admin_conference_rooms_path(conference_progress['short_title']) = link_to 'Add rooms', admin_conference_program_rooms_path(conference_progress['short_title'])
- else - else
Add rooms Add rooms
%li{'class'=>"list-group-item #{class_for_todo(conference_progress['tracks'])}"} %li{'class'=>"list-group-item #{class_for_todo(conference_progress['tracks'])}"}
%span{'class'=>icon_for_todo(conference_progress['tracks'])} %span{'class'=>icon_for_todo(conference_progress['tracks'])}
- if can? :update, @conference.tracks.build - if can? :update, @conference.program.tracks.build
= link_to 'Add tracks', admin_conference_tracks_path(conference_progress['short_title']) = link_to 'Add tracks', admin_conference_program_tracks_path(conference_progress['short_title'])
- else - else
Add tracks Add tracks
%li{'class'=>"list-group-item #{class_for_todo(conference_progress['event_types'])}"} %li{'class'=>"list-group-item #{class_for_todo(conference_progress['event_types'])}"}
%span{'class'=>icon_for_todo(conference_progress['event_types'])} %span{'class'=>icon_for_todo(conference_progress['event_types'])}
- if can? :update, @conference.event_types.build - if can? :update, @conference.program.event_types.build
= link_to 'Add event types', admin_conference_event_types_path(conference_progress['short_title']) = link_to 'Add event types', admin_conference_program_event_types_path(conference_progress['short_title'])
- else - else
Add event types Add event types
%li{'class'=>"list-group-item #{class_for_todo(conference_progress['difficulty_levels'])}"} %li{'class'=>"list-group-item #{class_for_todo(conference_progress['difficulty_levels'])}"}
%span{'class'=>icon_for_todo(conference_progress['difficulty_levels'])} %span{'class'=>icon_for_todo(conference_progress['difficulty_levels'])}
- if can? :update, @conference.difficulty_levels.build - if can? :update, @conference.program.difficulty_levels.build
= link_to 'Add difficulty levels', admin_conference_difficulty_levels_path(conference_progress['short_title']) = link_to 'Add difficulty levels', admin_conference_program_difficulty_levels_path(conference_progress['short_title'])
- else - else
Add difficulty levels Add difficulty levels
%li{class: "list-group-item #{class_for_todo(conference_progress['splashpage'])}"} %li{class: "list-group-item #{class_for_todo(conference_progress['splashpage'])}"}

View file

@ -8,7 +8,7 @@
= @difficulty_level.title = @difficulty_level.title
.row .row
.col-md-8 .col-md-8
= semantic_form_for(@difficulty_level, :url => (@difficulty_level.new_record? ? admin_conference_difficulty_levels_path : admin_conference_difficulty_level_path(@conference.short_title, @difficulty_level))) do |f| = semantic_form_for(@difficulty_level, :url => (@difficulty_level.new_record? ? admin_conference_program_difficulty_levels_path : admin_conference_program_difficulty_level_path(@conference.short_title, @difficulty_level))) do |f|
= f.input :title, :required => true = f.input :title, :required => true
= f.input :description, :input_html => {:rows => 3, :class => "span6"} = f.input :description, :input_html => {:rows => 3, :class => "span6"}
= f.input :color, :input_html => {:size => 6, :type => "color"} = f.input :color, :input_html => {:size => 6, :type => "color"}

View file

@ -3,7 +3,7 @@
.page-header .page-header
%h1 Difficulty Levels %h1 Difficulty Levels
%p.text-muted %p.text-muted
Classify your conference events by difficulty Classify your conference.program.events by difficulty
.row .row
.col-md-12 .col-md-12
%table.table.table-hover#difficulty_levels %table.table.table-hover#difficulty_levels
@ -13,7 +13,7 @@
%th Color %th Color
%th Actions %th Actions
%tbody %tbody
- @conference.difficulty_levels.each do |difficulty_level| - @conference.program.difficulty_levels.each do |difficulty_level|
%tr %tr
%td %td
= difficulty_level.title = difficulty_level.title
@ -24,11 +24,11 @@
= difficulty_level.color = difficulty_level.color
%td %td
.btn-group{role: "group"} .btn-group{role: "group"}
= link_to 'Edit', edit_admin_conference_difficulty_level_path(@conference.short_title, difficulty_level.id), = link_to 'Edit', edit_admin_conference_program_difficulty_level_path(@conference.short_title, difficulty_level.id),
method: :get, class: 'btn btn-primary' method: :get, class: 'btn btn-primary'
= link_to 'Delete', admin_conference_difficulty_level_path(@conference.short_title, difficulty_level.id), = link_to 'Delete', admin_conference_program_difficulty_level_path(@conference.short_title, difficulty_level.id),
method: :delete, class: 'btn btn-danger', method: :delete, class: 'btn btn-danger',
data: { confirm: "Do you really want to delete #{difficulty_level.title}? Attention: This difficulty level will be removed from all Events that have it set" } data: { confirm: "Do you really want to delete #{difficulty_level.title}? Attention: This difficulty level will be removed from all Events that have it set" }
.row .row
.col-md-12.text-right .col-md-12.text-right
= link_to 'Add Difficulty Level', new_admin_conference_difficulty_level_path(@conference.short_title), class: 'btn btn-primary' = link_to 'Add Difficulty Level', new_admin_conference_program_difficulty_level_path(@conference.short_title), class: 'btn btn-primary'

View file

@ -41,14 +41,14 @@
%tr %tr
%td {venue_address} %td {venue_address}
%td The address of the venue %td The address of the venue
- unless @conference.call_for_paper.blank? || @conference.call_for_paper.start_date.blank? || @conference.call_for_paper.end_date.blank? - unless @conference.program.cfp.blank? || @conference.program.cfp.start_date.blank? || @conference.program.cfp.end_date.blank?
%tr %tr
%td {cfp_start_date} %td {cfp_start_date}
%td The call for papers start date %td The call for papers start date
%tr %tr
%td {cfp_end_date} %td {cfp_end_date}
%td The call for papers end date %td The call for papers end date
-if @conference.call_for_paper.schedule_public -if @conference.program.schedule_public
%td {schedule_link} %td {schedule_link}
%td The link to complete schedule of the conference %td The link to complete schedule of the conference
- if @conference.splashpage && @conference.splashpage.public - if @conference.splashpage && @conference.splashpage.public

View file

@ -69,18 +69,18 @@
%a.btn.btn-link.control_label.template_help_link{"data-name"=>"updated_venue_help"} Show Help %a.btn.btn-link.control_label.template_help_link{"data-name"=>"updated_venue_help"} Show Help
= render partial: 'help', locals: {id: 'updated_venue_help', show_event_variables: false} = render partial: 'help', locals: {id: 'updated_venue_help', show_event_variables: false}
#cfp.tab-pane{:role => "tabpanel"} #cfp.tab-pane{:role => "tabpanel"}
= f.input :send_on_call_for_papers_schedule_public, hint: "This will notify all participants when the dates are updated or when the schedule is made public" = f.input :send_on_program_schedule_public, hint: "This will notify all participants when the dates are updated or when the schedule is made public"
= f.input :call_for_papers_schedule_public_subject, hint: "This subject will used whenever dates are updated or when the schedule is made public" = f.input :program_schedule_public_subject, hint: "This subject will used whenever dates are updated or when the schedule is made public"
= f.input :call_for_papers_schedule_public_body, :input_html => { :rows => 10, :cols => 20 } = f.input :program_schedule_public_template, :input_html => { :rows => 10, :cols => 20 }
%a.btn.btn-link.control_label.load_template{"data-template"=>"Dear {name},\n\nThe Conference Call for Papers Details of {conference} has changed.The schedule is being made public.\n Link to Schedule {schedule_link} \n\nBest wishes\n\n{conference} Team", %a.btn.btn-link.control_label.load_template{"data-template"=>"Dear {name},\n\nThe Conference Call for Papers Details of {conference} has changed.The schedule is being made public.\n Link to Schedule {schedule_link} \n\nBest wishes\n\n{conference} Team",
"data-name"=>"email_settings_call_for_papers_schedule_public_body"} Load Template "data-name"=>"email_settings_program_schedule_public_template"} Load Template
%a.btn.btn-link.control_label.template_help_link{"data-name"=>"updated_cfp_help"} Show Help %a.btn.btn-link.control_label.template_help_link{"data-name"=>"updated_cfp_help"} Show Help
= render partial: 'help', locals: {id: 'updated_cfp_help', show_event_variables: false} = render partial: 'help', locals: {id: 'updated_cfp_help', show_event_variables: false}
= f.input :send_on_call_for_papers_dates_updated, hint: "This will notify all participants when the dates are updated or when the schedule is made public" = f.input :send_on_cfp_dates_updated, hint: "This will notify all participants when the dates are updated or when the schedule is made public"
= f.input :call_for_papers_dates_updated_subject, hint: "This subject will used whenever dates are updated or when the schedule is made public" = f.input :cfp_dates_updated_subject, hint: "This subject will used whenever dates are updated or when the schedule is made public"
= f.input :call_for_papers_dates_updated_body, :input_html => { :rows => 10, :cols => 20 } = f.input :cfp_dates_updated_template, :input_html => { :rows => 10, :cols => 20 }
%a.btn.btn-link.control_label.load_template{"data-template"=>"Dear {name},\n\nThe Conference Call for Papers Details of {conference} has changed.\nNew Dates : {cfp_start_date} - {cfp_end_date}.\n Link to Schedule {schedule_link} \n\nBest wishes\n\n{conference} Team", %a.btn.btn-link.control_label.load_template{"data-template"=>"Dear {name},\n\nThe Conference Call for Papers Details of {conference} has changed.\nNew Dates : {cfp_start_date} - {cfp_end_date}.\n Link to Schedule {schedule_link} \n\nBest wishes\n\n{conference} Team",
"data-name"=>"email_settings_call_for_papers_dates_updated_body"} Load Template "data-name"=>"email_settings_cfp_dates_updates_template"} Load Template
%a.btn.btn-link.control_label.template_help_link{"data-name"=>"updated_cfp_help"} Show Help %a.btn.btn-link.control_label.template_help_link{"data-name"=>"updated_cfp_help"} Show Help
= render partial: 'help', locals: {id: 'updated_cfp_help', show_event_variables: false} = render partial: 'help', locals: {id: 'updated_cfp_help', show_event_variables: false}
.row .row

View file

@ -8,7 +8,7 @@
= @event_type.title = @event_type.title
.row .row
.col-md-12 .col-md-12
= semantic_form_for(@event_type, :url => (@event_type.new_record? ? admin_conference_event_types_path : admin_conference_event_type_path(@conference.short_title, @event_type))) do |f| = semantic_form_for(@event_type, :url => (@event_type.new_record? ? admin_conference_program_event_types_path : admin_conference_program_event_type_path(@conference.short_title, @event_type))) do |f|
= f.input :title = f.input :title
= f.input :length, :input_html => {:size => 3} = f.input :length, :input_html => {:size => 3}
= f.input :description = f.input :description

View file

@ -15,7 +15,7 @@
%th Color %th Color
%th Actions %th Actions
%tbody %tbody
- @conference.event_types.each do |event_type| - @conference.program.event_types.each do |event_type|
%tr %tr
%td %td
= event_type.title = event_type.title
@ -32,11 +32,11 @@
= event_type.color = event_type.color
%td %td
.btn-group{role: "group"} .btn-group{role: "group"}
= link_to 'Edit', edit_admin_conference_event_type_path(@conference.short_title, event_type.id), = link_to 'Edit', edit_admin_conference_program_event_type_path(@conference.short_title, event_type.id),
method: :get, class: 'btn btn-primary' method: :get, class: 'btn btn-primary'
= link_to 'Delete', admin_conference_event_type_path(@conference.short_title, event_type.id), = link_to 'Delete', admin_conference_program_event_type_path(@conference.short_title, event_type.id),
method: :delete, class: 'btn btn-danger', data: { confirm: "Do you really want to delete #{event_type.name}?" } method: :delete, class: 'btn btn-danger', data: { confirm: "Do you really want to delete #{event_type.name}?" }
.row .row
.col-md-12.text-right .col-md-12.text-right
= link_to 'Add Event Type', new_admin_conference_event_type_path(@conference.short_title), class: 'btn btn-primary' = link_to 'Add Event Type', new_admin_conference_program_event_type_path(@conference.short_title), class: 'btn btn-primary'

View file

@ -1,37 +1,37 @@
- if event.transition_possible? :accept - if event.transition_possible? :accept
%li= link_to 'Accept event', %li= link_to 'Accept event',
accept_admin_conference_event_path(@conference.short_title, event), accept_admin_conference_program_event_path(@conference.short_title, event),
method: :patch, id: "accept_event_#{event.id}" method: :patch, id: "accept_event_#{event.id}"
- if @conference.email_settings.send_on_accepted? - if @conference.email_settings.send_on_accepted?
%li= link_to 'Accept event (without email)', %li= link_to 'Accept event (without email)',
accept_admin_conference_event_path(@conference.short_title, event, send_mail: false), accept_admin_conference_program_event_path(@conference.short_title, event, send_mail: false),
method: :patch, hint: 'Accept this event without sending an automated email.', method: :patch, hint: 'Accept this event without sending an automated email.',
id: "accept_event_without_mail_#{event.id}" id: "accept_event_without_mail_#{event.id}"
- if event.transition_possible? :reject - if event.transition_possible? :reject
%li= link_to 'Reject event', %li= link_to 'Reject event',
reject_admin_conference_event_path(@conference.short_title, event), reject_admin_conference_program_event_path(@conference.short_title, event),
method: :patch, confirm: 'Are you sure?', id: "reject_event_#{event.id}" method: :patch, confirm: 'Are you sure?', id: "reject_event_#{event.id}"
- if @conference.email_settings.send_on_rejected? - if @conference.email_settings.send_on_rejected?
%li= link_to 'Reject event (without email)', %li= link_to 'Reject event (without email)',
reject_admin_conference_event_path(@conference.short_title, event, send_mail: false), reject_admin_conference_program_event_path(@conference.short_title, event, send_mail: false),
method: :patch, confirm: 'Are you sure?', id: "reject_event_without_mail_#{event.id}" method: :patch, confirm: 'Are you sure?', id: "reject_event_without_mail_#{event.id}"
- if event.transition_possible? :restart - if event.transition_possible? :restart
%li= link_to 'Start review', %li= link_to 'Start review',
restart_admin_conference_event_path(@conference.short_title, event), restart_admin_conference_program_event_path(@conference.short_title, event),
method: :patch, id: "restart_event_#{event.id}" method: :patch, id: "restart_event_#{event.id}"
- if event.transition_possible? :confirm - if event.transition_possible? :confirm
%li= link_to 'Confirm event', %li= link_to 'Confirm event',
confirm_admin_conference_event_path(@conference.short_title, event), confirm_admin_conference_program_event_path(@conference.short_title, event),
method: :patch, id: "confirm_event_#{event.id}", method: :patch, id: "confirm_event_#{event.id}",
hint: 'Confirm that the speaker(s) will be present and that the event will actually take place.' hint: 'Confirm that the speaker(s) will be present and that the event will actually take place.'
- if event.transition_possible? :cancel - if event.transition_possible? :cancel
%li= link_to 'Cancel event', %li= link_to 'Cancel event',
cancel_admin_conference_event_path(@conference.short_title, event), cancel_admin_conference_program_event_path(@conference.short_title, event),
method: :patch, id: "cancel_event_#{event.id}", method: :patch, id: "cancel_event_#{event.id}",
hint: 'Mark this event as cancelled. Usually this means that the speakers had to cancel their appearance.' hint: 'Mark this event as cancelled. Usually this means that the speakers had to cancel their appearance.'

View file

@ -6,7 +6,7 @@
%div %div
%a.pull-right.comment-reply-link{href: "#"} Reply %a.pull-right.comment-reply-link{href: "#"} Reply
.comment-reply .comment-reply
= form_tag "#{comment_admin_conference_event_path(@conference.short_title, comment.commentable_id)}", method: :post do = form_tag "#{comment_admin_conference_program_event_path(@conference.short_title, comment.commentable_id)}", method: :post do
%input{name: "parent", type: "hidden", value: "#{comment.id}"} %input{name: "parent", type: "hidden", value: "#{comment.id}"}
%input{name: "authenticity_token", type: "hidden", value: "#{form_authenticity_token}"} %input{name: "authenticity_token", type: "hidden", value: "#{form_authenticity_token}"}
%textarea{name: "comment"} %textarea{name: "comment"}

View file

@ -5,7 +5,7 @@
%br %br
%small %small
= @event.subtitle = @event.subtitle
= link_to 'Edit', edit_admin_conference_event_path(@conference.short_title, @event), class: 'btn btn-mini btn-primary pull-right' = link_to 'Edit', edit_admin_conference_program_event_path(@conference.short_title, @event), class: 'btn btn-mini btn-primary pull-right'
.row .row
.col-md-12 .col-md-12
@ -24,7 +24,7 @@
%ul.dropdown-menu %ul.dropdown-menu
- @event_types.each do |type| - @event_types.each do |type|
%li= link_to type.title, %li= link_to type.title,
admin_conference_event_path(@conference.short_title, admin_conference_program_event_path(@conference.short_title,
@event, @event,
event: { event_type_id: type.id }), event: { event_type_id: type.id }),
method: :patch method: :patch
@ -33,7 +33,7 @@
%b Highlight %b Highlight
%td %td
= check_box_tag @conference.short_title, @event.id, @event.is_highlight, = check_box_tag @conference.short_title, @event.id, @event.is_highlight,
method: :patch, url: "/admin/conference/#{@conference.short_title}/events/#{@event.id}?event[is_highlight]=", method: :patch, url: "/admin/conference/#{@conference.short_title}/program/events/#{@event.id}?event[is_highlight]=",
class: 'switch-checkbox', data: { size: 'small', class: 'switch-checkbox', data: { size: 'small',
off_color: 'warning', off_color: 'warning',
on_text: 'Yes', on_text: 'Yes',
@ -63,7 +63,7 @@
%ul.dropdown-menu %ul.dropdown-menu
- @tracks.each do |track| - @tracks.each do |track|
%li= link_to track.name, %li= link_to track.name,
admin_conference_event_path(@conference.short_title, admin_conference_program_event_path(@conference.short_title,
@event, @event,
event: { track_id: track.id }), event: { track_id: track.id }),
method: :patch method: :patch
@ -80,7 +80,7 @@
<b class="caret"></b> <b class="caret"></b>
%ul.dropdown-menu %ul.dropdown-menu
- @difficulty_levels.each do |difficulty| - @difficulty_levels.each do |difficulty|
%li= link_to difficulty.title, admin_conference_event_path(@conference.short_title, %li= link_to difficulty.title, admin_conference_program_event_path(@conference.short_title,
@event, @event,
event: { difficulty_level_id: difficulty.id }), event: { difficulty_level_id: difficulty.id }),
method: :patch method: :patch
@ -89,7 +89,7 @@
%b Requires Registration %b Requires Registration
%td %td
= check_box_tag @conference.short_title, @event.id, @event.require_registration, = check_box_tag @conference.short_title, @event.id, @event.require_registration,
method: :patch, url: "/admin/conference/#{@conference.short_title}/events/#{@event.id}?event[require_registration]=", method: :patch, url: "/admin/conference/#{@conference.short_title}/program/events/#{@event.id}?event[require_registration]=",
class: 'switch-checkbox', data: { size: 'small', class: 'switch-checkbox', data: { size: 'small',
off_color: 'warning', off_color: 'warning',
on_text: 'Yes', on_text: 'Yes',
@ -137,7 +137,7 @@
%b Description %b Description
%td= simple_format(@event.description) %td= simple_format(@event.description)
- if @conference.call_for_paper && @conference.call_for_paper.rating && @conference.call_for_paper.rating > 0 - if @conference.program && @conference.program.rating && @conference.program.rating > 0
= render partial: 'voting' = render partial: 'voting'
.row .row
@ -147,7 +147,7 @@
%ul.media %ul.media
%div %div
.row-fluid .row-fluid
= form_tag(comment_admin_conference_event_path(@conference.short_title, @event.id), method: :post) do = form_tag(comment_admin_conference_program_event_path(@conference.short_title, @event.id), method: :post) do
= text_area_tag(:comment, '') = text_area_tag(:comment, '')
= submit_tag 'Add Comment', class: 'btn btn-primary pull-right' = submit_tag 'Add Comment', class: 'btn btn-primary pull-right'
%br %br

View file

@ -4,11 +4,11 @@
%b Rating %b Rating
%td %td
- if @event.average_rating.to_f > 0 - if @event.average_rating.to_f > 0
#{@event.average_rating}/#{@conference.call_for_paper.rating} #{@event.average_rating}/#{@conference.program.rating}
- else - else
Rating: 0/#{@conference.call_for_paper.rating} Rating: 0/#{@conference.program.rating}
- @conference.call_for_paper.rating.times do |counter| - @conference.program.rating.times do |counter|
- if @event.average_rating.to_f.round == counter+1 - if @event.average_rating.to_f.round == counter+1
= label_tag "label_rating", "", :class => "avgrating", :avgrate => true = label_tag "label_rating", "", :class => "avgrating", :avgrate => true
= javascript_tag "$('label[avgrate=true]').prevAll().andSelf().addClass('bright');" = javascript_tag "$('label[avgrate=true]').prevAll().andSelf().addClass('bright');"
@ -27,12 +27,12 @@
%td %td
%b Your vote %b Your vote
%td %td
- @conference.call_for_paper.rating.times do |counter| - @conference.program.rating.times do |counter|
- voted = @event.voted?(@event, current_user) - voted = @event.voted?(@event, current_user)
- if voted && voted.rating == counter+1 - if voted && voted.rating == counter+1
= link_to "", vote_admin_conference_event_path(@conference.short_title, @event, :rating => counter+1), :remote => true, :id =>"label#{counter+1}", :class => "myrating", :voted => true = link_to "", vote_admin_conference_program_event_path(@conference.short_title, @event, :rating => counter+1), :remote => true, :id =>"label#{counter+1}", :class => "myrating", :voted => true
- else - else
= link_to "", vote_admin_conference_event_path(@conference.short_title, @event, :rating => counter+1), :remote => true, :id =>"label#{counter+1}", :class => "myrating" = link_to "", vote_admin_conference_program_event_path(@conference.short_title, @event, :rating => counter+1), :remote => true, :id =>"label#{counter+1}", :class => "myrating"
%br %br
- if @ratings.length > 0 - if @ratings.length > 0
@ -42,7 +42,7 @@
%td %td
= rate.name = rate.name
%td %td
- @conference.call_for_paper.rating.times do |counter| - @conference.program.rating.times do |counter|
- voted = @event.voted?(@event, rate.user) - voted = @event.voted?(@event, rate.user)
- if voted && voted.rating == counter+1 - if voted && voted.rating == counter+1
= label_tag "label#{counter+1}", "", :class => "othersrating", :voted => true = label_tag "label#{counter+1}", "", :class => "othersrating", :voted => true

View file

@ -15,7 +15,7 @@
%b ID %b ID
%th %th
%b Title %b Title
- if @conference.call_for_paper && @conference.call_for_paper.rating && @conference.call_for_paper.rating > 0 - if @program.rating_enabled?
%th %th
%b Rating %b Rating
%th %th
@ -39,16 +39,16 @@
%td %td
= event.id = event.id
%td %td
=link_to event.title, admin_conference_event_path(@conference.short_title, event) =link_to event.title, admin_conference_program_event_path(@conference.short_title, event)
- if @conference.call_for_paper && @conference.call_for_paper.rating && @conference.call_for_paper.rating > 0 - if @program.rating_enabled?
%td.col-md-1{'data-order' => "#{event.average_rating}"} %td.col-md-1{'data-order' => "#{event.average_rating}"}
- if event.average_rating.to_f > 0 - if event.average_rating.to_f > 0
#{event.average_rating}/#{@conference.call_for_paper.rating} #{event.average_rating}/#{@program.rating}
%br %br
#{pluralize(event.voters.length, 'voter')} #{pluralize(event.voters.length, 'voter')}
%br %br
- @conference.call_for_paper.rating.times do |counter| - @program.cfp.rating.times do |counter|
- if event.average_rating.to_f.round == counter+1 - if event.average_rating.to_f.round == counter+1
= label_tag "label_rating", "", :class => "avgrating", :avgrate => true = label_tag "label_rating", "", :class => "avgrating", :avgrate => true
= javascript_tag "$('label[avgrate=true]').prevAll().andSelf().addClass('bright');" = javascript_tag "$('label[avgrate=true]').prevAll().andSelf().addClass('bright');"
@ -63,7 +63,7 @@
%span.label.label-danger %span.label.label-danger
Not rated Not rated
- else - else
0/#{@conference.call_for_paper.rating} 0/#{@program.rating}
%br %br
- if event.submitter && event.submitter.registrations && event.submitter.registrations.count < 1 - if event.submitter && event.submitter.registrations && event.submitter.registrations.count < 1
@ -85,7 +85,7 @@
%td{'data-order' => "#{event.require_registration}"} %td{'data-order' => "#{event.require_registration}"}
= check_box_tag @conference.short_title, event.id, event.require_registration, = check_box_tag @conference.short_title, event.id, event.require_registration,
method: :patch, url: "/admin/conference/#{@conference.short_title}/events/#{event.id}?event[require_registration]=", method: :patch, url: "/admin/conference/#{@conference.short_title}/program/events/#{event.id}?event[require_registration]=",
class: 'switch-checkbox', data: { size: 'small', class: 'switch-checkbox', data: { size: 'small',
off_color: 'warning', off_color: 'warning',
on_text: 'Yes', on_text: 'Yes',
@ -93,7 +93,7 @@
%td{'data-order' => "#{event.is_highlight}"} %td{'data-order' => "#{event.is_highlight}"}
= check_box_tag @conference.short_title, event.id, event.is_highlight, = check_box_tag @conference.short_title, event.id, event.is_highlight,
method: :patch, url: "/admin/conference/#{@conference.short_title}/events/#{event.id}?event[is_highlight]=", method: :patch, url: "/admin/conference/#{@conference.short_title}/program/events/#{event.id}?event[is_highlight]=",
class: 'switch-checkbox', data: { size: 'small', class: 'switch-checkbox', data: { size: 'small',
off_color: 'warning', off_color: 'warning',
on_text: 'Yes', on_text: 'Yes',
@ -110,7 +110,7 @@
%ul.dropdown-menu %ul.dropdown-menu
- @event_types.each do |type| - @event_types.each do |type|
%li= link_to type.title, %li= link_to type.title,
admin_conference_event_path(@conference.short_title, admin_conference_program_event_path(@conference.short_title,
event, event,
event: { event_type_id: type.id }), event: { event_type_id: type.id }),
method: :patch method: :patch
@ -125,7 +125,7 @@
%ul.dropdown-menu %ul.dropdown-menu
- @tracks.each do |track| - @tracks.each do |track|
%li= link_to track.name, %li= link_to track.name,
admin_conference_event_path(@conference.short_title, admin_conference_program_event_path(@conference.short_title,
event, event,
event: { track_id: track.id }), event: { track_id: track.id }),
method: :patch method: :patch
@ -140,7 +140,7 @@
%ul.dropdown-menu %ul.dropdown-menu
- @difficulty_levels.each do |difficulty_level| - @difficulty_levels.each do |difficulty_level|
%li= link_to difficulty_level.title, %li= link_to difficulty_level.title,
admin_conference_event_path(@conference.short_title, admin_conference_program_event_path(@conference.short_title,
event, event,
event: { difficulty_level_id: difficulty_level.id }), event: { difficulty_level_id: difficulty_level.id }),
method: :patch method: :patch

View file

@ -0,0 +1,12 @@
.row
.col-md-12
.page-header
%h1 Program
.row
.col-md-8
= semantic_form_for(@program, :url => admin_conference_program_path(@conference.short_title),:html => {:multipart => true}) do |f|
= f.input :schedule_public, label: "Show Schedule on the home and splash page"
= f.input :schedule_fluid, label: "Allow submitters to change their event after it is scheduled"
= f.input :rating, :hint => "Enter the number of different rating levels you want to have for voting on proposals. Enter 0 if you do not want to vote on proposals."
%p.text-right
= f.action :submit, :as => :button, :button_html => {:class => "btn btn-primary"}

View file

@ -0,0 +1,61 @@
.row
.col-md-12
.page-header
%h1 Program
- if @program
.row
.col-md-8
%dl.dl-horizontal
- if @cfp
%dt
Start Date:
%dd#start_date
= @cfp.start_date.strftime('%A, %B %-d. %Y')
%dt
End Date:
%dd#end_date
= @cfp.end_date.strftime('%A, %B %-d. %Y')
%dt
Days Left:
%dd
= pluralize(@cfp.remaining_days, 'day')
%dt
Event types:
%dd
= event_types(@conference)
%dt
Tracks:
%dd
= tracks(@conference)
%dt
Difficulty Levels:
%dd
= difficulty_levels(@conference)
%dt
Public Schedule
%dd#schedule_public
- if @program.schedule_public
Yes
- else
No
%dt
Schedule changeable?
%dd#schedule_changes
- if @program.schedule_fluid
Yes
- else
No
%dt
Rating Levels
%dd#rating
= @program.rating
.row
.col-md-12.text-right
- if can? :edit, @progam
= link_to edit_admin_conference_program_path(@conference.short_title), class: 'btn btn-primary' do
Edit
- if can? :destroy, @program
= link_to admin_conference_program_path(@conference.short_title), method: 'delete', class: 'btn btn-danger', data: { confirm: 'Are you sure you want to delete this program?' } do
Delete

View file

@ -8,7 +8,7 @@
= @room.name = @room.name
.row .row
.col-md-8 .col-md-8
= semantic_form_for(@room, :url => (@room.new_record? ? admin_conference_rooms_path : admin_conference_room_path(@conference.short_title, @room))) do |f| = semantic_form_for(@room, :url => (@room.new_record? ? admin_conference_program_rooms_path : admin_conference_program_room_path(@conference.short_title, @room))) do |f|
= f.input :name = f.input :name
= f.input :size, :input_html => {:size => 5} = f.input :size, :input_html => {:size => 5}
%p.text-right %p.text-right

View file

@ -5,7 +5,7 @@
%p.text-muted %p.text-muted
The rooms of your conference venue The rooms of your conference venue
- if @conference.rooms.any? - if @conference.program.rooms.any?
.row .row
.col-md-12 .col-md-12
%table.table.table-hover#rooms %table.table.table-hover#rooms
@ -14,18 +14,18 @@
%th Size %th Size
%th Actions %th Actions
%tbody %tbody
- @conference.rooms.each_with_index do |room, index| - @conference.program.rooms.each_with_index do |room, index|
%tr %tr
%td %td
= room.name = room.name
%td %td
= room.size = room.size
%td %td
= link_to 'Edit', edit_admin_conference_room_path(@conference.short_title, room.id), = link_to 'Edit', edit_admin_conference_program_room_path(@conference.short_title, room.id),
method: :get, class: 'btn btn-primary' method: :get, class: 'btn btn-primary'
= link_to 'Delete', admin_conference_room_path(@conference.short_title, room.id), = link_to 'Delete', admin_conference_program_room_path(@conference.short_title, room.id),
method: :delete, class: 'btn btn-danger', method: :delete, class: 'btn btn-danger',
data: { confirm: "Do you really want to delete #{room.name}? Attention: This room will be removed from all Events that have it set"} data: { confirm: "Do you really want to delete #{room.name}? Attention: This room will be removed from all Events that have it set"}
.row .row
.col-md-12.text-right .col-md-12.text-right
= link_to 'Add Room', new_admin_conference_room_path(@conference.short_title), class: 'btn btn-primary' = link_to 'Add Room', new_admin_conference_program_room_path(@conference.short_title), class: 'btn btn-primary'

View file

@ -8,7 +8,7 @@
Track Track
.row .row
.col-md-12 .col-md-12
= semantic_form_for(@track, :url => (@track.new_record? ? admin_conference_tracks_path : admin_conference_track_path(@conference.short_title, @track))) do |f| = semantic_form_for(@track, :url => (@track.new_record? ? admin_conference_program_tracks_path : admin_conference_program_track_path(@conference.short_title, @track))) do |f|
= f.input :name = f.input :name
= f.input :color, :input_html => {:size => 6, :type => "color"}, :required=> true = f.input :color, :input_html => {:size => 6, :type => "color"}, :required=> true
= f.input :description, :input_html => {:rows => 2, data: { provide: "markdown-editable" } }, hint: markdown_hint = f.input :description, :input_html => {:rows => 2, data: { provide: "markdown-editable" } }, hint: markdown_hint

View file

@ -13,10 +13,10 @@
%th Color %th Color
%th Actions %th Actions
%tbody %tbody
- @conference.tracks.each do |track| - @tracks.each do |track|
%tr %tr
%td %td
= link_to(admin_conference_track_path(@conference.short_title, track)) do = link_to(admin_conference_program_track_path(@conference.short_title, track)) do
= track.name = track.name
%td %td
%p %p
@ -26,12 +26,12 @@
= track.color = track.color
%td %td
.btn-group{role: "group"} .btn-group{role: "group"}
= link_to 'Edit', edit_admin_conference_track_path(@conference.short_title, track.id), = link_to 'Edit', edit_admin_conference_program_track_path(@conference.short_title, track.id),
method: :get, class: 'btn btn-primary' method: :get, class: 'btn btn-primary'
= link_to 'Delete', admin_conference_track_path(@conference.short_title, track.id), = link_to 'Delete', admin_conference_program_track_path(@conference.short_title, track.id),
method: :delete, class: 'btn btn-danger', method: :delete, class: 'btn btn-danger',
data: { confirm: "Do you really want to delete #{track.name}? Attention: This track will be removed from all Events that have it set" } data: { confirm: "Do you really want to delete #{track.name}? Attention: This track will be removed from all Events that have it set" }
.row .row
.col-md-12.text-right .col-md-12.text-right
= link_to 'New Track', new_admin_conference_track_path(@conference.short_title), class: 'btn btn-success' = link_to 'New Track', new_admin_conference_program_track_path(@conference.short_title), class: 'btn btn-success'

View file

@ -19,7 +19,7 @@
- @track.events.each_with_index do |event| - @track.events.each_with_index do |event|
%tr %tr
%td %td
=link_to event.title, admin_conference_event_path(@conference.short_title, event) =link_to event.title, admin_conference_program_event_path(@conference.short_title, event)
%td %td
= event.event_type.title = event.event_type.title
%td %td

View file

@ -17,13 +17,13 @@
- @user.events.each do |event| - @user.events.each do |event|
%tr %tr
%td= event.id %td= event.id
%td= link_to event.conference.short_title, admin_conference_path(event.conference.short_title) %td= link_to event.program.conference.short_title, admin_conference_path(event.program.conference.short_title)
%td= link_to event.title, admin_conference_event_path(event.conference.short_title, event) %td= link_to event.title, admin_conference_program_event_path(event.program.conference.short_title, event)
%td= event.state %td= event.state
%td= "#{event.event_type.title} (#{show_time(event.event_type.length)})" %td= "#{event.event_type.title} (#{show_time(event.event_type.length)})"
%td %td
- if event.conference.call_for_paper && event.conference.call_for_paper.rating && event.conference.call_for_paper.rating > 0 - if event.program && event.program.rating && event.program.rating > 0
- event.conference.call_for_paper.rating.times do |counter| - event.program.rating.times do |counter|
- if event.average_rating.to_f.round == counter+1 - if event.average_rating.to_f.round == counter+1
= label_tag 'label_rating', '', class: 'avgrating', avgrate: true = label_tag 'label_rating', '', class: 'avgrating', avgrate: true
= javascript_tag "$('label[avgrate=true]').prevAll().andSelf().addClass('bright');" = javascript_tag "$('label[avgrate=true]').prevAll().andSelf().addClass('bright');"

View file

@ -0,0 +1,9 @@
.container
.row
.col-md-12
.page-header
%h1 Editing Commercial
.row
.col-md-12
= semantic_form_for @commercial, url: conference_program_proposal_commercial_path(conference_id: @conference.short_title, proposal_id: @event.id, id: @commercial.id) do |f|
= render 'form', f: f

View file

@ -0,0 +1,9 @@
.container
.row
.col-md-12
.page-header
%h1 New Commercial
.row
.col-md-12
= semantic_form_for @commercial, url: conference_program_proposal_commercials_path(conference_id: @conference.short_title, proposal_id: @event.id) do |f|
= render 'form', f: f

View file

@ -1,8 +1,8 @@
<h1 class="text-center">Program for <%= @conference.title %></h1> <h1 class="text-center">Program for <%= @conference.title %></h1>
<% @conference.events.confirmed.each do |event| %> <% @conference.program.events.confirmed.each do |event| %>
<div> <div>
<h3> <h3>
<%= link_to event.title, conference_proposal_path(@conference.short_title, event.id) %> <%= link_to event.title, conference_program_proposal_path(@conference.short_title, event.id) %>
<br> <br>
<small> <small>
<%= event.subtitle %> <%= event.subtitle %>
@ -13,7 +13,7 @@
</h4> </h4>
<p> <p>
<%= truncate(event.abstract, :length => 400) -%> <%= truncate(event.abstract, :length => 400) -%>
<%= link_to 'more', conference_proposal_path(@conference.short_title, event.id) if event.abstract.length > 400 %> <%= link_to 'more', conference_program_proposal_path(@conference.short_title, @conference.program.id, event.id) if event.abstract.length > 400 %>
</p> </p>
</div> </div>
<% end %> <% end %>

View file

@ -12,22 +12,22 @@
.row .row
.col-md-6.col-md-offset-3.col-sm-10.col-sm-offset-1 .col-md-6.col-md-offset-3.col-sm-10.col-sm-offset-1
%p %p
- if @conference.event_types.any? - if @program.event_types.any?
You can submit proposals for You can submit proposals for
= "#{event_types(@conference)}." = "#{event_types(@conference)}."
- if @conference.tracks.any? - if @program.tracks.any?
Proposals should fit in one of the Proposals should fit in one of the
= "#{pluralize(@conference.tracks.count, 'track')}:" = "#{pluralize(@program.tracks.count, 'track')}:"
= "#{tracks(@conference)}." = "#{tracks(@conference)}."
The submission period has begun The submission period has begun
%em %em
= @conference.call_for_paper.start_date.strftime('%A, %B %-d. %Y') = @program.cfp.start_date.strftime('%A, %B %-d. %Y')
and closes and closes
%em %em
= @conference.call_for_paper.end_date.strftime('%A, %B %-d. %Y.') = @program.cfp.end_date.strftime('%A, %B %-d. %Y.')
- if @conference.cfp_open? - if @program.cfp_open?
That means you have only That means you have only
%b= pluralize(@conference.call_for_paper.remaining_days, 'day') %b= pluralize(@program.cfp.remaining_days, 'day')
left! left!
Remember Remember
= @conference.short_title = @conference.short_title
@ -37,4 +37,4 @@
.row .row
.col-md-12.text-center .col-md-12.text-center
%p.cta-button %p.cta-button
= link_to "Submit your paper now", conference_proposal_index_path(@conference.short_title), class: 'btn btn-success btn-lg text-center' = link_to "Submit your paper now", conference_program_proposal_index_path(@conference.short_title), class: 'btn btn-success btn-lg text-center'

View file

@ -21,7 +21,7 @@
- if !@conference || @conference != conference - if !@conference || @conference != conference
- if conference.splashpage && conference.splashpage.public - if conference.splashpage && conference.splashpage.public
= link_to "View Conference", conference_path(conference.short_title), :class =>"btn btn-default" = link_to "View Conference", conference_path(conference.short_title), :class =>"btn btn-default"
- if conference.call_for_paper and conference.call_for_paper.schedule_public - if conference.program and conference.program.schedule_public
= link_to "Schedule", schedule_conference_path(conference.short_title), :class =>"btn btn-default" = link_to "Schedule", schedule_conference_path(conference.short_title), :class =>"btn btn-default"
- if conference.registration_open? - if conference.registration_open?
- if conference.user_registered?(current_user) - if conference.user_registered?(current_user)
@ -29,9 +29,9 @@
- else - else
= link_to "Register", new_conference_conference_registrations_path(conference.short_title), :class =>"btn btn-default" = link_to "Register", new_conference_conference_registrations_path(conference.short_title), :class =>"btn btn-default"
- if !current_user.nil? && current_user.proposal_count(conference) > 0 - if !current_user.nil? && current_user.proposal_count(conference) > 0
= link_to "My Proposals", conference_proposal_index_path(conference.short_title), :class =>"btn btn-default" = link_to "My Proposals", conference_program_proposal_index_path(conference.short_title), :class =>"btn btn-default"
- elsif conference.cfp_open? - elsif conference.program.cfp_open?
= link_to "Submit Proposal", new_conference_proposal_path(conference.short_title), :class =>"btn btn-default" = link_to "Submit Proposal", new_conference_program_proposal_path(conference.short_title), :class =>"btn btn-default"
- if current_user.nil? || !current_user.subscribed?(conference) - if current_user.nil? || !current_user.subscribed?(conference)
= link_to 'Subscribe', conference_subscriptions_path(conference.short_title), method: :post, class: 'btn btn-default' = link_to 'Subscribe', conference_subscriptions_path(conference.short_title), method: :post, class: 'btn btn-default'
- else - else

View file

@ -0,0 +1,40 @@
= content_for :splash_nav do
%li
%a.smoothscroll{ href: '#callforpapers' } Call For Papers
.container
.row
.col-md-12.text-center
%h2
Call for Papers
%p.lead
We are ready to accept your proposals for sessions!
.row
.col-md-6.col-md-offset-3.col-sm-10.col-sm-offset-1
%p
- if @conference.program.event_types.any?
You can submit proposals for
= "#{event_types(@conference)}."
- if @conference.tracks.any?
Proposals should fit in one of the
= "#{pluralize(@conference.tracks.count, 'track')}:"
= "#{tracks(@conference)}."
The submission period has begun
%em
= @program.cfp.start_date.strftime('%A, %B %-d. %Y')
and closes
%em
= @program.cfp.end_date.strftime('%A, %B %-d. %Y.')
- if @conference.cfp_open?
That means you have only
%b= pluralize(@program.cfp.remaining_days, 'day')
left!
Remember
= @conference.short_title
will only be as good as the sessions you present. Submit early, submit often!
- else
The submission period is closed.
.row
.col-md-12.text-center
%p.cta-button
= link_to "Submit your paper now", conference_proposal_index_path(@conference.short_title), class: 'btn btn-success btn-lg text-center'

View file

@ -1,7 +1,7 @@
%td.event{ style: "width: #{95 / @rooms.length}%; cursor:pointer", | %td.event{ style: "width: #{95 / @rooms.length}%; cursor:pointer", |
rowspan: span[room.id], | rowspan: span[room.id], |
role: "button" } | role: "button" } |
%a.unstyled-link{href: url_for(conference_proposal_path(@conference.short_title, event[0].id))} %a.unstyled-link{href: url_for(conference_program_proposal_path(@conference.short_title, event[0].id))}
- if speaker = event[0].speakers.first - if speaker = event[0].speakers.first
= image_tag speaker.gravatar_url, :class => "img-circle pull-right", | = image_tag speaker.gravatar_url, :class => "img-circle pull-right", |
:alt => speaker.name, | :alt => speaker.name, |

View file

@ -6,10 +6,10 @@
%p.lead.text-center %p.lead.text-center
= @conference.short_title = @conference.short_title
has the most awesome program ever! has the most awesome program ever!
- if @conference.splashpage and @conference.tracks.any? and @conference.splashpage.include_tracks - if @conference.splashpage and @conference.program.tracks.any? and @conference.splashpage.include_tracks
See rock-star speakers cover the topics of See rock-star speakers cover the topics of
- if @conference.splashpage and @conference.splashpage.include_tracks - if @conference.splashpage and @conference.splashpage.include_tracks
- @conference.tracks.each_slice(3) do |slice| - @conference.program.tracks.each_slice(3) do |slice|
.row.row-centered .row.row-centered
- slice.each do |track| - slice.each do |track|
.col-md-4.col-sm-4.col-centered.col-top.track .col-md-4.col-sm-4.col-centered.col-top.track
@ -17,7 +17,7 @@
= track.name = track.name
= markdown(track.description) = markdown(track.description)
- if @conference.call_for_paper and @conference.call_for_paper.schedule_public - if @conference.program and @conference.program.schedule_public
.row .row
.col-md-12 .col-md-12
%p.cta-button.text-center %p.cta-button.text-center
@ -28,10 +28,10 @@
%h3.text-center %h3.text-center
Don't miss out! Don't miss out!
%br %br
- if @conference.events.highlights.any? - if @conference.program.events.highlights.any?
.row .row
.col-md-12 .col-md-12
- @conference.events.highlights.each_slice(2) do |slice| - @conference.program.events.highlights.each_slice(2) do |slice|
.row.row-centered .row.row-centered
- slice.each do |event| - slice.each do |event|
.col-md-6.col-centered.col-top.highlights .col-md-6.col-centered.col-top.highlights
@ -39,7 +39,7 @@
%b= event.title %b= event.title
%h5.text-center %h5.text-center
= simple_format truncate(event.abstract, length: 500, separator: ' ') = simple_format truncate(event.abstract, length: 500, separator: ' ')
= link_to "Read More", conference_proposal_path(@conference.short_title, event) = link_to "Read More", conference_program_proposal_path(@conference.short_title, event)
= content_for :splash_nav do = content_for :splash_nav do
%li %li

View file

@ -1,5 +1,5 @@
<div class="container"> <div class="container">
<% if @conference.events.scheduled.any? %> <% if @conference.program.events.scheduled.any? %>
<div role="tabpanel"> <div role="tabpanel">
<!-- Nav tabs --> <!-- Nav tabs -->
<ul class="nav nav-tabs" role="tablist"> <ul class="nav nav-tabs" role="tablist">
@ -24,4 +24,4 @@
<% else %> <% else %>
<%= render 'all_events' %> <%= render 'all_events' %>
<% end %> <% end %>
</div> </div>

View file

@ -36,7 +36,7 @@
%section#program %section#program
= render 'schedule_splashpage' = render 'schedule_splashpage'
- if @conference.cfp_open? and @conference.splashpage.include_cfp - if @program.cfp_open? and @conference.splashpage.include_cfp
%section#callforpapers %section#callforpapers
= render 'call_for_paper' = render 'call_for_paper'

View file

@ -1,8 +1,8 @@
- if @conference.questions.any? - if @conference.questions.any?
= render partial: 'conference_registrations/questions', locals: { f: f } = render partial: 'conference_registrations/questions', locals: { f: f }
- if @conference.events.workshops.any? - if @conference.program.events.workshops.any?
=f.inputs 'Pre-registration required for the following:' do =f.inputs 'Pre-registration required for the following:' do
= f.input :events, as: :check_boxes, label: false, collection: @conference.events.workshops = f.input :events, as: :check_boxes, label: false, collection: @conference.program.events.workshops
= f.inputs 'Your Travel Info' do = f.inputs 'Your Travel Info' do
= f.input :arrival, as: :string, label: 'Your arrival time', input_html: { value: (f.object.arrival.to_formatted_s(:db_without_seconds) unless f.object.arrival.nil?), id: 'registration-arrival-datepicker', readonly: 'readonly' } = f.input :arrival, as: :string, label: 'Your arrival time', input_html: { value: (f.object.arrival.to_formatted_s(:db_without_seconds) unless f.object.arrival.nil?), id: 'registration-arrival-datepicker', readonly: 'readonly' }
= f.input :departure, as: :string, label: 'Your departure time', input_html: { value: (f.object.departure.to_formatted_s(:db_without_seconds) unless f.object.departure.nil?), id: 'registration-departure-datepicker', readonly: 'readonly' } = f.input :departure, as: :string, label: 'Your departure time', input_html: { value: (f.object.departure.to_formatted_s(:db_without_seconds) unless f.object.departure.nil?), id: 'registration-departure-datepicker', readonly: 'readonly' }

View file

@ -126,13 +126,13 @@
- @conference.participants.each do |participant| - @conference.participants.each do |participant|
= image_tag(participant.gravatar_url(size: '25'), title: "#{participant.name}!", class: 'img-circle') = image_tag(participant.gravatar_url(size: '25'), title: "#{participant.name}!", class: 'img-circle')
.col-md-4.col-md-offset-2 .col-md-4.col-md-offset-2
- if @conference.speakers.confirmed.any? - if @conference.program.speakers.confirmed.any?
%h4 %h4
%span.fa-stack %span.fa-stack
%i.fa.fa-square-o.fa-stack-2x %i.fa.fa-square-o.fa-stack-2x
%i.fa.fa-microphone.fa-stack-1x %i.fa.fa-microphone.fa-stack-1x
= @conference.speakers.confirmed.count = @conference.program.speakers.confirmed.count
Confirmed Confirmed
= word_pluralize(@conference.speakers.confirmed.count, 'Speaker') = word_pluralize(@conference.program.speakers.confirmed.count, 'Speaker')
- @conference.speakers.confirmed.each do |speaker| - @conference.program.speakers.confirmed.each do |speaker|
= image_tag(speaker.gravatar_url(size: '25'), title: "#{speaker.name}!", class: 'img-circle') = image_tag(speaker.gravatar_url(size: '25'), title: "#{speaker.name}!", class: 'img-circle')

View file

@ -53,33 +53,33 @@
%span.fa.fa-road %span.fa.fa-road
Venue Venue
%ul %ul
- if can? :update, @conference.rooms.build - if can? :update, @conference.program.rooms.build
%li{:class=> active_nav_li(admin_conference_rooms_path(@conference.short_title))} %li{:class=> active_nav_li(admin_conference_program_rooms_path(@conference.short_title))}
= link_to 'Rooms', admin_conference_rooms_path(@conference.short_title) = link_to 'Rooms', admin_conference_program_rooms_path(@conference.short_title)
- if can? :update, @conference.lodgings.build - if can? :update, @conference.lodgings.build
%li{ class: active_nav_li(admin_conference_lodgings_path(@conference.short_title)) } %li{ class: active_nav_li(admin_conference_lodgings_path(@conference.short_title)) }
= link_to 'Lodgings', admin_conference_lodgings_path(@conference.short_title) = link_to 'Lodgings', admin_conference_lodgings_path(@conference.short_title)
- if can? :update, @conference.events.build %li{:class=> "#{active_nav_li(admin_conference_program_path(@conference.short_title))}"}
%li = link_to admin_conference_program_path(@conference.short_title) do
%a
%span.fa.fa-calendar %span.fa.fa-calendar
Program Program
%ul %ul
%li{:class=> active_nav_li(admin_conference_events_path(@conference.short_title))} - if can? :update, Cfp.new(program_id: @conference.program.id)
= link_to 'Events', admin_conference_events_path(@conference.short_title) %li{:class=> active_nav_li(admin_conference_program_cfp_path(@conference.short_title))}
- if can? :update, CallForPaper.new(conference_id: @conference.id) = link_to 'Call for Papers', admin_conference_program_cfp_path(@conference.short_title)
%li{:class=> "#{active_nav_li(admin_conference_call_for_paper_path(@conference.short_title))}"} - if can? :update, @conference.program.events.build
= link_to 'Call for Papers', admin_conference_call_for_paper_path(@conference.short_title) %li{:class=> active_nav_li(admin_conference_program_events_path(@conference.short_title))}
- if can? :update, @conference.tracks.build = link_to 'Events', admin_conference_program_events_path(@conference.short_title)
%li{:class=> active_nav_li(admin_conference_tracks_path(@conference.short_title))} - if can? :update, @conference.program.tracks.build
= link_to 'Tracks', admin_conference_tracks_path(@conference.short_title) %li{:class=> active_nav_li(admin_conference_program_tracks_path(@conference.short_title))}
- if can? :update, @conference.event_types.build = link_to 'Tracks', admin_conference_program_tracks_path(@conference.short_title)
%li{:class=> active_nav_li(admin_conference_event_types_path(@conference.short_title))} - if can? :update, @conference.program.event_types.build
= link_to 'Event Types', admin_conference_event_types_path(@conference.short_title) %li{:class=> active_nav_li(admin_conference_program_event_types_path(@conference.short_title))}
- if can? :update, @conference.difficulty_levels.build, conference_id: @conference.id = link_to 'Event Types', admin_conference_program_event_types_path(@conference.short_title)
%li{:class=> active_nav_li(admin_conference_difficulty_levels_path(@conference.short_title))} - if can? :update, @conference.program.difficulty_levels.build, conference_id: @conference.id
= link_to 'Difficulty Levels', admin_conference_difficulty_levels_path(@conference.short_title) %li{:class=> active_nav_li(admin_conference_program_difficulty_levels_path(@conference.short_title))}
- if can? :update, @conference.events.build = link_to 'Difficulty Levels', admin_conference_program_difficulty_levels_path(@conference.short_title)
- if can? :update, @conference.program.events.build
%li{class: active_nav_li(admin_conference_schedule_path(@conference.short_title))} %li{class: active_nav_li(admin_conference_schedule_path(@conference.short_title))}
= link_to 'Schedule', admin_conference_schedule_path(@conference.short_title), target: '_blank' = link_to 'Schedule', admin_conference_schedule_path(@conference.short_title), target: '_blank'

View file

@ -37,7 +37,7 @@
- if unread_notifications(current_user).length > 0 - if unread_notifications(current_user).length > 0
%li.dropdown-header Last 5 Comments for: %li.dropdown-header Last 5 Comments for:
- unread_notifications(current_user).limit(5).group_by{ |comment| comment.commentable}.each do |event, comments| - unread_notifications(current_user).limit(5).group_by{ |comment| comment.commentable}.each do |event, comments|
%li= link_to("#{event.title}(#{comments.count})", admin_conference_event_path(event.conference.short_title, event.id)) %li= link_to("#{event.title}(#{comments.count})", admin_conference_program_event_path(event.program.conference.short_title, event.id))
%li.divider %li.divider
%li= link_to "See all unread Comments (#{unread_notifications(current_user).length})", admin_comments_path %li= link_to "See all unread Comments (#{unread_notifications(current_user).length})", admin_comments_path
%li= link_to 'See all Comments', admin_comments_path(anchor: 'all_comments') %li= link_to 'See all Comments', admin_comments_path(anchor: 'all_comments')

View file

@ -7,9 +7,9 @@
= link_to(edit_user_path(current_user.id)) do = link_to(edit_user_path(current_user.id)) do
%span.fa.fa-user %span.fa.fa-user
Edit Profile Edit Profile
-if @conference and @conference.call_for_paper -if @conference and @conference.program
%li %li
= link_to(conference_proposal_index_path(@conference.short_title)) do = link_to(conference_program_proposal_index_path(@conference.short_title)) do
%span.fa.fa-comment %span.fa.fa-comment
My Submissions My Submissions
%li %li

View file

@ -1,20 +1,20 @@
%p.lead %p.lead
- if @conference.event_types.any? - if @program.event_types.any?
You can submit proposals for You can submit proposals for
= "#{event_types(@conference)}." = "#{event_types(@conference)}."
- if @conference.tracks.any? - if @program.tracks.any?
Proposals should fit in one of the Proposals should fit in one of the
= "#{pluralize(@conference.tracks.count, 'track')}:" = "#{pluralize(@program.tracks.count, 'track')}:"
= "#{tracks(@conference)}." = "#{tracks(@conference)}."
- if @conference.cfp_open? - if @program.cfp_open?
The submission period has begun The submission period has begun
%em %em
= @conference.call_for_paper.start_date.strftime('%A, %B %-d. %Y') = @program.cfp.start_date.strftime('%A, %B %-d. %Y')
and closes and closes
%em %em
= @conference.call_for_paper.end_date.strftime('%A, %B %-d. %Y.') = @program.cfp.end_date.strftime('%A, %B %-d. %Y.')
That means you have That means you have
%b= pluralize(@conference.call_for_paper.remaining_days, 'day') %b= pluralize(@program.cfp.remaining_days, 'day')
left! left!
Remember Remember
= @conference.title = @conference.title

View file

@ -13,7 +13,7 @@
#commercials-content.tab-pane #commercials-content.tab-pane
%p.text-muted %p.text-muted
You can add commercials for your proposal. These commercials will be displayed on the You can add commercials for your proposal. These commercials will be displayed on the
= link_to 'public proposal page.', conference_proposal_path(@conference.short_title, @event) = link_to 'public proposal page.', conference_program_proposal_path(@conference.short_title, @event)
If you don't add a commercial, the conference commercial will be displayed! If you don't add a commercial, the conference commercial will be displayed!
- if can? :create, @event.commercials.new - if can? :create, @event.commercials.new
.row .row
@ -37,9 +37,9 @@
= render partial: 'shared/media_item', locals: { commercial: commercial } = render partial: 'shared/media_item', locals: { commercial: commercial }
.caption .caption
- if can? :update, commercial - if can? :update, commercial
= semantic_form_for commercial, url: conference_proposal_commercial_path(conference_id: @conference.short_title, proposal_id: @event, id: commercial) do |f| = semantic_form_for commercial, url: conference_program_proposal_commercial_path(conference_id: @conference.short_title, proposal_id: @event, id: commercial) do |f|
= f.input :url, label: 'URL', as: :string, input_html: { id: "commercial_url_#{commercial.id}", required: 'required', type: 'url' } = f.input :url, label: 'URL', as: :string, input_html: { id: "commercial_url_#{commercial.id}", required: 'required', type: 'url' }
= f.action :submit, as: :button, button_html: { class: 'btn btn-success' }, label: 'Update' = f.action :submit, as: :button, button_html: { class: 'btn btn-success' }, label: 'Update'
- if can? :destroy, commercial - if can? :destroy, commercial
= link_to 'Delete', conference_proposal_commercial_path(@conference.short_title, @event.id, commercial.id), = link_to 'Delete', conference_program_proposal_commercial_path(@conference.short_title, @event.id, commercial.id),
:method => :delete, :data => { :confirm => 'Are you sure?' }, class: 'btn btn-danger' :method => :delete, :data => { :confirm => 'Are you sure?' }, class: 'btn btn-danger'

View file

@ -5,21 +5,21 @@
= f.input :subtitle, as: :string = f.input :subtitle, as: :string
= f.input :event_type_id, as: :select, = f.input :event_type_id, as: :select,
collection: @conference.event_types.map {|type| ["#{type.title} - #{show_time(type.length)}", type.id, collection: @conference.program.event_types.map {|type| ["#{type.title} - #{show_time(type.length)}", type.id,
data: { min_words: type.minimum_abstract_length, max_words: type.maximum_abstract_length }]}, data: { min_words: type.minimum_abstract_length, max_words: type.maximum_abstract_length }]},
include_blank: false, label: 'Type', input_html: { class: 'select-help-toggle' } include_blank: false, label: 'Type', input_html: { class: 'select-help-toggle' }
- @conference.event_types.each do |event_type| - @conference.program.event_types.each do |event_type|
%span{ class: 'help-block select-help-text event_event_type_id collapse', id: "#{event_type.id}-help" } %span{ class: 'help-block select-help-text event_event_type_id collapse', id: "#{event_type.id}-help" }
= event_type.description = event_type.description
:javascript :javascript
$("##{@conference.event_types.first.id}-help").collapse('show'); $("##{@conference.program.event_types.first.id}-help").collapse('show');
= f.input :difficulty_level, as: :select, collection: @conference.difficulty_levels, input_html: { class: 'select-help-toggle' }, = f.input :difficulty_level, as: :select, collection: @conference.program.difficulty_levels, input_html: { class: 'select-help-toggle' },
include_blank: '(Please select)' if @conference.difficulty_levels.any? include_blank: '(Please select)' if @conference.program.difficulty_levels.any?
- @conference.difficulty_levels.each do |difficulty_level| - @conference.program.difficulty_levels.each do |difficulty_level|
%span{ class: 'help-block select-help-text collapse event_difficulty_level_id', id: "#{difficulty_level.id}-help" } %span{ class: 'help-block select-help-text collapse event_difficulty_level_id', id: "#{difficulty_level.id}-help" }
= difficulty_level.description = difficulty_level.description

View file

@ -3,9 +3,9 @@
%li{'class'=>class_for_todo(progress_status['registered'])} %li{'class'=>class_for_todo(progress_status['registered'])}
%span{'class'=>icon_for_todo(progress_status['registered'])} %span{'class'=>icon_for_todo(progress_status['registered'])}
- if progress_status['registered'] - if progress_status['registered']
= link_to 'Edit your registration', edit_conference_conference_registrations_path(event.conference.short_title) = link_to 'Edit your registration', edit_conference_conference_registrations_path(event.program.conference.short_title)
- else - else
= link_to 'Register to the conference', new_conference_conference_registrations_path(event.conference.short_title) = link_to 'Register to the conference', new_conference_conference_registrations_path(event.program.conference.short_title)
%li{'class'=>class_for_todo(progress_status['biography'])} %li{'class'=>class_for_todo(progress_status['biography'])}
%span{'class'=>icon_for_todo(progress_status['biography'])} %span{'class'=>icon_for_todo(progress_status['biography'])}
@ -17,20 +17,19 @@
%li{'class'=>class_for_todo(progress_status['subtitle'])} %li{'class'=>class_for_todo(progress_status['subtitle'])}
%span{'class'=>icon_for_todo(progress_status['subtitle'])} %span{'class'=>icon_for_todo(progress_status['subtitle'])}
- if progress_status['subtitle'] - if progress_status['subtitle']
= link_to 'Edit the subtitle', edit_conference_proposal_path(event.conference.short_title, event) = link_to 'Edit the subtitle', edit_conference_program_proposal_path(event.program.conference.short_title, event)
- else - else
= link_to 'Add a subtitle', edit_conference_proposal_path(event.conference.short_title, event) = link_to 'Add a subtitle', edit_conference_program_proposal_path(event.program.conference.short_title, event)
%li{'class'=>class_for_todo(progress_status['commercials'])} %li{'class'=>class_for_todo(progress_status['commercials'])}
%span{'class'=>icon_for_todo(progress_status['commercials'])} %span{'class'=>icon_for_todo(progress_status['commercials'])}
- if progress_status['commercials'] - if progress_status['commercials']
= link_to 'Edit the commercials', edit_conference_proposal_path(event.conference.short_title, event, anchor: 'commercials-content') = link_to 'Edit the commercials', edit_conference_program_proposal_path(event.program.conference.short_title, event, anchor: 'commercials-content')
- else - else
= link_to 'Add a commercial', edit_conference_proposal_path(event.conference.short_title, event, anchor: 'commercials-content') = link_to 'Add a commercial', edit_conference_program_proposal_path(event.conference.short_title, event, anchor: 'commercials-content')
%li{'class'=>class_for_todo(progress_status['difficulty_level'])} %li{'class'=>class_for_todo(progress_status['difficulty_level'])}
%span{'class'=>icon_for_todo(progress_status['difficulty_level'])} %span{'class'=>icon_for_todo(progress_status['difficulty_level'])}
- if progress_status['difficulty_level'] - if progress_status['difficulty_level']
= link_to 'Change the difficulty level', edit_conference_proposal_path(event.conference.short_title, event) = link_to 'Change the difficulty level', edit_conference_program_proposal_path(event.program.conference.short_title, event)
- else - else
= link_to 'Add a difficulty level', edit_conference_proposal_path(event.conference.short_title, event) = link_to 'Add a difficulty level', edit_conference_program_proposal_path(event.program.conference.short_title, event)

View file

@ -18,7 +18,7 @@
Some of your proposals have been selected as a highlight of #{@conference.title}! Some of your proposals have been selected as a highlight of #{@conference.title}!
%ul %ul
- @events.highlighted.each do |event| - @events.highlighted.each do |event|
%li= link_to event.title, conference_proposal_path(@conference.short_title, event) %li= link_to event.title, conference_program_proposal_path(@conference.short_title, event)
.row .row
@ -60,7 +60,7 @@
%span{ title: event.state.humanize, class: "fa #{event_status_icon(event)}" } %span{ title: event.state.humanize, class: "fa #{event_status_icon(event)}" }
%td.col-md-7{style: "padding:20px 8px 20px 8px;"} %td.col-md-7{style: "padding:20px 8px 20px 8px;"}
= link_to event.title, conference_proposal_path(@conference.short_title, event.id) = link_to event.title, conference_program_proposal_path(@conference.short_title, event.id)
%br %br
%small.text-muted %small.text-muted
= event.event_type.title = event.event_type.title
@ -82,20 +82,20 @@
.pull-right .pull-right
- if event.transition_possible? :confirm - if event.transition_possible? :confirm
= link_to 'Confirm', = link_to 'Confirm',
confirm_conference_proposal_path(@conference.short_title, event), confirm_conference_program_proposal_path(@conference.short_title, event),
method: :patch, class: 'btn btn-mini btn-success', id: "confirm_proposal_#{event.id}" method: :patch, class: 'btn btn-mini btn-success', id: "confirm_proposal_#{event.id}"
- if event.transition_possible? :withdraw - if event.transition_possible? :withdraw
= link_to 'Withdraw', conference_proposal_path(@conference.short_title, event.id), method: :delete, = link_to 'Withdraw', conference_program_proposal_path(@conference.short_title, event.id), method: :delete,
data: { confirm: 'Are you sure you want to withdraw this proposal?' }, class: 'btn btn-mini btn-warning', data: { confirm: 'Are you sure you want to withdraw this proposal?' }, class: 'btn btn-mini btn-warning',
id: "delete_proposal_#{event.id}" id: "delete_proposal_#{event.id}"
- if event.state == 'withdrawn' || event.state == 'rejected' - if event.state == 'withdrawn' || event.state == 'rejected'
= link_to 'Re-Submit', = link_to 'Re-Submit',
restart_conference_proposal_path(@conference.short_title, event.id), restart_conference_program_proposal_path(@conference.short_title, event.id),
method: :patch, class: 'btn btn-mini btn-success', id: "review_event_#{event.id}" method: :patch, class: 'btn btn-mini btn-success', id: "review_event_#{event.id}"
= link_to 'Edit', edit_conference_proposal_path(@conference.short_title, event.id), = link_to 'Edit', edit_conference_program_proposal_path(@conference.short_title, event.id),
class: 'btn btn-default', id: "edit_proposal_#{event.id}" class: 'btn btn-default', id: "edit_proposal_#{event.id}"
.row .row
.col-md-12 .col-md-12
- if @conference.cfp_open? || (current_user.has_role? :organizer, @conference) - if can? :create, @program.events.new
= link_to "New Proposal", new_conference_proposal_path(@conference.short_title), :class => "btn btn-success pull-right" = link_to "New Proposal", new_conference_program_proposal_path(@conference.short_title), :class => "btn btn-success pull-right"

View file

@ -27,16 +27,16 @@
= f.inputs name: 'Proposal Information' do = f.inputs name: 'Proposal Information' do
= f.input :title, as: :string, required: true, input_html: { required: true } = f.input :title, as: :string, required: true, input_html: { required: true }
= f.input :event_type_id, as: :select, = f.input :event_type_id, as: :select,
collection: @conference.event_types.map {|type| ["#{type.title} - #{show_time(type.length)}", type.id, collection: @program.event_types.map {|type| ["#{type.title} - #{show_time(type.length)}", type.id,
data: { min_words: type.minimum_abstract_length, max_words: type.maximum_abstract_length }]}, data: { min_words: type.minimum_abstract_length, max_words: type.maximum_abstract_length }]},
include_blank: false, label: 'Type', input_html: { class: 'select-help-toggle' } include_blank: false, label: 'Type', input_html: { class: 'select-help-toggle' }
- @conference.event_types.each do |event_type| - @program.event_types.each do |event_type|
%span{ class: 'help-block event_event_type_id collapse', id: "#{event_type.id}-help" } %span{ class: 'help-block event_event_type_id collapse', id: "#{event_type.id}-help" }
= event_type.description = event_type.description
:javascript :javascript
$("##{@conference.event_types.first.id}-help").collapse('show'); $("##{@program.event_types.first.id}-help").collapse('show');
= f.input :abstract, input_html: { rows: 5, required: true }, = f.input :abstract, input_html: { rows: 5, required: true },
required: true, hint: link_to('Tips to improve your presentations', 'http://blog.hubspot.com/blog/tabid/6307/bid/5975/10-Rules-to-Instantly-Improve-Your-Presentations.aspx') required: true, hint: link_to('Tips to improve your presentations', 'http://blog.hubspot.com/blog/tabid/6307/bid/5975/10-Rules-to-Instantly-Improve-Your-Presentations.aspx')

View file

@ -9,7 +9,7 @@
= @event.subtitle = @event.subtitle
= link_to "Schedule", schedule_conference_path(@conference.short_title), :class =>"btn btn-success pull-right" = link_to "Schedule", schedule_conference_path(@conference.short_title), :class =>"btn btn-success pull-right"
- if can? :edit, @event - if can? :edit, @event
= link_to "Edit", edit_admin_conference_event_path(@conference.short_title, @event), :class => "btn btn-mini btn-primary pull-right" = link_to "Edit", edit_admin_conference_program_event_path(@conference.short_title, @event), :class => "btn btn-mini btn-primary pull-right"
.row .row
.col-md-3 .col-md-3
%p %p
@ -24,7 +24,7 @@
- if @event.room_id - if @event.room_id
= @event.room.name = @event.room.name
%dt Conference: %dt Conference:
%dd= @event.conference.title %dd= @event.program.conference.title
%dt Language: %dt Language:
%dd= @event.language if @event.language %dd= @event.language if @event.language
%dt Track: %dt Track:

View file

@ -44,15 +44,30 @@ Osem::Application.routes.draw do
# Singletons # Singletons
resource :splashpage resource :splashpage
resource :call_for_paper
resource :venue resource :venue
resource :registration_period resource :registration_period
resource :program do
resource :cfp
resources :tracks
resources :event_types
resources :difficulty_levels
resources :rooms, except: [:show]
resources :events do
member do
post :comment
patch :accept
patch :confirm
patch :cancel
patch :reject
patch :unconfirm
patch :restart
get :vote
end
resource :speaker, only: [:edit, :update]
end
end
resources :tickets resources :tickets
resources :tracks
resources :event_types
resources :difficulty_levels
resources :rooms, except: [:show]
resources :sponsors, except: [:show] resources :sponsors, except: [:show]
resources :lodgings, except: [:show] resources :lodgings, except: [:show]
resources :targets, except: [:show] resources :targets, except: [:show]
@ -71,31 +86,19 @@ Osem::Application.routes.draw do
patch :update_conference patch :update_conference
end end
end end
resources :events do
member do
post :comment
patch :accept
patch :confirm
patch :cancel
patch :reject
patch :unconfirm
patch :restart
get :vote
end
resource :speaker, only: [:edit, :update]
end
end end
end end
resources :conference, only: [:index, :show] do resources :conference, only: [:index, :show] do
resources :proposal do resource :program, except: :destroy do
get 'commercials/render_commercial' => 'commercials#render_commercial' resources :proposal do
resources :commercials, only: [:create, :update, :destroy] get 'commercials/render_commercial' => 'commercials#render_commercial'
resources :event_attachment, controller: 'event_attachments' resources :commercials, only: [:create, :update, :destroy]
member do resources :event_attachment, controller: 'event_attachments'
patch '/confirm' => 'proposal#confirm' member do
patch '/restart' => 'proposal#restart' patch '/confirm' => 'proposal#confirm'
patch '/restart' => 'proposal#restart'
end
end end
end end

View file

@ -0,0 +1,75 @@
class CreateProgramsTable< ActiveRecord::Migration
class TempConference < ActiveRecord::Base
self.table_name = 'conferences'
end
class TempCfp < ActiveRecord::Base
self.table_name = 'cfps'
end
class TempCallForPaper < ActiveRecord::Base
self.table_name = 'call_for_papers'
end
class TempProgram < ActiveRecord::Base
self.table_name = 'programs'
end
def up
create_table :programs do |t|
t.references :conference
t.integer :rating, default: 0
t.boolean :schedule_public, default: false
t.boolean :schedule_fluid, default: false
end
add_column :call_for_papers, :program_id, :integer
TempConference.all.each do |conference|
unless TempProgram.find_by(conference_id: conference.id)
program = TempProgram.new
program.conference_id = conference.id
program.save!
if (cfp = TempCallForPaper.find_by(conference_id: conference.id))
cfp.program_id = program.id
cfp.save!
program.rating = cfp.rating
program.schedule_public = cfp.schedule_public
program.schedule_fluid = cfp.schedule_changes
program.save!
end
end
end
remove_column :call_for_papers, :conference_id
remove_column :call_for_papers, :rating
remove_column :call_for_papers, :schedule_public
remove_column :call_for_papers, :schedule_changes
rename_table :call_for_papers, :cfps
end
def down
rename_table :cfps, :call_for_papers
add_column :call_for_papers, :conference_id, :integer
add_column :call_for_papers, :rating, :integer, default: 0
add_column :call_for_papers, :schedule_public, :boolean, default: false
add_column :call_for_papers, :schedule_changes, :boolean, default: false
TempConference.all.each do |conference|
if (program = TempProgram.find_by(conference_id: conference.id))
if (cfp = TempCallForPaper.find_by(program_id: program.id))
cfp.conference_id = program.conference_id
cfp.rating = program.rating
cfp.schedule_public = program.schedule_public
cfp.schedule_changes = program.schedule_fluid
cfp.save!
end
end
end
remove_column :call_for_papers, :program_id
drop_table :programs
end
end

View file

@ -0,0 +1,117 @@
class RenameConferenceIdToProgramIdInEventsRoomsTracksDifficultyLevels < ActiveRecord::Migration
class TempConference < ActiveRecord::Base
self.table_name = 'conferences'
end
class TempEvent < ActiveRecord::Base
self.table_name = 'events'
end
class TempEventType < ActiveRecord::Base
self.table_name = 'event_types'
end
class TempTrack < ActiveRecord::Base
self.table_name = 'tracks'
end
class TempDifficultyLevel < ActiveRecord::Base
self.table_name = 'difficulty_levels'
end
class TempRoom < ActiveRecord::Base
self.table_name = 'rooms'
end
class TempProgram < ActiveRecord::Base
self.table_name = 'programs'
end
def up
add_column :events, :program_id, :integer
add_column :event_types, :program_id, :integer
add_column :tracks, :program_id, :integer
add_column :difficulty_levels, :program_id, :integer
add_column :rooms, :program_id, :integer
TempConference.all.each do |conference|
program = Program.find_by(conference_id: conference.id)
TempEvent.where(conference_id: conference.id).each do |event|
event.program_id = program.id
event.save!
end
TempEventType.where(conference_id: conference.id).each do |event_type|
event_type.program_id = program.id
event_type.save!
end
TempTrack.where(conference_id: conference.id).each do |track|
track.program_id = program.id
track.save!
end
TempDifficultyLevel.where(conference_id: conference.id).each do |difficulty_level|
difficulty_level.program_id = program.id
difficulty_level.save!
end
TempRoom.where(conference_id: conference.id).each do |room|
room.program_id = program.id
room.save!
end
end
remove_column :events, :conference_id
remove_column :event_types, :conference_id
remove_column :tracks, :conference_id
remove_column :difficulty_levels, :conference_id
remove_column :rooms, :conference_id
end
def down
add_column :events, :conference_id, :integer
add_column :event_types, :conference_id, :integer
add_column :tracks, :conference_id, :integer
add_column :difficulty_levels, :conference_id, :integer
add_column :rooms, :conference_id, :integer
TempConference.all.each do |conference|
program = TempProgram.find_by(conference_id: conference.id)
if program
TempEvent.where(program_id: program.id).each do |event|
event.conference_id = conference.id
event.save!
end
TempEventType.where(program_id: program.id).each do |event_type|
event_type.conference_id = conference.id
event_type.save!
end
TempTrack.where(program_id: program.id).each do |track|
track.conference_id = conference.id
track.save!
end
TempDifficultyLevel.where(program_id: program.id).each do |difficulty_level|
difficulty_level.conference_id = conference.id
difficulty_level.save!
end
TempRoom.where(program_id: program.id).each do |room|
room.conference_id = conference.id
room.save!
end
end
end
remove_column :events, :program_id
remove_column :event_types, :program_id
remove_column :tracks, :program_id
remove_column :difficulty_levels, :program_id
remove_column :rooms, :program_id
end
end

View file

@ -0,0 +1,10 @@
class RenameEmailSettingsWithCfpAndProgram < ActiveRecord::Migration
def change
rename_column :email_settings, :send_on_call_for_papers_schedule_public, :send_on_program_schedule_public
rename_column :email_settings, :call_for_papers_schedule_public_body, :program_schedule_public_template
rename_column :email_settings, :call_for_papers_schedule_public_subject, :program_schedule_public_subject
rename_column :email_settings, :send_on_call_for_papers_dates_updated, :send_on_cfp_dates_updates
rename_column :email_settings, :call_for_papers_dates_updated_subject, :cfp_dates_updates_subject
rename_column :email_settings, :call_for_papers_dates_updated_body, :cfp_dates_updates_template
end
end

View file

@ -11,8 +11,7 @@
# #
# It's strongly recommended that you check this file into your version control system. # It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20151021113015) do
ActiveRecord::Schema.define(version: 20151005161518) do
create_table "ahoy_events", force: true do |t| create_table "ahoy_events", force: true do |t|
t.uuid "visit_id" t.uuid "visit_id"
@ -22,25 +21,14 @@ ActiveRecord::Schema.define(version: 20151005161518) do
t.datetime "time" t.datetime "time"
end end
add_index "ahoy_events", ["time"], name: "index_ahoy_events_on_time" add_index "ahoy_events", ["time"], name: "index_ahoy_events_on_time", using: :btree
add_index "ahoy_events", ["user_id"], name: "index_ahoy_events_on_user_id" add_index "ahoy_events", ["user_id"], name: "index_ahoy_events_on_user_id", using: :btree
add_index "ahoy_events", ["visit_id"], name: "index_ahoy_events_on_visit_id" add_index "ahoy_events", ["visit_id"], name: "index_ahoy_events_on_visit_id", using: :btree
create_table "answers", force: true do |t| create_table "answers", force: true do |t|
t.string "title" t.string "title"
t.datetime "created_at" t.datetime "created_at", null: false
t.datetime "updated_at" t.datetime "updated_at", null: false
end
create_table "call_for_papers", force: true do |t|
t.date "start_date", null: false
t.date "end_date", null: false
t.integer "conference_id"
t.datetime "created_at"
t.datetime "updated_at"
t.boolean "schedule_changes", default: false
t.integer "rating", default: 3
t.boolean "schedule_public"
end end
create_table "campaigns", force: true do |t| create_table "campaigns", force: true do |t|
@ -55,23 +43,31 @@ ActiveRecord::Schema.define(version: 20151005161518) do
t.datetime "updated_at" t.datetime "updated_at"
end end
create_table "cfps", force: true do |t|
t.date "start_date", null: false
t.date "end_date", null: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.integer "program_id"
end
create_table "comments", force: true do |t| create_table "comments", force: true do |t|
t.string "title", limit: 50, default: "" t.string "title", limit: 50, default: ""
t.text "body" t.text "body", limit: 16777215
t.integer "commentable_id" t.integer "commentable_id"
t.string "commentable_type" t.string "commentable_type"
t.integer "user_id" t.integer "user_id"
t.datetime "created_at" t.datetime "created_at", null: false
t.datetime "updated_at" t.datetime "updated_at", null: false
t.string "subject" t.string "subject"
t.integer "parent_id" t.integer "parent_id"
t.integer "lft" t.integer "lft"
t.integer "rgt" t.integer "rgt"
end end
add_index "comments", ["commentable_id"], name: "index_comments_on_commentable_id" add_index "comments", ["commentable_id"], name: "index_comments_on_commentable_id", using: :btree
add_index "comments", ["commentable_type"], name: "index_comments_on_commentable_type" add_index "comments", ["commentable_type"], name: "index_comments_on_commentable_type", using: :btree
add_index "comments", ["user_id"], name: "index_comments_on_user_id" add_index "comments", ["user_id"], name: "index_comments_on_user_id", using: :btree
create_table "commercials", force: true do |t| create_table "commercials", force: true do |t|
t.string "commercial_id" t.string "commercial_id"
@ -91,8 +87,8 @@ ActiveRecord::Schema.define(version: 20151005161518) do
t.string "html_export_path" t.string "html_export_path"
t.date "start_date", null: false t.date "start_date", null: false
t.date "end_date", null: false t.date "end_date", null: false
t.datetime "created_at" t.datetime "created_at", null: false
t.datetime "updated_at" t.datetime "updated_at", null: false
t.string "logo_file_name" t.string "logo_file_name"
t.string "logo_content_type" t.string "logo_content_type"
t.integer "logo_file_size" t.integer "logo_file_size"
@ -140,65 +136,65 @@ ActiveRecord::Schema.define(version: 20151005161518) do
t.datetime "updated_at" t.datetime "updated_at"
end end
add_index "delayed_jobs", ["priority", "run_at"], name: "delayed_jobs_priority" add_index "delayed_jobs", ["priority", "run_at"], name: "delayed_jobs_priority", using: :btree
create_table "dietary_choices", force: true do |t| create_table "dietary_choices", force: true do |t|
t.integer "conference_id" t.integer "conference_id"
t.string "title", null: false t.string "title", null: false
t.datetime "created_at" t.datetime "created_at", null: false
t.datetime "updated_at" t.datetime "updated_at", null: false
end end
create_table "difficulty_levels", force: true do |t| create_table "difficulty_levels", force: true do |t|
t.integer "conference_id"
t.string "title" t.string "title"
t.text "description" t.text "description"
t.string "color" t.string "color"
t.datetime "created_at" t.datetime "created_at", null: false
t.datetime "updated_at" t.datetime "updated_at", null: false
t.integer "program_id"
end end
create_table "email_settings", force: true do |t| create_table "email_settings", force: true do |t|
t.integer "conference_id" t.integer "conference_id"
t.boolean "send_on_registration", default: false t.boolean "send_on_registration", default: false
t.boolean "send_on_accepted", default: false t.boolean "send_on_accepted", default: false
t.boolean "send_on_rejected", default: false t.boolean "send_on_rejected", default: false
t.boolean "send_on_confirmed_without_registration", default: false t.boolean "send_on_confirmed_without_registration", default: false
t.text "registration_body" t.text "registration_body", limit: 16777215
t.text "accepted_body" t.text "accepted_body", limit: 16777215
t.text "rejected_body" t.text "rejected_body", limit: 16777215
t.text "confirmed_without_registration_body" t.text "confirmed_without_registration_body", limit: 16777215
t.datetime "created_at" t.datetime "created_at", null: false
t.datetime "updated_at" t.datetime "updated_at", null: false
t.string "registration_subject" t.string "registration_subject"
t.string "accepted_subject" t.string "accepted_subject"
t.string "rejected_subject" t.string "rejected_subject"
t.string "confirmed_without_registration_subject" t.string "confirmed_without_registration_subject"
t.boolean "send_on_conference_dates_updated", default: false t.boolean "send_on_conference_dates_updated", default: false
t.string "conference_dates_updated_subject" t.string "conference_dates_updated_subject"
t.text "conference_dates_updated_body" t.text "conference_dates_updated_body"
t.boolean "send_on_conference_registration_dates_updated", default: false t.boolean "send_on_conference_registration_dates_updated", default: false
t.string "conference_registration_dates_updated_subject" t.string "conference_registration_dates_updated_subject"
t.text "conference_registration_dates_updated_body" t.text "conference_registration_dates_updated_body"
t.boolean "send_on_venue_updated", default: false t.boolean "send_on_venue_updated", default: false
t.string "venue_updated_subject" t.string "venue_updated_subject"
t.text "venue_updated_body" t.text "venue_updated_body"
t.boolean "send_on_call_for_papers_dates_updated", default: false t.boolean "send_on_cfp_dates_updates", default: false
t.boolean "send_on_call_for_papers_schedule_public", default: false t.boolean "send_on_program_schedule_public", default: false
t.string "call_for_papers_schedule_public_subject" t.string "program_schedule_public_subject"
t.string "call_for_papers_dates_updated_subject" t.string "cfp_dates_updates_subject"
t.text "call_for_papers_schedule_public_body" t.text "program_schedule_public_template"
t.text "call_for_papers_dates_updated_body" t.text "cfp_dates_updates_template"
end end
create_table "event_types", force: true do |t| create_table "event_types", force: true do |t|
t.integer "conference_id"
t.string "title", null: false t.string "title", null: false
t.integer "length", default: 30 t.integer "length", default: 30
t.integer "minimum_abstract_length", default: 0 t.integer "minimum_abstract_length", default: 0
t.integer "maximum_abstract_length", default: 500 t.integer "maximum_abstract_length", default: 500
t.string "color" t.string "color"
t.string "description" t.string "description"
t.integer "program_id"
end end
create_table "event_users", force: true do |t| create_table "event_users", force: true do |t|
@ -211,32 +207,32 @@ ActiveRecord::Schema.define(version: 20151005161518) do
end end
create_table "events", force: true do |t| create_table "events", force: true do |t|
t.string "guid", null: false t.string "guid", null: false
t.integer "conference_id"
t.integer "event_type_id" t.integer "event_type_id"
t.string "title", null: false t.string "title", null: false
t.string "subtitle" t.string "subtitle"
t.integer "time_slots" t.integer "time_slots"
t.string "state", default: "new", null: false t.string "state", default: "new", null: false
t.string "progress", default: "new", null: false t.string "progress", default: "new", null: false
t.string "language" t.string "language"
t.datetime "start_time" t.datetime "start_time"
t.text "abstract" t.text "abstract", limit: 16777215
t.text "description" t.text "description", limit: 16777215
t.boolean "public", default: true t.boolean "public", default: true
t.string "logo_file_name" t.string "logo_file_name"
t.string "logo_content_type" t.string "logo_content_type"
t.integer "logo_file_size" t.integer "logo_file_size"
t.datetime "logo_updated_at" t.datetime "logo_updated_at"
t.text "proposal_additional_speakers" t.text "proposal_additional_speakers", limit: 16777215
t.integer "track_id" t.integer "track_id"
t.integer "room_id" t.integer "room_id"
t.datetime "created_at" t.datetime "created_at", null: false
t.datetime "updated_at" t.datetime "updated_at", null: false
t.boolean "require_registration" t.boolean "require_registration"
t.integer "difficulty_level_id" t.integer "difficulty_level_id"
t.integer "week" t.integer "week"
t.boolean "is_highlight", default: false t.boolean "is_highlight", default: false
t.integer "program_id"
end end
create_table "events_registrations", id: false, force: true do |t| create_table "events_registrations", id: false, force: true do |t|
@ -277,6 +273,13 @@ ActiveRecord::Schema.define(version: 20151005161518) do
t.datetime "updated_at" t.datetime "updated_at"
end end
create_table "programs", force: true do |t|
t.integer "conference_id"
t.integer "rating", default: 0
t.boolean "schedule_public", default: false
t.boolean "schedule_fluid", default: false
end
create_table "qanswers", force: true do |t| create_table "qanswers", force: true do |t|
t.integer "question_id" t.integer "question_id"
t.integer "answer_id" t.integer "answer_id"
@ -291,8 +294,8 @@ ActiveRecord::Schema.define(version: 20151005161518) do
create_table "question_types", force: true do |t| create_table "question_types", force: true do |t|
t.string "title" t.string "title"
t.datetime "created_at" t.datetime "created_at", null: false
t.datetime "updated_at" t.datetime "updated_at", null: false
end end
create_table "questions", force: true do |t| create_table "questions", force: true do |t|
@ -300,8 +303,8 @@ ActiveRecord::Schema.define(version: 20151005161518) do
t.integer "question_type_id" t.integer "question_type_id"
t.integer "conference_id" t.integer "conference_id"
t.boolean "global" t.boolean "global"
t.datetime "created_at" t.datetime "created_at", null: false
t.datetime "updated_at" t.datetime "updated_at", null: false
end end
create_table "registration_periods", force: true do |t| create_table "registration_periods", force: true do |t|
@ -316,12 +319,12 @@ ActiveRecord::Schema.define(version: 20151005161518) do
t.integer "conference_id" t.integer "conference_id"
t.datetime "arrival" t.datetime "arrival"
t.datetime "departure" t.datetime "departure"
t.datetime "created_at" t.datetime "created_at", null: false
t.datetime "updated_at" t.datetime "updated_at", null: false
t.integer "dietary_choice_id" t.integer "dietary_choice_id"
t.text "other_dietary_choice" t.text "other_dietary_choice", limit: 16777215
t.text "other_special_needs" t.text "other_special_needs", limit: 16777215
t.boolean "attended", default: false t.boolean "attended", default: false
t.boolean "volunteer" t.boolean "volunteer"
t.integer "user_id" t.integer "user_id"
t.integer "week" t.integer "week"
@ -339,28 +342,28 @@ ActiveRecord::Schema.define(version: 20151005161518) do
create_table "roles", force: true do |t| create_table "roles", force: true do |t|
t.string "name" t.string "name"
t.datetime "created_at" t.datetime "created_at", null: false
t.datetime "updated_at" t.datetime "updated_at", null: false
t.string "description" t.string "description"
t.integer "resource_id" t.integer "resource_id"
t.string "resource_type" t.string "resource_type"
end end
add_index "roles", ["name", "resource_type", "resource_id"], name: "index_roles_on_name_and_resource_type_and_resource_id" add_index "roles", ["name", "resource_type", "resource_id"], name: "index_roles_on_name_and_resource_type_and_resource_id", using: :btree
add_index "roles", ["name"], name: "index_roles_on_name" add_index "roles", ["name"], name: "index_roles_on_name", using: :btree
create_table "roles_users", id: false, force: true do |t| create_table "roles_users", id: false, force: true do |t|
t.integer "role_id" t.integer "role_id"
t.integer "user_id" t.integer "user_id"
end end
add_index "roles_users", ["user_id", "role_id"], name: "index_roles_users_on_user_id_and_role_id" add_index "roles_users", ["user_id", "role_id"], name: "index_roles_users_on_user_id_and_role_id", using: :btree
create_table "rooms", force: true do |t| create_table "rooms", force: true do |t|
t.string "guid", null: false t.string "guid", null: false
t.integer "conference_id" t.string "name", null: false
t.string "name", null: false
t.integer "size" t.integer "size"
t.integer "program_id"
end end
create_table "social_events", force: true do |t| create_table "social_events", force: true do |t|
@ -443,13 +446,13 @@ ActiveRecord::Schema.define(version: 20151005161518) do
end end
create_table "tracks", force: true do |t| create_table "tracks", force: true do |t|
t.string "guid", null: false t.string "guid", null: false
t.integer "conference_id" t.string "name", null: false
t.string "name", null: false t.text "description", limit: 16777215
t.text "description"
t.string "color" t.string "color"
t.datetime "created_at" t.datetime "created_at", null: false
t.datetime "updated_at" t.datetime "updated_at", null: false
t.integer "program_id"
end end
create_table "users", force: true do |t| create_table "users", force: true do |t|
@ -467,8 +470,8 @@ ActiveRecord::Schema.define(version: 20151005161518) do
t.datetime "confirmed_at" t.datetime "confirmed_at"
t.datetime "confirmation_sent_at" t.datetime "confirmation_sent_at"
t.string "unconfirmed_email" t.string "unconfirmed_email"
t.datetime "created_at" t.datetime "created_at", null: false
t.datetime "updated_at" t.datetime "updated_at", null: false
t.string "name" t.string "name"
t.boolean "email_public" t.boolean "email_public"
t.text "biography" t.text "biography"
@ -487,10 +490,10 @@ ActiveRecord::Schema.define(version: 20151005161518) do
t.boolean "is_disabled", default: false t.boolean "is_disabled", default: false
end end
add_index "users", ["confirmation_token"], name: "index_users_on_confirmation_token", unique: true add_index "users", ["confirmation_token"], name: "index_users_on_confirmation_token", unique: true, using: :btree
add_index "users", ["email"], name: "index_users_on_email", unique: true add_index "users", ["email"], name: "index_users_on_email", unique: true, using: :btree
add_index "users", ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true add_index "users", ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true, using: :btree
add_index "users", ["username"], name: "index_users_on_username", unique: true add_index "users", ["username"], name: "index_users_on_username", unique: true, using: :btree
create_table "vchoices", force: true do |t| create_table "vchoices", force: true do |t|
t.integer "vday_id" t.integer "vday_id"
@ -501,8 +504,8 @@ ActiveRecord::Schema.define(version: 20151005161518) do
t.integer "conference_id" t.integer "conference_id"
t.date "day" t.date "day"
t.text "description" t.text "description"
t.datetime "created_at" t.datetime "created_at", null: false
t.datetime "updated_at" t.datetime "updated_at", null: false
end end
create_table "venues", force: true do |t| create_table "venues", force: true do |t|
@ -510,8 +513,8 @@ ActiveRecord::Schema.define(version: 20151005161518) do
t.string "name" t.string "name"
t.string "website" t.string "website"
t.text "description" t.text "description"
t.datetime "created_at" t.datetime "created_at", null: false
t.datetime "updated_at" t.datetime "updated_at", null: false
t.string "photo_file_name" t.string "photo_file_name"
t.string "photo_content_type" t.string "photo_content_type"
t.integer "photo_file_size" t.integer "photo_file_size"
@ -526,16 +529,16 @@ ActiveRecord::Schema.define(version: 20151005161518) do
end end
create_table "versions", force: true do |t| create_table "versions", force: true do |t|
t.string "item_type", null: false t.string "item_type", null: false
t.integer "item_id", null: false t.integer "item_id", null: false
t.string "event", null: false t.string "event", null: false
t.string "whodunnit" t.string "whodunnit"
t.text "object" t.text "object", limit: 16777215
t.text "object_changes" t.text "object_changes", limit: 16777215
t.datetime "created_at" t.datetime "created_at"
end end
add_index "versions", ["item_type", "item_id"], name: "index_versions_on_item_type_and_item_id" add_index "versions", ["item_type", "item_id"], name: "index_versions_on_item_type_and_item_id", using: :btree
create_table "visits", force: true do |t| create_table "visits", force: true do |t|
t.uuid "visitor_id" t.uuid "visitor_id"
@ -560,13 +563,13 @@ ActiveRecord::Schema.define(version: 20151005161518) do
t.datetime "started_at" t.datetime "started_at"
end end
add_index "visits", ["user_id"], name: "index_visits_on_user_id" add_index "visits", ["user_id"], name: "index_visits_on_user_id", using: :btree
create_table "votes", force: true do |t| create_table "votes", force: true do |t|
t.integer "event_id" t.integer "event_id"
t.integer "rating" t.integer "rating"
t.datetime "created_at" t.datetime "created_at", null: false
t.datetime "updated_at" t.datetime "updated_at", null: false
t.integer "user_id" t.integer "user_id"
end end
@ -574,8 +577,8 @@ ActiveRecord::Schema.define(version: 20151005161518) do
t.integer "conference_id" t.integer "conference_id"
t.string "title", null: false t.string "title", null: false
t.text "description" t.text "description"
t.datetime "created_at" t.datetime "created_at", null: false
t.datetime "updated_at" t.datetime "updated_at", null: false
end end
end end

View file

@ -8,7 +8,7 @@ describe Admin::CommentsController, type: :controller do
let!(:organizer_role) { create(:role, name: 'organizer', resource: conference) } let!(:organizer_role) { create(:role, name: 'organizer', resource: conference) }
let(:organizer) { create(:user, role_ids: organizer_role.id, last_sign_in_at: Time.now - 1.day) } let(:organizer) { create(:user, role_ids: organizer_role.id, last_sign_in_at: Time.now - 1.day) }
let(:participant) { create(:user) } let(:participant) { create(:user) }
let(:event) { create(:event, conference: conference) } let(:event) { create(:event, program: conference.program) }
let(:comment) { create(:comment, commentable_type: 'Event', commentable_id: event.id) } let(:comment) { create(:comment, commentable_type: 'Event', commentable_id: event.id) }
context 'not logged in user' do context 'not logged in user' do
@ -32,7 +32,7 @@ describe Admin::CommentsController, type: :controller do
expect(assigns(:comments)).to be_a(Hash) expect(assigns(:comments)).to be_a(Hash)
# assigns(:comments).first returns an array of first pair key-value from hash. # assigns(:comments).first returns an array of first pair key-value from hash.
# Calling again 'first' returns the key, meaning the Conference object. # Calling again 'first' returns the key, meaning the Conference object.
expect(assigns(:comments).first.first.title).to eq(comment.commentable.conference.title) expect(assigns(:comments).first.first.title).to eq(comment.commentable.program.conference.title)
end end
it 'has status 200: OK' do it 'has status 200: OK' do
get :index get :index

View file

@ -165,9 +165,10 @@ describe Admin::ConferenceController do
it 'assigns cfp_max an array with maximum weeks' do it 'assigns cfp_max an array with maximum weeks' do
conference conference
date = Date.new(2014, 05, 26) date = Date.new(2014, 05, 26)
conference.call_for_paper = create(:call_for_paper, conference.program.cfp = create(:cfp,
start_date: date, program: conference.program,
end_date: date + 14) start_date: date,
end_date: date + 14)
get :index get :index
expect(assigns(:cfp_weeks)).to match_array([1, 2, 3]) expect(assigns(:cfp_weeks)).to match_array([1, 2, 3])
end end

View file

@ -0,0 +1,33 @@
require 'spec_helper'
describe Admin::ProgramsController, type: :controller 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, last_sign_in_at: Time.now - 1.day) }
context 'not logged in user' do
describe 'GET #show' do
it 'does not render admin/programs#show' do
get :show, conference_id: conference.short_title
expect(response).to redirect_to(user_session_path)
end
end
end
context 'logged in as admin, organizer or cfp' do
before :each do
sign_in(organizer)
end
describe 'PATCH #update' do
it 'redirects to admin/programs#index' do
patch :update, conference_id: conference.short_title, program: attributes_for(:program)
conference.program.reload
expect(response).to redirect_to admin_conference_program_path(conference.short_title)
end
end
end
end

View file

@ -1,7 +1,8 @@
# Read about factories at https://github.com/thoughtbot/factory_girl # Read about factories at https://github.com/thoughtbot/factory_girl
FactoryGirl.define do FactoryGirl.define do
factory :call_for_paper do factory :cfp do
program
start_date { 1.day.ago } start_date { 1.day.ago }
end_date { 6.days.from_now } end_date { 6.days.from_now }
end end

View file

@ -7,11 +7,12 @@ FactoryGirl.define do
timezone 'Amsterdam' timezone 'Amsterdam'
start_date { Date.today } start_date { Date.today }
end_date { 6.days.from_now } end_date { 6.days.from_now }
program
factory :full_conference do factory :full_conference do
venue venue
splashpage splashpage
registration_period registration_period
call_for_paper
after(:build) do |conference| after(:build) do |conference|
conference.commercials << build(:conference_commercial, commercialable: conference) conference.commercials << build(:conference_commercial, commercialable: conference)

View file

@ -3,7 +3,6 @@ FactoryGirl.define do
title 'Example Difficulty Level' title 'Example Difficulty Level'
description 'Lorem Ipsum dolsum' description 'Lorem Ipsum dolsum'
color '#ffffff' color '#ffffff'
conference program
end end
end end

View file

@ -8,8 +8,8 @@ FactoryGirl.define do
send_on_confirmed_without_registration false send_on_confirmed_without_registration false
send_on_conference_dates_updated true send_on_conference_dates_updated true
send_on_conference_registration_dates_updated true send_on_conference_registration_dates_updated true
send_on_call_for_papers_schedule_public true send_on_program_schedule_public true
send_on_call_for_papers_dates_updated true send_on_cfp_dates_updated true
conference_dates_updated_body 'Sample Conference\n New Dates: January 17 - 21 2014' conference_dates_updated_body 'Sample Conference\n New Dates: January 17 - 21 2014'
conference_dates_updated_subject 'Conference dates have been updated' conference_dates_updated_subject 'Conference dates have been updated'
conference_registration_dates_updated_subject 'Conference registration dates have been updated' conference_registration_dates_updated_subject 'Conference registration dates have been updated'
@ -19,9 +19,9 @@ FactoryGirl.define do
venue_updated_body 'Venue has been Updated to Sample Location' venue_updated_body 'Venue has been Updated to Sample Location'
registration_subject 'Lorem Ipsum Dolsum' registration_subject 'Lorem Ipsum Dolsum'
registration_body 'Lorem ipsum dolor sit amet, consectetuer adipiscing elit' registration_body 'Lorem ipsum dolor sit amet, consectetuer adipiscing elit'
call_for_papers_dates_updated_subject 'Call for Papers dates have been updated' cfp_dates_updated_subject 'Call for Papers dates have been updated'
call_for_papers_dates_updated_body 'Please checkout the new updates to submit your proposal for Sample Conference' cfp_dates_updated_body 'Please checkout the new updates to submit your proposal for Sample Conference'
call_for_papers_schedule_public_subject 'Sample Conference Cfp schedule is Public' program_schedule_public_subject 'Sample Conference Cfp schedule is Public'
call_for_papers_schedule_public_body 'Call for Papers schedule is Public.Checkout the link' program_schedule_public_body 'Call for Papers schedule is Public.Checkout the link'
end end
end end

View file

@ -6,7 +6,7 @@ FactoryGirl.define do
length 30 length 30
minimum_abstract_length 0 minimum_abstract_length 0
maximum_abstract_length 500 maximum_abstract_length 500
conference program
end end
end end

View file

@ -3,7 +3,7 @@
FactoryGirl.define do FactoryGirl.define do
factory :event do factory :event do
sequence(:title) { |n| "The ##{n} talk you'll ever attend." } sequence(:title) { |n| "The ##{n} talk you'll ever attend." }
conference program
abstract <<-EOS abstract <<-EOS
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer ante Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer ante
lacus, mollis non urna vitae, varius semper leo. Nulla ac nibh dui. Mauris lacus, mollis non urna vitae, varius semper leo. Nulla ac nibh dui. Mauris
@ -35,7 +35,7 @@ FactoryGirl.define do
# set an event_type if none is passed to the factory. # set an event_type if none is passed to the factory.
# needs to be created here because otherwise it doesn't belong to the # needs to be created here because otherwise it doesn't belong to the
# same conference as the event # same conference as the event
event.event_type ||= build(:event_type, conference: event.conference) event.event_type ||= build(:event_type, program: event.program)
end end
factory :event_full do factory :event_full do
@ -44,9 +44,9 @@ FactoryGirl.define do
room room
after(:build) do |event| after(:build) do |event|
event.commercials << build(:event_commercial, commercialable: event) event.commercials << build(:event_commercial, commercialable: event)
event.difficulty_level = build(:difficulty_level, conference: event.conference) event.difficulty_level = build(:difficulty_level, program: event.program)
event.track = build(:track, conference: event.conference) event.track = build(:track, program: event.program)
event.room = build(:room, conference: event.conference) event.room = build(:room, program: event.program)
event.comment_threads << build(:comment, commentable: event) event.comment_threads << build(:comment, commentable: event)
end end
end end

View file

@ -0,0 +1,9 @@
# Read about factories at https://github.com/thoughtbot/factory_girl
FactoryGirl.define do
factory :program do
schedule_public false
schedule_fluid false
# conference
end
end

View file

@ -3,7 +3,7 @@ FactoryGirl.define do
factory :room do factory :room do
name 'Example Room' name 'Example Room'
size 4 size 4
conference program
factory :room_for_100 do factory :room_for_100 do
name 'Room for 100' name 'Room for 100'

View file

@ -3,7 +3,7 @@ FactoryGirl.define do
name 'Example Track' name 'Example Track'
description 'Lorem Ipsum dolsum' description 'Lorem Ipsum dolsum'
color '#ffffff' color '#ffffff'
conference program
end end
end end

View file

@ -37,22 +37,23 @@ feature 'Has correct abilities' do
expect(page).to have_link('Basics', href: "/admin/conference/#{conference1.short_title}/edit") expect(page).to have_link('Basics', href: "/admin/conference/#{conference1.short_title}/edit")
expect(page).to have_link('Contact', href: "/admin/conference/#{conference1.short_title}/contact/edit") expect(page).to have_link('Contact', href: "/admin/conference/#{conference1.short_title}/contact/edit")
expect(page).to have_link('Commercials', href: "/admin/conference/#{conference1.short_title}/commercials") expect(page).to have_link('Commercials', href: "/admin/conference/#{conference1.short_title}/commercials")
expect(page).to have_link('Events', href: "/admin/conference/#{conference1.short_title}/events") expect(page).to have_link('Events', href: "/admin/conference/#{conference1.short_title}/program/events")
expect(page).to have_link('Registrations', href: "/admin/conference/#{conference1.short_title}/registrations") expect(page).to have_link('Registrations', href: "/admin/conference/#{conference1.short_title}/registrations")
expect(page).to have_link('Schedule', href: "/admin/conference/#{conference1.short_title}/schedule") expect(page).to have_link('Schedule', href: "/admin/conference/#{conference1.short_title}/schedule")
expect(page).to have_link('Campaigns', href: "/admin/conference/#{conference1.short_title}/campaigns") expect(page).to have_link('Campaigns', href: "/admin/conference/#{conference1.short_title}/campaigns")
expect(page).to have_link('Goals', href: "/admin/conference/#{conference1.short_title}/targets") expect(page).to have_link('Goals', href: "/admin/conference/#{conference1.short_title}/targets")
expect(page).to have_link('Venue', href: "/admin/conference/#{conference1.short_title}/venue") expect(page).to have_link('Venue', href: "/admin/conference/#{conference1.short_title}/venue")
expect(page).to have_link('Rooms', href: "/admin/conference/#{conference1.short_title}/rooms") expect(page).to have_link('Rooms', href: "/admin/conference/#{conference1.short_title}/program/rooms")
expect(page).to have_link('Lodgings', href: "/admin/conference/#{conference1.short_title}/lodgings") expect(page).to have_link('Lodgings', href: "/admin/conference/#{conference1.short_title}/lodgings")
expect(page).to have_link('Sponsorship', href: "/admin/conference/#{conference1.short_title}/sponsorship_levels") expect(page).to have_link('Sponsorship', href: "/admin/conference/#{conference1.short_title}/sponsorship_levels")
expect(page).to have_link('Sponsors', href: "/admin/conference/#{conference1.short_title}/sponsors") expect(page).to have_link('Sponsors', href: "/admin/conference/#{conference1.short_title}/sponsors")
expect(page).to have_link('Tickets', href: "/admin/conference/#{conference1.short_title}/tickets") expect(page).to have_link('Tickets', href: "/admin/conference/#{conference1.short_title}/tickets")
expect(page).to have_link('E-Mails', href: "/admin/conference/#{conference1.short_title}/emails") expect(page).to have_link('E-Mails', href: "/admin/conference/#{conference1.short_title}/emails")
expect(page).to have_link('Call for Papers', href: "/admin/conference/#{conference1.short_title}/call_for_paper") expect(page).to have_link('Program', href: "/admin/conference/#{conference1.short_title}/program")
expect(page).to have_link('Tracks', href: "/admin/conference/#{conference1.short_title}/tracks") expect(page).to have_link('Call for Papers', href: "/admin/conference/#{conference1.short_title}/program/cfp")
expect(page).to have_link('Event Types', href: "/admin/conference/#{conference1.short_title}/event_types") expect(page).to have_link('Tracks', href: "/admin/conference/#{conference1.short_title}/program/tracks")
expect(page).to have_link('Difficulty Levels', href: "/admin/conference/#{conference1.short_title}/difficulty_levels") expect(page).to have_link('Event Types', href: "/admin/conference/#{conference1.short_title}/program/event_types")
expect(page).to have_link('Difficulty Levels', href: "/admin/conference/#{conference1.short_title}/program/difficulty_levels")
expect(page).to have_link('Questions', href: "/admin/conference/#{conference1.short_title}/questions") expect(page).to have_link('Questions', href: "/admin/conference/#{conference1.short_title}/questions")
expect(page).to have_link('Roles', href: "/admin/conference/#{conference1.short_title}/roles") expect(page).to have_link('Roles', href: "/admin/conference/#{conference1.short_title}/roles")
@ -65,8 +66,8 @@ feature 'Has correct abilities' do
visit admin_conference_registrations_path(conference1.short_title) visit admin_conference_registrations_path(conference1.short_title)
expect(current_path).to eq(admin_conference_registrations_path(conference1.short_title)) expect(current_path).to eq(admin_conference_registrations_path(conference1.short_title))
visit admin_conference_events_path(conference1.short_title) visit admin_conference_program_events_path(conference1.short_title)
expect(current_path).to eq(admin_conference_events_path(conference1.short_title)) expect(current_path).to eq(admin_conference_program_events_path(conference1.short_title))
visit admin_conference_schedule_path(conference1.short_title) visit admin_conference_schedule_path(conference1.short_title)
expect(current_path).to eq(admin_conference_schedule_path(conference1.short_title)) expect(current_path).to eq(admin_conference_schedule_path(conference1.short_title))
@ -93,8 +94,8 @@ feature 'Has correct abilities' do
visit admin_conference_emails_path(conference1.short_title) visit admin_conference_emails_path(conference1.short_title)
expect(current_path).to eq(admin_conference_emails_path(conference1.short_title)) expect(current_path).to eq(admin_conference_emails_path(conference1.short_title))
visit new_admin_conference_call_for_paper_path(conference1.short_title) visit new_admin_conference_program_cfp_path(conference1.short_title)
expect(current_path).to eq(new_admin_conference_call_for_paper_path(conference1.short_title)) expect(current_path).to eq(new_admin_conference_program_cfp_path(conference1.short_title))
visit admin_conference_questions_path(conference1.short_title) visit admin_conference_questions_path(conference1.short_title)
expect(current_path).to eq(admin_conference_questions_path(conference1.short_title)) expect(current_path).to eq(admin_conference_questions_path(conference1.short_title))
@ -113,22 +114,23 @@ feature 'Has correct abilities' do
expect(page).to have_text('Basics') expect(page).to have_text('Basics')
expect(page).to_not have_link('Contact', href: "/admin/conference/#{conference2.short_title}/contact/edit") expect(page).to_not have_link('Contact', href: "/admin/conference/#{conference2.short_title}/contact/edit")
expect(page).to have_link('Commercials', href: "/admin/conference/#{conference2.short_title}/commercials") expect(page).to have_link('Commercials', href: "/admin/conference/#{conference2.short_title}/commercials")
expect(page).to have_link('Events', href: "/admin/conference/#{conference2.short_title}/events") expect(page).to have_link('Events', href: "/admin/conference/#{conference2.short_title}/program/events")
expect(page).to_not have_link('Registrations', href: "/admin/conference/#{conference2.short_title}/registrations") expect(page).to_not have_link('Registrations', href: "/admin/conference/#{conference2.short_title}/registrations")
expect(page).to have_link('Schedule', href: "/admin/conference/#{conference2.short_title}/schedule") expect(page).to have_link('Schedule', href: "/admin/conference/#{conference2.short_title}/schedule")
expect(page).to_not have_link('Campaigns', href: "/admin/conference/#{conference2.short_title}/campaigns") expect(page).to_not have_link('Campaigns', href: "/admin/conference/#{conference2.short_title}/campaigns")
expect(page).to_not have_link('Goals', href: "/admin/conference/#{conference2.short_title}/targets") expect(page).to_not have_link('Goals', href: "/admin/conference/#{conference2.short_title}/targets")
expect(page).to have_link('Venue', href: "/admin/conference/#{conference2.short_title}/venue") expect(page).to have_link('Venue', href: "/admin/conference/#{conference2.short_title}/venue")
expect(page).to have_link('Rooms', href: "/admin/conference/#{conference2.short_title}/rooms") expect(page).to have_link('Rooms', href: "/admin/conference/#{conference2.short_title}/program/rooms")
expect(page).to_not have_link('Lodgings', href: "/admin/conference/#{conference2.short_title}/lodgings") expect(page).to_not have_link('Lodgings', href: "/admin/conference/#{conference2.short_title}/lodgings")
expect(page).to_not have_link('Sponsorship', href: "/admin/conference/#{conference2.short_title}/sponsorship_levels") expect(page).to_not have_link('Sponsorship', href: "/admin/conference/#{conference2.short_title}/sponsorship_levels")
expect(page).to_not have_link('Sponsors', href: "/admin/conference/#{conference2.short_title}/sponsors") expect(page).to_not have_link('Sponsors', href: "/admin/conference/#{conference2.short_title}/sponsors")
expect(page).to_not have_link('Supporter Levels', href: "/admin/conference/#{conference2.short_title}/supporter_levels") expect(page).to_not have_link('Supporter Levels', href: "/admin/conference/#{conference2.short_title}/supporter_levels")
expect(page).to have_link('E-Mails', href: "/admin/conference/#{conference2.short_title}/emails") expect(page).to have_link('E-Mails', href: "/admin/conference/#{conference2.short_title}/emails")
expect(page).to have_link('Call for Papers', href: "/admin/conference/#{conference2.short_title}/call_for_paper") expect(page).to have_link('Program', href: "/admin/conference/#{conference2.short_title}/program")
expect(page).to have_link('Tracks', href: "/admin/conference/#{conference2.short_title}/tracks") expect(page).to have_link('Call for Papers', href: "/admin/conference/#{conference2.short_title}/program/cfp")
expect(page).to have_link('Event Types', href: "/admin/conference/#{conference2.short_title}/event_types") expect(page).to have_link('Tracks', href: "/admin/conference/#{conference2.short_title}/program/tracks")
expect(page).to have_link('Difficulty Levels', href: "/admin/conference/#{conference2.short_title}/difficulty_levels") expect(page).to have_link('Event Types', href: "/admin/conference/#{conference2.short_title}/program/event_types")
expect(page).to have_link('Difficulty Levels', href: "/admin/conference/#{conference2.short_title}/program/difficulty_levels")
expect(page).to_not have_link('Questions', href: "/admin/conference/#{conference2.short_title}/questions") expect(page).to_not have_link('Questions', href: "/admin/conference/#{conference2.short_title}/questions")
expect(page).to_not have_link('Roles', href: "/admin/conference/#{conference2.short_title}/roles") expect(page).to_not have_link('Roles', href: "/admin/conference/#{conference2.short_title}/roles")
@ -141,8 +143,8 @@ feature 'Has correct abilities' do
visit admin_conference_registrations_path(conference2.short_title) visit admin_conference_registrations_path(conference2.short_title)
expect(current_path).to eq(admin_conference_registrations_path(conference2.short_title)) expect(current_path).to eq(admin_conference_registrations_path(conference2.short_title))
visit admin_conference_events_path(conference2.short_title) visit admin_conference_program_events_path(conference2.short_title)
expect(current_path).to eq(admin_conference_events_path(conference2.short_title)) expect(current_path).to eq(admin_conference_program_events_path(conference2.short_title))
visit admin_conference_schedule_path(conference2.short_title) visit admin_conference_schedule_path(conference2.short_title)
expect(current_path).to eq(admin_conference_schedule_path(conference2.short_title)) expect(current_path).to eq(admin_conference_schedule_path(conference2.short_title))
@ -165,8 +167,8 @@ feature 'Has correct abilities' do
visit admin_conference_emails_path(conference2.short_title) visit admin_conference_emails_path(conference2.short_title)
expect(current_path).to eq(admin_conference_emails_path(conference2.short_title)) expect(current_path).to eq(admin_conference_emails_path(conference2.short_title))
visit new_admin_conference_call_for_paper_path(conference2.short_title) visit new_admin_conference_program_cfp_path(conference2.short_title)
expect(current_path).to eq(new_admin_conference_call_for_paper_path(conference2.short_title)) expect(current_path).to eq(new_admin_conference_program_cfp_path(conference2.short_title))
visit admin_conference_questions_path(conference2.short_title) visit admin_conference_questions_path(conference2.short_title)
expect(current_path).to eq(root_path) expect(current_path).to eq(root_path)
@ -185,22 +187,23 @@ feature 'Has correct abilities' do
expect(page).to have_text('Basics') expect(page).to have_text('Basics')
expect(page).to_not have_link('Contact', href: "/admin/conference/#{conference3.short_title}/contact/edit") expect(page).to_not have_link('Contact', href: "/admin/conference/#{conference3.short_title}/contact/edit")
expect(page).to have_link('Commercials', href: "/admin/conference/#{conference3.short_title}/commercials") expect(page).to have_link('Commercials', href: "/admin/conference/#{conference3.short_title}/commercials")
expect(page).to_not have_link('Events', href: "/admin/conference/#{conference3.short_title}/events") expect(page).to_not have_link('Events', href: "/admin/conference/#{conference3.short_title}/program/events")
expect(page).to have_link('Registrations', href: "/admin/conference/#{conference3.short_title}/registrations") expect(page).to have_link('Registrations', href: "/admin/conference/#{conference3.short_title}/registrations")
expect(page).to_not have_link('Schedule', href: "/admin/conference/#{conference3.short_title}/schedule") expect(page).to_not have_link('Schedule', href: "/admin/conference/#{conference3.short_title}/schedule")
expect(page).to_not have_link('Campaigns', href: "/admin/conference/#{conference3.short_title}/campaigns") expect(page).to_not have_link('Campaigns', href: "/admin/conference/#{conference3.short_title}/campaigns")
expect(page).to_not have_link('Targets', href: "/admin/conference/#{conference3.short_title}/targets") expect(page).to_not have_link('Targets', href: "/admin/conference/#{conference3.short_title}/targets")
expect(page).to_not have_link('Venue', href: "/admin/conference/#{conference3.short_title}/venue") expect(page).to_not have_link('Venue', href: "/admin/conference/#{conference3.short_title}/venue")
expect(page).to_not have_link('Rooms', href: "/admin/conference/#{conference3.short_title}/rooms") expect(page).to_not have_link('Rooms', href: "/admin/conference/#{conference3.short_title}/program/rooms")
expect(page).to_not have_link('Lodgings', href: "/admin/conference/#{conference3.short_title}/lodgings") expect(page).to_not have_link('Lodgings', href: "/admin/conference/#{conference3.short_title}/lodgings")
expect(page).to_not have_link('Sponsorship', href: "/admin/conference/#{conference3.short_title}/sponsorship_levels") expect(page).to_not have_link('Sponsorship', href: "/admin/conference/#{conference3.short_title}/sponsorship_levels")
expect(page).to_not have_link('Sponsors', href: "/admin/conference/#{conference3.short_title}/sponsors") expect(page).to_not have_link('Sponsors', href: "/admin/conference/#{conference3.short_title}/sponsors")
expect(page).to_not have_link('Supporter Levels', href: "/admin/conference/#{conference3.short_title}/supporter_levels") expect(page).to_not have_link('Supporter Levels', href: "/admin/conference/#{conference3.short_title}/supporter_levels")
expect(page).to_not have_link('E-Mails', href: "/admin/conference/#{conference3.short_title}/emails") expect(page).to_not have_link('E-Mails', href: "/admin/conference/#{conference3.short_title}/emails")
expect(page).to_not have_link('Call for papers', href: "/admin/conference/#{conference3.short_title}/call_for_paper") expect(page).to_not have_link('Program', href: "/admin/conference/#{conference3.short_title}/program")
expect(page).to_not have_link('Tracks', href: "/admin/conference/#{conference3.short_title}/tracks") expect(page).to_not have_link('Call for papers', href: "/admin/conference/#{conference3.short_title}/program/cfp")
expect(page).to_not have_link('Event types', href: "/admin/conference/#{conference3.short_title}/event_types") expect(page).to_not have_link('Tracks', href: "/admin/conference/#{conference3.short_title}/program/tracks")
expect(page).to_not have_link('Difficulty levels', href: "/admin/conference/#{conference3.short_title}/difficulty_levels") expect(page).to_not have_link('Event types', href: "/admin/conference/#{conference3.short_title}/program/event_types")
expect(page).to_not have_link('Difficulty levels', href: "/admin/conference/#{conference3.short_title}/program/difficulty_levels")
expect(page).to have_link('Questions', href: "/admin/conference/#{conference3.short_title}/questions") expect(page).to have_link('Questions', href: "/admin/conference/#{conference3.short_title}/questions")
expect(page).to_not have_link('Roles', href: "/admin/conference/#{conference3.short_title}/roles") expect(page).to_not have_link('Roles', href: "/admin/conference/#{conference3.short_title}/roles")
@ -213,7 +216,7 @@ feature 'Has correct abilities' do
visit admin_conference_registrations_path(conference3.short_title) visit admin_conference_registrations_path(conference3.short_title)
expect(current_path).to eq(admin_conference_registrations_path(conference3.short_title)) expect(current_path).to eq(admin_conference_registrations_path(conference3.short_title))
visit admin_conference_events_path(conference3.short_title) visit admin_conference_program_events_path(conference3.short_title)
expect(current_path).to eq(root_path) expect(current_path).to eq(root_path)
visit admin_conference_schedule_path(conference3.short_title) visit admin_conference_schedule_path(conference3.short_title)
@ -237,7 +240,7 @@ feature 'Has correct abilities' do
visit admin_conference_emails_path(conference3.short_title) visit admin_conference_emails_path(conference3.short_title)
expect(current_path).to eq(root_path) expect(current_path).to eq(root_path)
visit new_admin_conference_call_for_paper_path(conference3.short_title) visit new_admin_conference_program_cfp_path(conference3.short_title)
expect(current_path).to eq(root_path) expect(current_path).to eq(root_path)
visit admin_conference_questions_path(conference3.short_title) visit admin_conference_questions_path(conference3.short_title)

View file

@ -8,13 +8,13 @@ feature Conference do
shared_examples 'add and update cfp' do shared_examples 'add and update cfp' do
scenario 'adds a new cfp', feature: true, js: true do scenario 'adds a new cfp', feature: true, js: true do
expected_count = CallForPaper.count + 1 expected_count = Cfp.count + 1
sign_in organizer sign_in organizer
visit new_admin_conference_call_for_paper_path(conference.short_title) visit new_admin_conference_program_cfp_path(conference.short_title)
click_button 'Create Call for paper' click_button 'Create Cfp'
expect(flash). expect(flash).
to eq('Creating the call for papers failed. ' + to eq('Creating the call for papers failed. ' +
@ -26,32 +26,29 @@ feature Conference do
page.execute_script( page.execute_script(
"$('#conference-end-datepicker').val('#{(today + 6).strftime('%d/%m/%Y')}')") "$('#conference-end-datepicker').val('#{(today + 6).strftime('%d/%m/%Y')}')")
fill_in 'call_for_paper_rating', with: '4' click_button 'Create Cfp'
click_button 'Create Call for paper'
# Validations # Validations
expect(flash). expect(flash).
to eq('Call for papers successfully created.') to eq('Call for papers successfully created.')
expect(find('#start_date').text).to eq(today.strftime('%A, %B %-d. %Y')) expect(find('#start_date').text).to eq(today.strftime('%A, %B %-d. %Y'))
expect(find('#end_date').text).to eq((today + 6).strftime('%A, %B %-d. %Y')) expect(find('#end_date').text).to eq((today + 6).strftime('%A, %B %-d. %Y'))
expect(find('#rating').text).to eq('4')
expect(CallForPaper.count).to eq(expected_count) expect(Cfp.count).to eq(expected_count)
end end
scenario 'update cfp', feature: true, js: true do scenario 'update cfp', feature: true, js: true do
conference.call_for_paper = create(:call_for_paper) conference.program.cfp = create(:cfp)
expected_count = CallForPaper.count expected_count = Cfp.count
sign_in organizer sign_in organizer
visit admin_conference_call_for_paper_path(conference.short_title) visit admin_conference_program_cfp_path(conference.short_title)
click_link 'Edit' click_link 'Edit'
# Validate update with empty start date will not saved # Validate update with empty start date will not saved
page.execute_script( page.execute_script(
"$('#conference-start-datepicker').val('')") "$('#conference-start-datepicker').val('')")
click_button 'Update Call for paper' click_button 'Update Cfp'
expect(flash). expect(flash).
to eq('Updating call for papers failed. ' + to eq('Updating call for papers failed. ' +
"Start date can't be blank.") "Start date can't be blank.")
@ -63,16 +60,14 @@ feature Conference do
page.execute_script( page.execute_script(
"$('#conference-end-datepicker').val('#{(today + 14).strftime('%d/%m/%Y')}')") "$('#conference-end-datepicker').val('#{(today + 14).strftime('%d/%m/%Y')}')")
fill_in 'call_for_paper_rating', with: '0' click_button 'Update Cfp'
click_button 'Update Call for paper'
# Validations # Validations
expect(flash). expect(flash).
to eq('Call for papers successfully updated.') to eq('Call for papers successfully updated.')
expect(find('#start_date').text).to eq(today.strftime('%A, %B %-d. %Y')) expect(find('#start_date').text).to eq(today.strftime('%A, %B %-d. %Y'))
expect(find('#end_date').text).to eq((today + 14).strftime('%A, %B %-d. %Y')) expect(find('#end_date').text).to eq((today + 14).strftime('%A, %B %-d. %Y'))
expect(find('#rating').text).to eq('0') expect(Cfp.count).to eq(expected_count)
expect(CallForPaper.count).to eq(expected_count)
end end
end end

View file

@ -42,7 +42,7 @@ feature Commercial do
end end
context 'in public area' do context 'in public area' do
let!(:event) { create(:event, conference: conference, title: 'Example Proposal') } let!(:event) { create(:event, program: conference.program, title: 'Example Proposal') }
before(:each) do before(:each) do
event.event_users = [create(:event_user, event.event_users = [create(:event_user,
@ -58,8 +58,8 @@ feature Commercial do
sign_out sign_out
end end
scenario 'adds a commercial of an event', feature: true, js: true do scenario 'adds a valid commercial of an event', feature: true, js: true do
visit edit_conference_proposal_path(conference.short_title, event.id) visit edit_conference_program_proposal_path(conference.short_title, event.id)
click_link 'Commercials' click_link 'Commercials'
fill_in 'commercial_url', with: 'https://www.youtube.com/watch?v=M9bq_alk-sw' fill_in 'commercial_url', with: 'https://www.youtube.com/watch?v=M9bq_alk-sw'
@ -75,7 +75,7 @@ feature Commercial do
commercial = create(:commercial, commercial = create(:commercial,
commercialable_id: event.id, commercialable_id: event.id,
commercialable_type: 'Event') commercialable_type: 'Event')
visit edit_conference_proposal_path(conference.short_title, event.id) visit edit_conference_program_proposal_path(conference.short_title, event.id)
click_link 'Commercials' click_link 'Commercials'
fill_in "commercial_url_#{commercial.id}", with: 'https://www.youtube.com/watch?v=M9bq_alk-sw' fill_in "commercial_url_#{commercial.id}", with: 'https://www.youtube.com/watch?v=M9bq_alk-sw'
click_button 'Update' click_button 'Update'
@ -89,7 +89,7 @@ feature Commercial do
create(:commercial, create(:commercial,
commercialable_id: event.id, commercialable_id: event.id,
commercialable_type: 'Event') commercialable_type: 'Event')
visit edit_conference_proposal_path(conference.short_title, event.id) visit edit_conference_program_proposal_path(conference.short_title, event.id)
click_link 'Commercials' click_link 'Commercials'
click_link 'Delete' click_link 'Delete'
page.driver.network_traffic page.driver.network_traffic

View file

@ -9,7 +9,7 @@ feature DifficultyLevel do
scenario 'adds difficulty level', feature: true, js: true do scenario 'adds difficulty level', feature: true, js: true do
sign_in organizer sign_in organizer
visit admin_conference_difficulty_levels_path( visit admin_conference_program_difficulty_levels_path(
conference_id: conference.short_title) conference_id: conference.short_title)
# Add difficulty level # Add difficulty level
@ -32,9 +32,9 @@ feature DifficultyLevel do
scenario 'updates difficulty level', feature: true, js: true do scenario 'updates difficulty level', feature: true, js: true do
conference.difficulty_levels << create(:difficulty_level) conference.program.difficulty_levels << create(:difficulty_level)
sign_in organizer sign_in organizer
visit admin_conference_difficulty_levels_path( visit admin_conference_program_difficulty_levels_path(
conference_id: conference.short_title) conference_id: conference.short_title)
# Remove difficulty level # Remove difficulty level

View file

@ -9,7 +9,7 @@ feature EventType do
scenario 'adds and updates event type', feature: true, js: true do scenario 'adds and updates event type', feature: true, js: true do
sign_in organizer sign_in organizer
visit admin_conference_event_types_path( visit admin_conference_program_event_types_path(
conference_id: conference.short_title) conference_id: conference.short_title)
within('table#event_types') do within('table#event_types') do

View file

@ -0,0 +1,30 @@
require 'spec_helper'
feature Program do
let!(:conference) { create(:conference) }
let!(:program) { conference.program }
let!(:organizer_role) { create(:organizer_role, resource: conference) }
let!(:organizer) { create(:user, role_ids: [organizer_role.id]) }
describe 'edit program' do
before :each do
sign_in organizer
end
scenario 'changes rating', feature: true, js: true do
visit admin_conference_program_path(conference.short_title)
click_link 'Edit'
fill_in 'program_rating', with: '4'
click_button 'Update Program'
# Validations
expect(flash).
to eq('The program was successfully updated.')
expect(find('#rating').text).to eq('4')
end
end
end

Some files were not shown because too many files have changed in this diff Show more