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 }]}}
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

View file

@ -1,6 +1,7 @@
module Admin
class ConferenceController < Admin::BaseController
load_and_authorize_resource :conference, find_by: :short_title
load_resource :program, through: :conference, singleton: true, except: :index
load_resource :user, only: [:remove_user]
def index
@ -94,14 +95,17 @@ module Admin
end
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
@total_reg = @conference.registrations.count
@new_reg = @conference.registrations.where('created_at > ?', current_user.last_sign_in_at).count
@total_submissions = @conference.events.count
@new_submissions = @conference.events.
@total_submissions = @program.events.count
@new_submissions = @program.events.
where('created_at > ?', current_user.last_sign_in_at).count
@program_length = @conference.current_program_hours
@ -141,7 +145,7 @@ module Admin
@tracks_distribution_confirmed = @conference.tracks_distribution(:confirmed)
# 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)
@top_submitter = @conference.get_top_submitter

View file

@ -1,23 +1,24 @@
module Admin
class DifficultyLevelsController < Admin::BaseController
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
authorize! :index, DifficultyLevel.new(conference_id: @conference.id)
# authorize! :index, DifficultyLevel.new(program_id: @program.id)
end
def edit; end
def new
@difficulty_level = @conference.difficulty_levels.new
@difficulty_level = @conference.program.difficulty_levels.new
end
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
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
flash[:error] = "Creating difficulty level failed: #{@difficulty_level.errors.full_messages.join('. ')}."
render :new
@ -27,7 +28,7 @@ module Admin
def update
if @difficulty_level.update_attributes(difficulty_level_params)
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
flash[:error] = "Update difficulty level failed: #{@difficulty_level.errors.full_messages.join('. ')}."
render :edit
@ -37,11 +38,11 @@ module Admin
def destroy
if @difficulty_level.destroy
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
flash[:error] = 'Deleting difficulty level type failed! ' \
"#{@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

View file

@ -1,23 +1,22 @@
module Admin
class EventTypesController < Admin::BaseController
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
authorize! :index, EventType.new(conference_id: @conference.id)
end
def index; end
def edit; end
def new
@event_type = @conference.event_types.new
@event_type = @conference.program.event_types.new
end
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
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
flash[:error] = "Creating event type failed: #{@event_type.errors.full_messages.join('. ')}."
render :new
@ -27,7 +26,7 @@ module Admin
def update
if @event_type.update_attributes(event_type_params)
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
flash[:error] = "Update event type failed: #{@event_type.errors.full_messages.join('. ')}."
render :edit
@ -37,11 +36,11 @@ module Admin
def destroy
if @event_type.destroy
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
flash[:error] = 'Destroying event type failed! ' \
"#{@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

View file

@ -1,7 +1,8 @@
module Admin
class EventsController < Admin::BaseController
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]
@ -14,13 +15,11 @@ module Admin
end
def index
authorize! :index, @conference.events.build
@conference = Conference.find_by(short_title: params[:conference_id])
@events = @conference.events
@tracks = @conference.tracks
@difficulty_levels = @conference.difficulty_levels
@events = @program.events
@tracks = @program.tracks
@difficulty_levels = @program.difficulty_levels
@machine_states = @events.state_machine.states.map
@event_types = @conference.event_types
@event_types = @program.event_types
@mystates = []
@mytypes = []
@ -72,26 +71,26 @@ module Admin
respond_to do |format|
format.html
# 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
def show
@tracks = @conference.tracks
@event_types = @conference.event_types
@tracks = @program.tracks
@event_types = @program.event_types
@comments = @event.root_comments
@comment_count = @event.comment_threads.count
@ratings = @event.votes.includes(:user)
@difficulty_levels = @conference.difficulty_levels
@difficulty_levels = @program.difficulty_levels
end
def edit
@event_types = @conference.event_types
@event_types = @program.event_types
@tracks = Track.all
@comments = @event.root_comments
@comment_count = @event.comment_threads.count
@user = @event.submitter
@url = admin_conference_event_path(@conference.short_title, @event)
@url = admin_conference_program_event_path(@conference.short_title, @event)
end
def comment
@ -101,7 +100,7 @@ module Admin
comment.move_to_child_of(params[:parent])
end
redirect_to admin_conference_event_path(conference_id: @conference.short_title)
redirect_to admin_conference_program_event_path(@conference.short_title, @event)
end
def update
@ -111,10 +110,10 @@ module Admin
render js: 'index'
else
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
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
render :edit
end
@ -123,8 +122,8 @@ module Admin
def create; end
def accept
send_mail = @event.conference.email_settings.send_on_accepted
subject = @event.conference.email_settings.accepted_subject.blank?
send_mail = @event.program.conference.email_settings.send_on_accepted
subject = @event.program.conference.email_settings.accepted_subject.blank?
update_state(:accept, 'Event accepted!', true, subject, send_mail)
end
@ -137,8 +136,8 @@ module Admin
end
def reject
send_mail = @event.conference.email_settings.send_on_rejected
subject = @event.conference.email_settings.rejected_subject.blank?
send_mail = @event.program.conference.email_settings.send_on_rejected
subject = @event.program.conference.email_settings.rejected_subject.blank?
update_state(:reject, 'Event rejected!', true, subject, send_mail)
end
@ -159,7 +158,7 @@ module Admin
end
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
end
end
@ -181,9 +180,9 @@ module Admin
end
def get_event
@event = @conference.events.find_by_id(params[:id])
@event = @conference.program.events.find(params[:id])
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
end
@event
@ -194,10 +193,10 @@ module Admin
if alert.blank?
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
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

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
class RoomsController < Admin::BaseController
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
authorize! :index, Room.new(conference_id: @conference.id)
end
def index; end
def edit; end
def new
@room = @conference.rooms.new
@room = @program.rooms.new
end
def create
@room = @conference.rooms.new(room_params)
@room = @program.rooms.new(room_params)
if @room.save
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
flash[:error] = "Creating Room failed: #{@room.errors.full_messages.join('. ')}."
render :new
@ -27,7 +26,7 @@ module Admin
def update
if @room.update_attributes(room_params)
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
flash[:error] = "Update Room failed: #{@room.errors.full_messages.join('. ')}."
render :edit
@ -37,10 +36,10 @@ module Admin
def destroy
if @room.destroy
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
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

View file

@ -3,23 +3,24 @@ module Admin
# 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
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]
layout 'schedule'
def show
authorize! :update, @conference.events.new
authorize! :update, @program.events.new
if @conference.nil?
redirect_to admin_conference_index_path
return
end
@dates = @conference.start_date..@conference.end_date
@rooms = @conference.rooms
@rooms = @program.rooms
end
def update
authorize! :update, @conference.events.new
event = Event.where(guid: event_params).first
authorize! :update, @program.events.new
event = Event.where(guid: params[:event]).first
error_message = nil
if event.nil?
error_message = "Could not find event GUID: #{params[:event]}"

View file

@ -1,7 +1,8 @@
module Admin
class TracksController < Admin::BaseController
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
@ -13,14 +14,14 @@ module Admin
end
def new
@track = @conference.tracks.new
@track = @program.tracks.new
end
def create
@track = @conference.tracks.new(track_params)
@track = @program.tracks.new(track_params)
if @track.save
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
flash[:error] = "Creating Track failed: #{@track.errors.full_messages.join('. ')}."
render :new
@ -32,7 +33,7 @@ module Admin
def update
if @track.update_attributes(track_params)
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
flash[:error] = "Track update failed: #{@track.errors.full_messages.join('. ')}."
render :edit
@ -42,10 +43,10 @@ module Admin
def destroy
if @track.destroy
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
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

View file

@ -8,7 +8,7 @@ class CommercialsController < ApplicationController
authorize! :create, @commercial
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.'
else
flash[:error] = "An error prohibited this Commercial from being saved: #{@commercial.errors.full_messages.join('. ')}."
@ -18,7 +18,7 @@ class CommercialsController < ApplicationController
def update
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.'
else
flash[:error] = "An error prohibited this Commercial from being saved: #{@commercial.errors.full_messages.join('. ')}."
@ -28,7 +28,7 @@ class CommercialsController < ApplicationController
def 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.'
end
@ -44,7 +44,7 @@ class CommercialsController < ApplicationController
private
def set_event
@event = @conference.events.find(params[:proposal_id])
@event = @conference.program.events.find(params[:proposal_id])
end
def commercial_params

View file

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

View file

@ -1,7 +1,8 @@
class ProposalController < ApplicationController
before_filter :authenticate_user!, except: [:show, :new, :create]
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
@events = current_user.proposals(@conference)
@ -14,16 +15,16 @@ class ProposalController < ApplicationController
def new
@user = User.new
@url = conference_proposal_index_path(@conference.short_title)
@url = conference_program_proposal_index_path(@conference.short_title)
end
def edit
authorize! :edit, @event
@url = conference_proposal_path(@conference.short_title, params[:id])
@url = conference_program_proposal_path(@conference.short_title, params[:id])
end
def create
@url = conference_proposal_index_path(@conference.short_title)
@url = conference_program_proposal_index_path(@conference.short_title)
unless current_user
@user = User.new(user_params)
@ -38,8 +39,8 @@ class ProposalController < ApplicationController
params[:event].delete :user
@event = Event.new(event_params)
@event.conference = @conference
@event = Event.new(params[:event])
@event.program = @program
@event.event_users.new(user: current_user,
event_role: 'submitter')
@ -55,12 +56,12 @@ class ProposalController < ApplicationController
ahoy.track 'Event submission', title: 'New submission'
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
def update
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)
flash[:error] = "Could not update proposal: #{@event.errors.full_messages.join(', ')}"
@ -68,13 +69,13 @@ class ProposalController < ApplicationController
return
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.')
end
def destroy
authorize! :destroy, @event
@url = conference_proposal_path(@conference.short_title, params[:id])
@url = conference_program_proposal_path(@conference.short_title, params[:id])
begin
@event.withdraw
@ -84,13 +85,13 @@ class ProposalController < ApplicationController
end
@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.')
end
def confirm
authorize! :update, @event
@url = conference_proposal_path(@conference.short_title, params[:id])
@url = conference_program_proposal_path(@conference.short_title, params[:id])
begin
@event.confirm!
@ -106,7 +107,7 @@ class ProposalController < ApplicationController
end
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.')
else
redirect_to(new_conference_conference_registrations_path(conference_id: @conference.short_title),
@ -116,12 +117,12 @@ class ProposalController < ApplicationController
def restart
authorize! :update, @event
@url = conference_proposal_path(@conference.short_title, params[:id])
@url = conference_program_proposal_path(@conference.short_title, params[:id])
begin
@event.restart
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.")
return
end
@ -132,7 +133,7 @@ class ProposalController < ApplicationController
return
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.")
end

View file

@ -159,7 +159,7 @@ module ApplicationHelper
end
def pre_registered(event)
@conference.events.joins(:registrations).where('events.id = ?', event.id)
@conference.program.events.joins(:registrations).where('events.id = ?', event.id)
end
def add_association_link(association_name, form_builder, div_class, html_options = {})
@ -184,7 +184,7 @@ module ApplicationHelper
end
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]
last = all[-1]
ets = ''
@ -198,7 +198,21 @@ module ApplicationHelper
end
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]
last = all[-1]
ts = ''

View file

@ -66,17 +66,17 @@ class Mailbot < ActionMailer::Base
User.joins(:subscriptions).merge(conference.subscriptions) do |user|
build_email(conference,
user.email,
conference.email_settings.call_for_papers_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.program_schedule_public_subject,
conference.email_settings.generate_email_on_conf_updates(conference, user, conference.email_settings.program_schedule_public_body))
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|
build_email(conference,
user.email,
conference.email_settings.call_for_papers_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.cfp_dates_updated_subject,
conference.email_settings.generate_email_on_conf_updates(conference, user, conference.email_settings.cfp_dates_updated_body))
end
end

View file

@ -39,7 +39,7 @@ class Ability
end
# Can view the schedule
can [:schedule], Conference do |conference|
conference.call_for_paper && conference.call_for_paper.schedule_public
conference.program.cfp && conference.program.schedule_public
end
can :show, Event do |event|
@ -53,9 +53,13 @@ class Ability
can [:show, :create], Registration do |registration|
registration.new_record?
end
can [:show, :create], Event do |event|
can :show, Event do |event|
event.new_record?
end
can [:new, :create], Event do |event|
event.program.cfp_open? && event.new_record?
end
end
end
@ -77,7 +81,7 @@ class Ability
event.users.include?(user)
end
# 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, Commercial, commercialable_type: 'Event', commercialable_id: user.events.pluck(:id)
@ -100,6 +104,8 @@ class Ability
cannot [:edit, :update, :destroy], Question, global: true
# for admins
can :manage, :all if user.is_admin
cannot :destroy, Program
end
def signed_in_with_organizer_role(user)
@ -125,21 +131,22 @@ class Ability
end
can :manage, Vposition, 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, Event, conference_id: conf_ids_for_organizer
can :manage, EventType, conference_id: conf_ids_for_organizer
can :manage, Track, conference_id: conf_ids_for_organizer
can :manage, DifficultyLevel, conference_id: conf_ids_for_organizer
can :manage, Program, conference_id: conf_ids_for_organizer
can :manage, Cfp, program: { conference_id: conf_ids_for_organizer}
can :manage, Event, program: { conference_id: conf_ids_for_organizer}
can :manage, EventType, program: { 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',
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, 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, SponsorshipLevel, conference_id: conf_ids_for_organizer
can :manage, Ticket, conference_id: conf_ids_for_organizer
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
def signed_in_with_cfp_role(user)
@ -148,18 +155,19 @@ class Ability
conf_ids_for_cfp =
Conference.with_role(:cfp, user).pluck(:id) if user.has_role? :cfp, :any
can :manage, Event, conference_id: conf_ids_for_cfp
can :manage, EventType, conference_id: conf_ids_for_cfp
can :manage, Track, conference_id: conf_ids_for_cfp
can :manage, DifficultyLevel, conference_id: conf_ids_for_cfp
can :manage, Event, program: { conference_id: conf_ids_for_cfp }
can :manage, EventType, program: { conference_id: conf_ids_for_cfp }
can :manage, Track, program: { 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, Room, conference_id: conf_ids_for_cfp
can :show, Venue, conference_id: conf_ids_for_cfp
can :manage, CallForPaper, conference_id: conf_ids_for_cfp
can :manage, Room, program: { conference_id: conf_ids_for_cfp }
can :index, Venue, 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',
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',
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
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 :registration_period, 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_many :social_events, dependent: :destroy
has_many :ticket_purchases, dependent: :destroy
has_many :supporters, through: :ticket_purchases, source: :user
has_many :tickets, 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 :registrations, dependent: :destroy
has_many :participants, through: :registrations, source: :user
@ -63,16 +37,12 @@ class Conference < ActiveRecord::Base
has_many :commercials, as: :commercialable, 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 :venue
accepts_nested_attributes_for :dietary_choices, allow_destroy: true
accepts_nested_attributes_for :tickets, allow_destroy: true
accepts_nested_attributes_for :sponsorship_levels, 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 :questions, 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
validate :valid_date_range?
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 :create_email_settings
def date_range_string
startstr = 'Unknown - '
@ -158,18 +126,6 @@ class Conference < ActiveRecord::Base
registration_period.end_date.present?
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.
#
@ -178,10 +134,10 @@ class Conference < ActiveRecord::Base
def get_submissions_per_week
result = []
if call_for_paper && events
submissions = events.group(:week).count
start_week = call_for_paper.start_week
weeks = call_for_paper.weeks
if program && program.cfp && program.events
submissions = program.events.group(:week).count
start_week = program.cfp.start_week
weeks = program.cfp.weeks
result = calculate_items_per_week(start_week, weeks, submissions)
end
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.
def get_submissions_data
result = {}
if call_for_paper && events
if program && program.cfp && program.events
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
weeks = weeks(start_week, end_week)
@ -260,8 +216,8 @@ class Conference < ActiveRecord::Base
# ====Returns
# * +Integer+ -> weeks
def cfp_weeks
if call_for_paper
call_for_paper.weeks
if program
program.cfp.weeks
else
0
end
@ -344,7 +300,7 @@ class Conference < ActiveRecord::Base
# * +hash+ -> user: submissions
def get_top_submitter(limit = 5)
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)
counter = submitter.order('count_all desc').count
Conference.calculate_user_submission_hash(submitter, counter)
@ -366,7 +322,7 @@ class Conference < ActiveRecord::Base
# ====Returns
# * +hash+ -> hash
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
##
@ -391,7 +347,7 @@ class Conference < ActiveRecord::Base
# ====Returns
# * +hash+ -> Fixnum 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
calculate_program_minutes(events_grouped, events_counted)
end
@ -411,7 +367,7 @@ class Conference < ActiveRecord::Base
# ====Returns
# * +hash+ -> Fixnum minutes
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
calculate_program_minutes(events_grouped, events_counted)
end
@ -450,9 +406,9 @@ class Conference < ActiveRecord::Base
# * +hash+ -> track => {color, value}
def tracks_distribution(state = nil)
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
tracks_grouped = events.select(:track_id).group(:track_id)
tracks_grouped = program.events.select(:track_id).group(:track_id)
end
tracks_counted = tracks_grouped.count
@ -539,7 +495,7 @@ class Conference < ActiveRecord::Base
Conference.where('end_date > ?', Date.today).each do |conference|
result = {}
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
end
@ -584,6 +540,7 @@ class Conference < ActiveRecord::Base
after_create do
self.create_contact
self.create_program
end
##
@ -631,10 +588,10 @@ class Conference < ActiveRecord::Base
# Actual week
this_week = Date.today.end_of_week.strftime('%W').to_i
result['Confirmed'][this_week] = events.where('state = ?', :confirmed).count
result['Unconfirmed'][this_week] = events.where('state = ?', :unconfirmed).count
result['Submitted'] = events.select(:week).group(:week).count
result['Submitted'][this_week] = events.where(week: this_week).count
result['Confirmed'][this_week] = program.events.where('state = ?', :confirmed).count
result['Unconfirmed'][this_week] = program.events.where('state = ?', :unconfirmed).count
result['Submitted'] = program.events.select(:week).group(:week).count
result['Submitted'][this_week] = program.events.where(week: this_week).count
result
end
@ -720,7 +677,7 @@ class Conference < ActiveRecord::Base
# * +True+ -> One difficulty level or more
# * +False+ -> No diffculty level
def difficulty_levels_set?
difficulty_levels.count > 0
program.difficulty_levels.count > 0
end
##
@ -730,7 +687,7 @@ class Conference < ActiveRecord::Base
# * +True+ -> One difficulty level or more
# * +False+ -> No diffculty level
def event_types_set?
event_types.count > 0
program.event_types.count > 0
end
##
@ -740,7 +697,7 @@ class Conference < ActiveRecord::Base
# * +True+ -> One track or more
# * +False+ -> No track
def tracks_set?
tracks.count > 0
program.tracks.count > 0
end
##
@ -750,7 +707,7 @@ class Conference < ActiveRecord::Base
# * +True+ -> One room or more
# * +False+ -> No room
def rooms_set?
rooms.count > 0
program.rooms.count > 0
end
# Checks if the conference has a venue object.
@ -769,7 +726,7 @@ class Conference < ActiveRecord::Base
# * +True+ -> If conference has a cfp object.
# * +False+ -> If conference has no cfp object.
def cfp_set?
!!call_for_paper
!!program.cfp
end
##
@ -788,9 +745,9 @@ class Conference < ActiveRecord::Base
# * +hash+ -> object_type => {color, value}
def calculate_event_distribution(group_by_id, association_symbol, state = nil)
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
grouped = events.select(group_by_id).group(group_by_id)
grouped = program.events.select(group_by_id).group(group_by_id)
end
counted = grouped.count
@ -910,35 +867,6 @@ class Conference < ActiveRecord::Base
result
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.
#

View file

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

View file

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

View file

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

View file

@ -1,5 +1,5 @@
class EventType < ActiveRecord::Base
belongs_to :conference
belongs_to :program
has_many :events, dependent: :restrict_with_error
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
belongs_to :conference
belongs_to :program
has_many :events, dependent: :nullify
before_create :generate_guid

View file

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

View file

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

View file

@ -177,7 +177,7 @@ class User < ActiveRecord::Base
end
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
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
%p.text-muted
Call for people to submit events to your conference
- if @call_for_paper
- if @cfp
.row
.col-md-8
%dl.dl-horizontal
%dt
Start Date:
%dd#start_date
= @call_for_paper.start_date.strftime('%A, %B %-d. %Y')
= @cfp.start_date.strftime('%A, %B %-d. %Y')
%dt
End Date:
%dd#end_date
= @call_for_paper.end_date.strftime('%A, %B %-d. %Y')
= @cfp.end_date.strftime('%A, %B %-d. %Y')
%dt
Days Left:
%dd
= pluralize(@call_for_paper.remaining_days, 'day')
= pluralize(@cfp.remaining_days, 'day')
%dt
Event types:
%dd
@ -31,28 +31,28 @@
%dt
Public Schedule
%dd#schedule_public
- if @call_for_paper.schedule_public
- if @program.schedule_public
Yes
- else
No
%dt
Schedule changeable?
%dd#schedule_changes
- if @call_for_paper.schedule_changes
- if @program.schedule_fluid
Yes
- else
No
%dt
Rating Levels
%dd#rating
= @call_for_paper.rating
= @program.rating
.row
.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
= 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
-else
.row
.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
- events.each do |event, comments|
.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
- comments.each do |comment|
%h5.strong Posted by: #{comment.user.name} | Created at: #{comment.created_at}

View file

@ -5,7 +5,7 @@
.panel-body
- events.each do |event, comments|
.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
- comments.each do |comment|
%h5.strong Created at: #{comment.created_at}

View file

@ -5,7 +5,7 @@
.panel-body
- events.each do |event, comments|
.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
- comments.each do |comment|
%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)
- else
%td Unknown Submitter
%td= link_to event.title, admin_conference_event_path(event.conference.short_title, event)
%td= link_to event.conference.title, admin_conference_path(event.conference.short_title)
%td= link_to event.title, admin_conference_program_event_path(event.program.conference.short_title, event)
%td= link_to event.program.conference.title, admin_conference_path(event.program.conference.short_title)
%td
.span{'class'=>label_for(event.state)} #{event.state.humanize}
- else

View file

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

View file

@ -8,7 +8,7 @@
= @difficulty_level.title
.row
.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 :description, :input_html => {:rows => 3, :class => "span6"}
= f.input :color, :input_html => {:size => 6, :type => "color"}

View file

@ -3,7 +3,7 @@
.page-header
%h1 Difficulty Levels
%p.text-muted
Classify your conference events by difficulty
Classify your conference.program.events by difficulty
.row
.col-md-12
%table.table.table-hover#difficulty_levels
@ -13,7 +13,7 @@
%th Color
%th Actions
%tbody
- @conference.difficulty_levels.each do |difficulty_level|
- @conference.program.difficulty_levels.each do |difficulty_level|
%tr
%td
= difficulty_level.title
@ -24,11 +24,11 @@
= difficulty_level.color
%td
.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'
= 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',
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
.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
%td {venue_address}
%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
%td {cfp_start_date}
%td The call for papers start date
%tr
%td {cfp_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 The link to complete schedule of the conference
- 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
= render partial: 'help', locals: {id: 'updated_venue_help', show_event_variables: false}
#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 :call_for_papers_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 :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 :program_schedule_public_subject, hint: "This subject will used whenever dates are updated or when the schedule is made public"
= 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",
"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
= 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 :call_for_papers_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 :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 :cfp_dates_updated_subject, hint: "This subject will used whenever dates are updated or when the schedule is made public"
= 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",
"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
= render partial: 'help', locals: {id: 'updated_cfp_help', show_event_variables: false}
.row

View file

@ -8,7 +8,7 @@
= @event_type.title
.row
.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 :length, :input_html => {:size => 3}
= f.input :description

View file

@ -15,7 +15,7 @@
%th Color
%th Actions
%tbody
- @conference.event_types.each do |event_type|
- @conference.program.event_types.each do |event_type|
%tr
%td
= event_type.title
@ -32,11 +32,11 @@
= event_type.color
%td
.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'
= 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}?" }
.row
.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
%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}"
- if @conference.email_settings.send_on_accepted?
%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.',
id: "accept_event_without_mail_#{event.id}"
- if event.transition_possible? :reject
%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}"
- if @conference.email_settings.send_on_rejected?
%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}"
- if event.transition_possible? :restart
%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}"
- if event.transition_possible? :confirm
%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}",
hint: 'Confirm that the speaker(s) will be present and that the event will actually take place.'
- if event.transition_possible? :cancel
%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}",
hint: 'Mark this event as cancelled. Usually this means that the speakers had to cancel their appearance.'

View file

@ -6,7 +6,7 @@
%div
%a.pull-right.comment-reply-link{href: "#"} 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: "authenticity_token", type: "hidden", value: "#{form_authenticity_token}"}
%textarea{name: "comment"}

View file

@ -5,7 +5,7 @@
%br
%small
= @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
.col-md-12
@ -24,7 +24,7 @@
%ul.dropdown-menu
- @event_types.each do |type|
%li= link_to type.title,
admin_conference_event_path(@conference.short_title,
admin_conference_program_event_path(@conference.short_title,
@event,
event: { event_type_id: type.id }),
method: :patch
@ -33,7 +33,7 @@
%b Highlight
%td
= 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',
off_color: 'warning',
on_text: 'Yes',
@ -63,7 +63,7 @@
%ul.dropdown-menu
- @tracks.each do |track|
%li= link_to track.name,
admin_conference_event_path(@conference.short_title,
admin_conference_program_event_path(@conference.short_title,
@event,
event: { track_id: track.id }),
method: :patch
@ -80,7 +80,7 @@
<b class="caret"></b>
%ul.dropdown-menu
- @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: { difficulty_level_id: difficulty.id }),
method: :patch
@ -89,7 +89,7 @@
%b Requires Registration
%td
= 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',
off_color: 'warning',
on_text: 'Yes',
@ -137,7 +137,7 @@
%b 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'
.row
@ -147,7 +147,7 @@
%ul.media
%div
.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, '')
= submit_tag 'Add Comment', class: 'btn btn-primary pull-right'
%br

View file

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

View file

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

View file

@ -5,7 +5,7 @@
%p.text-muted
The rooms of your conference venue
- if @conference.rooms.any?
- if @conference.program.rooms.any?
.row
.col-md-12
%table.table.table-hover#rooms
@ -14,18 +14,18 @@
%th Size
%th Actions
%tbody
- @conference.rooms.each_with_index do |room, index|
- @conference.program.rooms.each_with_index do |room, index|
%tr
%td
= room.name
%td
= room.size
%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'
= 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',
data: { confirm: "Do you really want to delete #{room.name}? Attention: This room will be removed from all Events that have it set"}
.row
.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
.row
.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 :color, :input_html => {:size => 6, :type => "color"}, :required=> true
= f.input :description, :input_html => {:rows => 2, data: { provide: "markdown-editable" } }, hint: markdown_hint

View file

@ -13,10 +13,10 @@
%th Color
%th Actions
%tbody
- @conference.tracks.each do |track|
- @tracks.each do |track|
%tr
%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
%td
%p
@ -26,12 +26,12 @@
= track.color
%td
.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'
= 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',
data: { confirm: "Do you really want to delete #{track.name}? Attention: This track will be removed from all Events that have it set" }
.row
.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|
%tr
%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
= event.event_type.title
%td

View file

@ -17,13 +17,13 @@
- @user.events.each do |event|
%tr
%td= event.id
%td= link_to event.conference.short_title, admin_conference_path(event.conference.short_title)
%td= link_to event.title, admin_conference_event_path(event.conference.short_title, event)
%td= link_to event.program.conference.short_title, admin_conference_path(event.program.conference.short_title)
%td= link_to event.title, admin_conference_program_event_path(event.program.conference.short_title, event)
%td= event.state
%td= "#{event.event_type.title} (#{show_time(event.event_type.length)})"
%td
- if event.conference.call_for_paper && event.conference.call_for_paper.rating && event.conference.call_for_paper.rating > 0
- event.conference.call_for_paper.rating.times do |counter|
- if event.program && event.program.rating && event.program.rating > 0
- event.program.rating.times do |counter|
- if event.average_rating.to_f.round == counter+1
= label_tag 'label_rating', '', class: 'avgrating', avgrate: true
= 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>
<% @conference.events.confirmed.each do |event| %>
<% @conference.program.events.confirmed.each do |event| %>
<div>
<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>
<small>
<%= event.subtitle %>
@ -13,7 +13,7 @@
</h4>
<p>
<%= 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>
</div>
<% end %>

View file

@ -12,22 +12,22 @@
.row
.col-md-6.col-md-offset-3.col-sm-10.col-sm-offset-1
%p
- if @conference.event_types.any?
- if @program.event_types.any?
You can submit proposals for
= "#{event_types(@conference)}."
- if @conference.tracks.any?
- if @program.tracks.any?
Proposals should fit in one of the
= "#{pluralize(@conference.tracks.count, 'track')}:"
= "#{pluralize(@program.tracks.count, 'track')}:"
= "#{tracks(@conference)}."
The submission period has begun
%em
= @conference.call_for_paper.start_date.strftime('%A, %B %-d. %Y')
= @program.cfp.start_date.strftime('%A, %B %-d. %Y')
and closes
%em
= @conference.call_for_paper.end_date.strftime('%A, %B %-d. %Y.')
- if @conference.cfp_open?
= @program.cfp.end_date.strftime('%A, %B %-d. %Y.')
- if @program.cfp_open?
That means you have only
%b= pluralize(@conference.call_for_paper.remaining_days, 'day')
%b= pluralize(@program.cfp.remaining_days, 'day')
left!
Remember
= @conference.short_title
@ -37,4 +37,4 @@
.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'
= 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.splashpage && conference.splashpage.public
= 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"
- if conference.registration_open?
- if conference.user_registered?(current_user)
@ -29,9 +29,9 @@
- else
= 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
= link_to "My Proposals", conference_proposal_index_path(conference.short_title), :class =>"btn btn-default"
- elsif conference.cfp_open?
= link_to "Submit Proposal", new_conference_proposal_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.program.cfp_open?
= link_to "Submit Proposal", new_conference_program_proposal_path(conference.short_title), :class =>"btn btn-default"
- if current_user.nil? || !current_user.subscribed?(conference)
= link_to 'Subscribe', conference_subscriptions_path(conference.short_title), method: :post, class: 'btn btn-default'
- 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", |
rowspan: span[room.id], |
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
= image_tag speaker.gravatar_url, :class => "img-circle pull-right", |
:alt => speaker.name, |

View file

@ -6,10 +6,10 @@
%p.lead.text-center
= @conference.short_title
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
- 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
- slice.each do |track|
.col-md-4.col-sm-4.col-centered.col-top.track
@ -17,7 +17,7 @@
= track.name
= markdown(track.description)
- if @conference.call_for_paper and @conference.call_for_paper.schedule_public
- if @conference.program and @conference.program.schedule_public
.row
.col-md-12
%p.cta-button.text-center
@ -28,10 +28,10 @@
%h3.text-center
Don't miss out!
%br
- if @conference.events.highlights.any?
- if @conference.program.events.highlights.any?
.row
.col-md-12
- @conference.events.highlights.each_slice(2) do |slice|
- @conference.program.events.highlights.each_slice(2) do |slice|
.row.row-centered
- slice.each do |event|
.col-md-6.col-centered.col-top.highlights
@ -39,7 +39,7 @@
%b= event.title
%h5.text-center
= 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
%li

View file

@ -1,5 +1,5 @@
<div class="container">
<% if @conference.events.scheduled.any? %>
<% if @conference.program.events.scheduled.any? %>
<div role="tabpanel">
<!-- Nav tabs -->
<ul class="nav nav-tabs" role="tablist">

View file

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

View file

@ -1,8 +1,8 @@
- if @conference.questions.any?
= 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.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.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' }

View file

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

View file

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

View file

@ -7,9 +7,9 @@
= link_to(edit_user_path(current_user.id)) do
%span.fa.fa-user
Edit Profile
-if @conference and @conference.call_for_paper
-if @conference and @conference.program
%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
My Submissions
%li

View file

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

View file

@ -13,7 +13,7 @@
#commercials-content.tab-pane
%p.text-muted
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 can? :create, @event.commercials.new
.row
@ -37,9 +37,9 @@
= render partial: 'shared/media_item', locals: { commercial: commercial }
.caption
- 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.action :submit, as: :button, button_html: { class: 'btn btn-success' }, label: 'Update'
- 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'

View file

@ -5,21 +5,21 @@
= f.input :subtitle, as: :string
= 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 }]},
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" }
= event_type.description
: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' },
include_blank: '(Please select)' if @conference.difficulty_levels.any?
= f.input :difficulty_level, as: :select, collection: @conference.program.difficulty_levels, input_html: { class: 'select-help-toggle' },
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" }
= difficulty_level.description

View file

@ -3,9 +3,9 @@
%li{'class'=>class_for_todo(progress_status['registered'])}
%span{'class'=>icon_for_todo(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
= 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'])}
%span{'class'=>icon_for_todo(progress_status['biography'])}
@ -17,20 +17,19 @@
%li{'class'=>class_for_todo(progress_status['subtitle'])}
%span{'class'=>icon_for_todo(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
= 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'])}
%span{'class'=>icon_for_todo(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
= 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'])}
%span{'class'=>icon_for_todo(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
= 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}!
%ul
- @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
@ -60,7 +60,7 @@
%span{ title: event.state.humanize, class: "fa #{event_status_icon(event)}" }
%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
%small.text-muted
= event.event_type.title
@ -82,20 +82,20 @@
.pull-right
- if event.transition_possible? :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}"
- 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',
id: "delete_proposal_#{event.id}"
- if event.state == 'withdrawn' || event.state == 'rejected'
= 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}"
= 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}"
.row
.col-md-12
- if @conference.cfp_open? || (current_user.has_role? :organizer, @conference)
= link_to "New Proposal", new_conference_proposal_path(@conference.short_title), :class => "btn btn-success pull-right"
- if can? :create, @program.events.new
= 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.input :title, as: :string, required: true, input_html: { required: true }
= 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 }]},
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" }
= event_type.description
: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 },
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
= link_to "Schedule", schedule_conference_path(@conference.short_title), :class =>"btn btn-success pull-right"
- 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
.col-md-3
%p
@ -24,7 +24,7 @@
- if @event.room_id
= @event.room.name
%dt Conference:
%dd= @event.conference.title
%dd= @event.program.conference.title
%dt Language:
%dd= @event.language if @event.language
%dt Track:

View file

@ -44,15 +44,30 @@ Osem::Application.routes.draw do
# Singletons
resource :splashpage
resource :call_for_paper
resource :venue
resource :registration_period
resources :tickets
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 :sponsors, except: [:show]
resources :lodgings, except: [:show]
resources :targets, except: [:show]
@ -71,24 +86,11 @@ Osem::Application.routes.draw do
patch :update_conference
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
resources :conference, only: [:index, :show] do
resource :program, except: :destroy do
resources :proposal do
get 'commercials/render_commercial' => 'commercials#render_commercial'
resources :commercials, only: [:create, :update, :destroy]
@ -98,6 +100,7 @@ Osem::Application.routes.draw do
patch '/restart' => 'proposal#restart'
end
end
end
resource :conference_registrations, path: 'register'
resources :tickets, only: [:index]

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.
ActiveRecord::Schema.define(version: 20151005161518) do
ActiveRecord::Schema.define(version: 20151021113015) do
create_table "ahoy_events", force: true do |t|
t.uuid "visit_id"
@ -22,25 +21,14 @@ ActiveRecord::Schema.define(version: 20151005161518) do
t.datetime "time"
end
add_index "ahoy_events", ["time"], name: "index_ahoy_events_on_time"
add_index "ahoy_events", ["user_id"], name: "index_ahoy_events_on_user_id"
add_index "ahoy_events", ["visit_id"], name: "index_ahoy_events_on_visit_id"
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", using: :btree
add_index "ahoy_events", ["visit_id"], name: "index_ahoy_events_on_visit_id", using: :btree
create_table "answers", force: true do |t|
t.string "title"
t.datetime "created_at"
t.datetime "updated_at"
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"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
create_table "campaigns", force: true do |t|
@ -55,23 +43,31 @@ ActiveRecord::Schema.define(version: 20151005161518) do
t.datetime "updated_at"
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|
t.string "title", limit: 50, default: ""
t.text "body"
t.text "body", limit: 16777215
t.integer "commentable_id"
t.string "commentable_type"
t.integer "user_id"
t.datetime "created_at"
t.datetime "updated_at"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.string "subject"
t.integer "parent_id"
t.integer "lft"
t.integer "rgt"
end
add_index "comments", ["commentable_id"], name: "index_comments_on_commentable_id"
add_index "comments", ["commentable_type"], name: "index_comments_on_commentable_type"
add_index "comments", ["user_id"], name: "index_comments_on_user_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", using: :btree
add_index "comments", ["user_id"], name: "index_comments_on_user_id", using: :btree
create_table "commercials", force: true do |t|
t.string "commercial_id"
@ -91,8 +87,8 @@ ActiveRecord::Schema.define(version: 20151005161518) do
t.string "html_export_path"
t.date "start_date", null: false
t.date "end_date", null: false
t.datetime "created_at"
t.datetime "updated_at"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.string "logo_file_name"
t.string "logo_content_type"
t.integer "logo_file_size"
@ -140,22 +136,22 @@ ActiveRecord::Schema.define(version: 20151005161518) do
t.datetime "updated_at"
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|
t.integer "conference_id"
t.string "title", null: false
t.datetime "created_at"
t.datetime "updated_at"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
create_table "difficulty_levels", force: true do |t|
t.integer "conference_id"
t.string "title"
t.text "description"
t.string "color"
t.datetime "created_at"
t.datetime "updated_at"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.integer "program_id"
end
create_table "email_settings", force: true do |t|
@ -164,12 +160,12 @@ ActiveRecord::Schema.define(version: 20151005161518) do
t.boolean "send_on_accepted", default: false
t.boolean "send_on_rejected", default: false
t.boolean "send_on_confirmed_without_registration", default: false
t.text "registration_body"
t.text "accepted_body"
t.text "rejected_body"
t.text "confirmed_without_registration_body"
t.datetime "created_at"
t.datetime "updated_at"
t.text "registration_body", limit: 16777215
t.text "accepted_body", limit: 16777215
t.text "rejected_body", limit: 16777215
t.text "confirmed_without_registration_body", limit: 16777215
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.string "registration_subject"
t.string "accepted_subject"
t.string "rejected_subject"
@ -183,22 +179,22 @@ ActiveRecord::Schema.define(version: 20151005161518) do
t.boolean "send_on_venue_updated", default: false
t.string "venue_updated_subject"
t.text "venue_updated_body"
t.boolean "send_on_call_for_papers_dates_updated", default: false
t.boolean "send_on_call_for_papers_schedule_public", default: false
t.string "call_for_papers_schedule_public_subject"
t.string "call_for_papers_dates_updated_subject"
t.text "call_for_papers_schedule_public_body"
t.text "call_for_papers_dates_updated_body"
t.boolean "send_on_cfp_dates_updates", default: false
t.boolean "send_on_program_schedule_public", default: false
t.string "program_schedule_public_subject"
t.string "cfp_dates_updates_subject"
t.text "program_schedule_public_template"
t.text "cfp_dates_updates_template"
end
create_table "event_types", force: true do |t|
t.integer "conference_id"
t.string "title", null: false
t.integer "length", default: 30
t.integer "minimum_abstract_length", default: 0
t.integer "maximum_abstract_length", default: 500
t.string "color"
t.string "description"
t.integer "program_id"
end
create_table "event_users", force: true do |t|
@ -212,7 +208,6 @@ ActiveRecord::Schema.define(version: 20151005161518) do
create_table "events", force: true do |t|
t.string "guid", null: false
t.integer "conference_id"
t.integer "event_type_id"
t.string "title", null: false
t.string "subtitle"
@ -221,22 +216,23 @@ ActiveRecord::Schema.define(version: 20151005161518) do
t.string "progress", default: "new", null: false
t.string "language"
t.datetime "start_time"
t.text "abstract"
t.text "description"
t.text "abstract", limit: 16777215
t.text "description", limit: 16777215
t.boolean "public", default: true
t.string "logo_file_name"
t.string "logo_content_type"
t.integer "logo_file_size"
t.datetime "logo_updated_at"
t.text "proposal_additional_speakers"
t.text "proposal_additional_speakers", limit: 16777215
t.integer "track_id"
t.integer "room_id"
t.datetime "created_at"
t.datetime "updated_at"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.boolean "require_registration"
t.integer "difficulty_level_id"
t.integer "week"
t.boolean "is_highlight", default: false
t.integer "program_id"
end
create_table "events_registrations", id: false, force: true do |t|
@ -277,6 +273,13 @@ ActiveRecord::Schema.define(version: 20151005161518) do
t.datetime "updated_at"
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|
t.integer "question_id"
t.integer "answer_id"
@ -291,8 +294,8 @@ ActiveRecord::Schema.define(version: 20151005161518) do
create_table "question_types", force: true do |t|
t.string "title"
t.datetime "created_at"
t.datetime "updated_at"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
create_table "questions", force: true do |t|
@ -300,8 +303,8 @@ ActiveRecord::Schema.define(version: 20151005161518) do
t.integer "question_type_id"
t.integer "conference_id"
t.boolean "global"
t.datetime "created_at"
t.datetime "updated_at"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
create_table "registration_periods", force: true do |t|
@ -316,11 +319,11 @@ ActiveRecord::Schema.define(version: 20151005161518) do
t.integer "conference_id"
t.datetime "arrival"
t.datetime "departure"
t.datetime "created_at"
t.datetime "updated_at"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.integer "dietary_choice_id"
t.text "other_dietary_choice"
t.text "other_special_needs"
t.text "other_dietary_choice", limit: 16777215
t.text "other_special_needs", limit: 16777215
t.boolean "attended", default: false
t.boolean "volunteer"
t.integer "user_id"
@ -339,28 +342,28 @@ ActiveRecord::Schema.define(version: 20151005161518) do
create_table "roles", force: true do |t|
t.string "name"
t.datetime "created_at"
t.datetime "updated_at"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.string "description"
t.integer "resource_id"
t.string "resource_type"
end
add_index "roles", ["name", "resource_type", "resource_id"], name: "index_roles_on_name_and_resource_type_and_resource_id"
add_index "roles", ["name"], name: "index_roles_on_name"
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", using: :btree
create_table "roles_users", id: false, force: true do |t|
t.integer "role_id"
t.integer "user_id"
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|
t.string "guid", null: false
t.integer "conference_id"
t.string "name", null: false
t.integer "size"
t.integer "program_id"
end
create_table "social_events", force: true do |t|
@ -444,12 +447,12 @@ ActiveRecord::Schema.define(version: 20151005161518) do
create_table "tracks", force: true do |t|
t.string "guid", null: false
t.integer "conference_id"
t.string "name", null: false
t.text "description"
t.text "description", limit: 16777215
t.string "color"
t.datetime "created_at"
t.datetime "updated_at"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.integer "program_id"
end
create_table "users", force: true do |t|
@ -467,8 +470,8 @@ ActiveRecord::Schema.define(version: 20151005161518) do
t.datetime "confirmed_at"
t.datetime "confirmation_sent_at"
t.string "unconfirmed_email"
t.datetime "created_at"
t.datetime "updated_at"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.string "name"
t.boolean "email_public"
t.text "biography"
@ -487,10 +490,10 @@ ActiveRecord::Schema.define(version: 20151005161518) do
t.boolean "is_disabled", default: false
end
add_index "users", ["confirmation_token"], name: "index_users_on_confirmation_token", unique: true
add_index "users", ["email"], name: "index_users_on_email", unique: true
add_index "users", ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true
add_index "users", ["username"], name: "index_users_on_username", 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, using: :btree
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, using: :btree
create_table "vchoices", force: true do |t|
t.integer "vday_id"
@ -501,8 +504,8 @@ ActiveRecord::Schema.define(version: 20151005161518) do
t.integer "conference_id"
t.date "day"
t.text "description"
t.datetime "created_at"
t.datetime "updated_at"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
create_table "venues", force: true do |t|
@ -510,8 +513,8 @@ ActiveRecord::Schema.define(version: 20151005161518) do
t.string "name"
t.string "website"
t.text "description"
t.datetime "created_at"
t.datetime "updated_at"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.string "photo_file_name"
t.string "photo_content_type"
t.integer "photo_file_size"
@ -530,12 +533,12 @@ ActiveRecord::Schema.define(version: 20151005161518) do
t.integer "item_id", null: false
t.string "event", null: false
t.string "whodunnit"
t.text "object"
t.text "object_changes"
t.text "object", limit: 16777215
t.text "object_changes", limit: 16777215
t.datetime "created_at"
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|
t.uuid "visitor_id"
@ -560,13 +563,13 @@ ActiveRecord::Schema.define(version: 20151005161518) do
t.datetime "started_at"
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|
t.integer "event_id"
t.integer "rating"
t.datetime "created_at"
t.datetime "updated_at"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.integer "user_id"
end
@ -574,8 +577,8 @@ ActiveRecord::Schema.define(version: 20151005161518) do
t.integer "conference_id"
t.string "title", null: false
t.text "description"
t.datetime "created_at"
t.datetime "updated_at"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
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) { create(:user, role_ids: organizer_role.id, last_sign_in_at: Time.now - 1.day) }
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) }
context 'not logged in user' do
@ -32,7 +32,7 @@ describe Admin::CommentsController, type: :controller do
expect(assigns(:comments)).to be_a(Hash)
# assigns(:comments).first returns an array of first pair key-value from hash.
# 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
it 'has status 200: OK' do
get :index

View file

@ -165,7 +165,8 @@ describe Admin::ConferenceController do
it 'assigns cfp_max an array with maximum weeks' do
conference
date = Date.new(2014, 05, 26)
conference.call_for_paper = create(:call_for_paper,
conference.program.cfp = create(:cfp,
program: conference.program,
start_date: date,
end_date: date + 14)
get :index

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
FactoryGirl.define do
factory :call_for_paper do
factory :cfp do
program
start_date { 1.day.ago }
end_date { 6.days.from_now }
end

View file

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

View file

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

View file

@ -8,8 +8,8 @@ FactoryGirl.define do
send_on_confirmed_without_registration false
send_on_conference_dates_updated true
send_on_conference_registration_dates_updated true
send_on_call_for_papers_schedule_public true
send_on_call_for_papers_dates_updated true
send_on_program_schedule_public true
send_on_cfp_dates_updated true
conference_dates_updated_body 'Sample Conference\n New Dates: January 17 - 21 2014'
conference_dates_updated_subject 'Conference 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'
registration_subject 'Lorem Ipsum Dolsum'
registration_body 'Lorem ipsum dolor sit amet, consectetuer adipiscing elit'
call_for_papers_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'
call_for_papers_schedule_public_subject 'Sample Conference Cfp schedule is Public'
call_for_papers_schedule_public_body 'Call for Papers schedule is Public.Checkout the link'
cfp_dates_updated_subject 'Call for Papers dates have been updated'
cfp_dates_updated_body 'Please checkout the new updates to submit your proposal for Sample Conference'
program_schedule_public_subject 'Sample Conference Cfp schedule is Public'
program_schedule_public_body 'Call for Papers schedule is Public.Checkout the link'
end
end

View file

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

View file

@ -3,7 +3,7 @@
FactoryGirl.define do
factory :event do
sequence(:title) { |n| "The ##{n} talk you'll ever attend." }
conference
program
abstract <<-EOS
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer ante
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.
# needs to be created here because otherwise it doesn't belong to the
# same conference as the event
event.event_type ||= build(:event_type, conference: event.conference)
event.event_type ||= build(:event_type, program: event.program)
end
factory :event_full do
@ -44,9 +44,9 @@ FactoryGirl.define do
room
after(:build) do |event|
event.commercials << build(:event_commercial, commercialable: event)
event.difficulty_level = build(:difficulty_level, conference: event.conference)
event.track = build(:track, conference: event.conference)
event.room = build(:room, conference: event.conference)
event.difficulty_level = build(:difficulty_level, program: event.program)
event.track = build(:track, program: event.program)
event.room = build(:room, program: event.program)
event.comment_threads << build(:comment, commentable: event)
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
name 'Example Room'
size 4
conference
program
factory :room_for_100 do
name 'Room for 100'

View file

@ -3,7 +3,7 @@ FactoryGirl.define do
name 'Example Track'
description 'Lorem Ipsum dolsum'
color '#ffffff'
conference
program
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('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('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('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('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('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('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('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('Call for Papers', href: "/admin/conference/#{conference1.short_title}/call_for_paper")
expect(page).to have_link('Tracks', href: "/admin/conference/#{conference1.short_title}/tracks")
expect(page).to have_link('Event Types', href: "/admin/conference/#{conference1.short_title}/event_types")
expect(page).to have_link('Difficulty Levels', href: "/admin/conference/#{conference1.short_title}/difficulty_levels")
expect(page).to have_link('Program', href: "/admin/conference/#{conference1.short_title}/program")
expect(page).to have_link('Call for Papers', href: "/admin/conference/#{conference1.short_title}/program/cfp")
expect(page).to have_link('Tracks', href: "/admin/conference/#{conference1.short_title}/program/tracks")
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('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)
expect(current_path).to eq(admin_conference_registrations_path(conference1.short_title))
visit admin_conference_events_path(conference1.short_title)
expect(current_path).to eq(admin_conference_events_path(conference1.short_title))
visit admin_conference_program_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)
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)
expect(current_path).to eq(admin_conference_emails_path(conference1.short_title))
visit new_admin_conference_call_for_paper_path(conference1.short_title)
expect(current_path).to eq(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_program_cfp_path(conference1.short_title))
visit 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_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('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 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('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('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('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('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('Call for Papers', href: "/admin/conference/#{conference2.short_title}/call_for_paper")
expect(page).to have_link('Tracks', href: "/admin/conference/#{conference2.short_title}/tracks")
expect(page).to have_link('Event Types', href: "/admin/conference/#{conference2.short_title}/event_types")
expect(page).to have_link('Difficulty Levels', href: "/admin/conference/#{conference2.short_title}/difficulty_levels")
expect(page).to have_link('Program', href: "/admin/conference/#{conference2.short_title}/program")
expect(page).to have_link('Call for Papers', href: "/admin/conference/#{conference2.short_title}/program/cfp")
expect(page).to have_link('Tracks', href: "/admin/conference/#{conference2.short_title}/program/tracks")
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('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)
expect(current_path).to eq(admin_conference_registrations_path(conference2.short_title))
visit admin_conference_events_path(conference2.short_title)
expect(current_path).to eq(admin_conference_events_path(conference2.short_title))
visit admin_conference_program_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)
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)
expect(current_path).to eq(admin_conference_emails_path(conference2.short_title))
visit new_admin_conference_call_for_paper_path(conference2.short_title)
expect(current_path).to eq(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_program_cfp_path(conference2.short_title))
visit admin_conference_questions_path(conference2.short_title)
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_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_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_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('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('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('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('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('Call for papers', href: "/admin/conference/#{conference3.short_title}/call_for_paper")
expect(page).to_not have_link('Tracks', href: "/admin/conference/#{conference3.short_title}/tracks")
expect(page).to_not have_link('Event types', href: "/admin/conference/#{conference3.short_title}/event_types")
expect(page).to_not have_link('Difficulty levels', href: "/admin/conference/#{conference3.short_title}/difficulty_levels")
expect(page).to_not have_link('Program', href: "/admin/conference/#{conference3.short_title}/program")
expect(page).to_not have_link('Call for papers', href: "/admin/conference/#{conference3.short_title}/program/cfp")
expect(page).to_not have_link('Tracks', href: "/admin/conference/#{conference3.short_title}/program/tracks")
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_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)
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)
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)
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)
visit admin_conference_questions_path(conference3.short_title)

View file

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

View file

@ -42,7 +42,7 @@ feature Commercial do
end
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
event.event_users = [create(:event_user,
@ -58,8 +58,8 @@ feature Commercial do
sign_out
end
scenario 'adds a commercial of an event', feature: true, js: true do
visit edit_conference_proposal_path(conference.short_title, event.id)
scenario 'adds a valid commercial of an event', feature: true, js: true do
visit edit_conference_program_proposal_path(conference.short_title, event.id)
click_link 'Commercials'
fill_in 'commercial_url', with: 'https://www.youtube.com/watch?v=M9bq_alk-sw'
@ -75,7 +75,7 @@ feature Commercial do
commercial = create(:commercial,
commercialable_id: event.id,
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'
fill_in "commercial_url_#{commercial.id}", with: 'https://www.youtube.com/watch?v=M9bq_alk-sw'
click_button 'Update'
@ -89,7 +89,7 @@ feature Commercial do
create(:commercial,
commercialable_id: event.id,
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 'Delete'
page.driver.network_traffic

View file

@ -9,7 +9,7 @@ feature DifficultyLevel do
scenario 'adds difficulty level', feature: true, js: true do
sign_in organizer
visit admin_conference_difficulty_levels_path(
visit admin_conference_program_difficulty_levels_path(
conference_id: conference.short_title)
# Add difficulty level
@ -32,9 +32,9 @@ feature DifficultyLevel 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
visit admin_conference_difficulty_levels_path(
visit admin_conference_program_difficulty_levels_path(
conference_id: conference.short_title)
# Remove difficulty level

View file

@ -9,7 +9,7 @@ feature EventType do
scenario 'adds and updates event type', feature: true, js: true do
sign_in organizer
visit admin_conference_event_types_path(
visit admin_conference_program_event_types_path(
conference_id: conference.short_title)
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