Merge master
This commit is contained in:
commit
7586112f72
217 changed files with 2853 additions and 3035 deletions
|
|
@ -6,7 +6,7 @@ module Admin
|
|||
load_and_authorize_resource through: :conference
|
||||
|
||||
def index
|
||||
@file_name = "booths_for_#{@conference.short_title}"
|
||||
@file_name = "#{(t 'booth').pluralize}_for_#{@conference.short_title}"
|
||||
@booth_export_option = params[:booth_export_option]
|
||||
respond_to do |format|
|
||||
format.html
|
||||
|
|
@ -14,12 +14,12 @@ module Admin
|
|||
format.json { render json: Booth.where(state: :confirmed, program: @program).to_json }
|
||||
format.xlsx do
|
||||
response.headers['Content-Disposition'] = "attachment; filename=\"#{@file_name}.xlsx\""
|
||||
render 'booths'
|
||||
render 'booths', layout: false
|
||||
end
|
||||
format.pdf { render 'booths' }
|
||||
format.pdf { render 'booths', layout: false }
|
||||
format.csv do
|
||||
response.headers['Content-Disposition'] = "attachment; filename=\"#{@file_name}.csv\""
|
||||
render 'booths'
|
||||
render 'booths', layout: false
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -39,9 +39,9 @@ module Admin
|
|||
|
||||
if @booth.save
|
||||
redirect_to admin_conference_booths_path,
|
||||
notice: 'Booth successfully created.'
|
||||
notice: "#{(t 'booth').capitalize} successfully created."
|
||||
else
|
||||
flash.now[:error] = "Creating booth failed. #{@booth.errors.full_messages.to_sentence}."
|
||||
flash.now[:error] = "Creating #{t 'booth'} failed. #{@booth.errors.full_messages.to_sentence}."
|
||||
render :new
|
||||
end
|
||||
end
|
||||
|
|
@ -57,9 +57,9 @@ module Admin
|
|||
|
||||
if @booth.save
|
||||
redirect_to admin_conference_booths_path,
|
||||
notice: "Successfully updated booth for #{@booth.title}."
|
||||
notice: "Successfully updated #{t 'booth'} for #{@booth.title}."
|
||||
else
|
||||
flash.now[:error] = "An error prohibited the Booth for #{@booth.title} "\
|
||||
flash.now[:error] = "An error prohibited the #{t'booth'} for #{@booth.title} "\
|
||||
"#{@booth.errors.full_messages.join('. ')}."
|
||||
render :edit
|
||||
end
|
||||
|
|
@ -70,47 +70,49 @@ module Admin
|
|||
|
||||
if @booth.save
|
||||
if @conference.email_settings.send_on_booths_acceptance
|
||||
Mailbot.conference_booths_acceptance_mail(@booth).deliver
|
||||
Mailbot.conference_booths_acceptance_mail(@booth).deliver_later
|
||||
end
|
||||
redirect_to admin_conference_booths_path(conference_id: @conference.short_title),
|
||||
notice: 'Booth successfully accepted!'
|
||||
notice: "#{(t'booth').capitalize} successfully accepted!"
|
||||
else
|
||||
redirect_to admin_conference_booths_path(conference_id: @conference.short_title)
|
||||
flash[:error] = "Booth could not be accepted. #{@booth.errors.full_messages.to_sentence}."
|
||||
flash[:error] = "#{(t 'booth').capitalize} could not be accepted. #{@booth.errors.full_messages.to_sentence}."
|
||||
end
|
||||
end
|
||||
|
||||
def to_accept
|
||||
update_state(:to_accept, 'Booth to accept')
|
||||
update_state(:to_accept, "#{(t'booth').capitalize} to accept")
|
||||
end
|
||||
|
||||
def to_reject
|
||||
update_state(:to_reject, 'Booth to reject')
|
||||
update_state(:to_reject, "#{(t'booth').capitalize} to reject")
|
||||
end
|
||||
|
||||
def reject
|
||||
@booth.reject!
|
||||
|
||||
if @booth.save
|
||||
Mailbot.conference_booths_rejection_mail(@booth).deliver
|
||||
if @conference.email_settings.send_on_booths_rejection
|
||||
Mailbot.conference_booths_rejection_mail(@booth).deliver_later
|
||||
end
|
||||
redirect_to admin_conference_booths_path(conference_id: @conference.short_title),
|
||||
notice: 'Booth successfully rejected.'
|
||||
notice: "#{(t'booth').capitalize} successfully rejected."
|
||||
else
|
||||
redirect_to admin_conference_booths_path(conference_id: @conference.short_title)
|
||||
flash[:error] = "Booth could not be rejected. #{@booth.errors.full_messages.to_sentence}."
|
||||
flash[:error] = "#{(t 'booth').capitalize} could not be rejected. #{@booth.errors.full_messages.to_sentence}."
|
||||
end
|
||||
end
|
||||
|
||||
def restart
|
||||
update_state(:restart, 'Booth is submitted')
|
||||
update_state(:restart, "#{(t 'booth').capitalize} is submitted")
|
||||
end
|
||||
|
||||
def cancel
|
||||
update_state(:cancel, 'Booth is canceled')
|
||||
update_state(:cancel, "#{(t 'booth').capitalize} is canceled")
|
||||
end
|
||||
|
||||
def confirm
|
||||
update_state(:confirm, 'Booth successfully confirmed')
|
||||
update_state(:confirm, "#{(t 'booth').capitalize} successfully confirmed")
|
||||
end
|
||||
|
||||
private
|
||||
|
|
|
|||
|
|
@ -45,9 +45,9 @@ module Admin
|
|||
def render_commercial
|
||||
result = Commercial.render_from_url(params[:url])
|
||||
if result[:error]
|
||||
render text: result[:error], status: 400
|
||||
render plain: result[:error], status: 400
|
||||
else
|
||||
render text: result[:html]
|
||||
render plain: result[:html]
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -70,7 +70,7 @@ module Admin
|
|||
|
||||
flash[:error] = errors_text
|
||||
end
|
||||
redirect_to :back
|
||||
redirect_back(fallback_location: root_path)
|
||||
end
|
||||
|
||||
private
|
||||
|
|
|
|||
|
|
@ -37,43 +37,33 @@ module Admin
|
|||
|
||||
@top_submitter = Conference.get_top_submitter
|
||||
|
||||
@submissions = {}
|
||||
@cfp_weeks = [0]
|
||||
|
||||
@registrations = {}
|
||||
@registration_weeks = [0]
|
||||
|
||||
@tickets = {}
|
||||
@ticket_weeks = [0]
|
||||
@registrations = []
|
||||
@submissions = []
|
||||
@tickets = []
|
||||
|
||||
@conferences.each do |c|
|
||||
# Event submissions over time chart
|
||||
@submissions[c.short_title] = c.get_submissions_per_week
|
||||
@cfp_weeks.push(@submissions[c.short_title].length)
|
||||
|
||||
# Conference registrations over time chart
|
||||
@registrations[c.short_title] = c.get_registrations_per_week
|
||||
@registration_weeks.push(@registrations[c.short_title].length)
|
||||
|
||||
@registrations << {
|
||||
name: c.short_title,
|
||||
data: c.get_registrations_per_week
|
||||
}
|
||||
# Event submissions over time chart
|
||||
@submissions << {
|
||||
name: c.short_title,
|
||||
data: c.get_submissions_per_week
|
||||
}
|
||||
# Tickets sold over time chart
|
||||
@tickets[c.short_title] = c.get_tickets_sold_per_week
|
||||
@ticket_weeks.push(@tickets[c.short_title].length)
|
||||
@tickets << {
|
||||
name: c.short_title,
|
||||
data: c.get_tickets_sold_per_week
|
||||
}
|
||||
end
|
||||
|
||||
@cfp_weeks = @cfp_weeks.max
|
||||
@submissions = normalize_array_length(@submissions, @cfp_weeks)
|
||||
@cfp_weeks = @cfp_weeks > 0 ? (1..@cfp_weeks).to_a : 1
|
||||
|
||||
@registration_weeks = @registration_weeks.max
|
||||
@registrations = normalize_array_length(@registrations, @registration_weeks)
|
||||
@registration_weeks = @registration_weeks > 0 ? (1..@registration_weeks).to_a : 1
|
||||
|
||||
@ticket_weeks = @ticket_weeks.max
|
||||
@tickets = normalize_array_length(@tickets, @ticket_weeks)
|
||||
@ticket_weeks = @ticket_weeks > 0 ? (1..@ticket_weeks).to_a : 1
|
||||
|
||||
@event_distribution = Conference.event_distribution
|
||||
@user_distribution = Conference.user_distribution
|
||||
@event_distribution_colors = Event::COLORS.values
|
||||
|
||||
@user_distribution = User.distribution
|
||||
@user_distribution_colors = User::DISTRIBUTION_COLORS.values
|
||||
end
|
||||
|
||||
def new
|
||||
|
|
@ -138,35 +128,9 @@ module Admin
|
|||
@conference_progress = @conference.get_status
|
||||
|
||||
# Line charts
|
||||
@registrations = {@conference.short_title => @conference.get_registrations_per_week}
|
||||
@registration_weeks = [0]
|
||||
@registration_weeks.push(@registrations[@conference.short_title].length)
|
||||
|
||||
@registration_weeks = @registration_weeks.max
|
||||
@registrations = normalize_array_length(@registrations, @registration_weeks)
|
||||
@registration_weeks = @registration_weeks > 0 ? (1..@registration_weeks).to_a : 1
|
||||
|
||||
@submissions = Conference.get_event_state_line_colors
|
||||
|
||||
@submissions_data = @conference.get_submissions_data
|
||||
@cfp_weeks = 0
|
||||
if @submissions_data['Weeks']
|
||||
@cfp_weeks = @submissions_data['Weeks']
|
||||
@submissions_data = @submissions_data.except('Weeks')
|
||||
end
|
||||
|
||||
@tickets_data = @conference.get_tickets_data
|
||||
@ticket_weeks = 0
|
||||
if @tickets_data['Weeks']
|
||||
@ticket_weeks = @tickets_data['Weeks']
|
||||
@tickets_data = @tickets_data.except('Weeks')
|
||||
end
|
||||
|
||||
# Set line color using a hash function
|
||||
@tickets = []
|
||||
@tickets_data.each_key do |title|
|
||||
@tickets.append(short_title: title, color: "\##{Digest::MD5.hexdigest(title)[0..5]}")
|
||||
end
|
||||
@registrations = @conference.get_registrations_per_week
|
||||
@submissions = @conference.get_submissions_data
|
||||
@tickets = @conference.get_tickets_data
|
||||
|
||||
# Doughnut charts
|
||||
@event_type_distribution = @conference.event_type_distribution
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
module Admin
|
||||
class EventSchedulesController < Admin::BaseController
|
||||
load_and_authorize_resource :event_schedule
|
||||
skip_before_action :verify_authenticity_token
|
||||
|
||||
def create
|
||||
if @event_schedule.save
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ module Admin
|
|||
@event_types = @program.event_types
|
||||
@tracks_distribution_confirmed = @conference.tracks_distribution(:confirmed)
|
||||
@event_distribution = @conference.event_distribution
|
||||
@event_distribution_colors = Event::COLORS.values
|
||||
@scheduled_event_distribution = @conference.scheduled_event_distribution
|
||||
@file_name = "events_for_#{@conference.short_title}"
|
||||
@event_export_option = params[:event_export_option]
|
||||
|
|
@ -27,12 +28,12 @@ module Admin
|
|||
format.json { render json: Event.where(state: :confirmed, program: @program).to_json }
|
||||
format.xlsx do
|
||||
response.headers['Content-Disposition'] = "attachment; filename=\"#{@file_name}.xlsx\""
|
||||
render 'events'
|
||||
render 'events', layout: false
|
||||
end
|
||||
format.pdf { render 'events' }
|
||||
format.pdf { render 'events', layout: false }
|
||||
format.csv do
|
||||
response.headers['Content-Disposition'] = "attachment; filename=\"#{@file_name}.csv\""
|
||||
render 'events'
|
||||
render 'events', layout: false
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -23,12 +23,6 @@ module Admin
|
|||
end
|
||||
end
|
||||
|
||||
def edit
|
||||
end
|
||||
|
||||
def show
|
||||
end
|
||||
|
||||
def update
|
||||
@registration_period.assign_attributes(registration_period_params)
|
||||
send_mail_on_reg_update = @conference.notify_on_registration_dates_changed?
|
||||
|
|
|
|||
|
|
@ -15,12 +15,22 @@ module Admin
|
|||
@registration_distribution = @conference.registration_distribution
|
||||
@affiliation_distribution = @conference.affiliation_distribution
|
||||
@code_of_conduct = @conference.code_of_conduct.present?
|
||||
@file_name = "registrations_for_#{@conference.short_title}"
|
||||
|
||||
respond_to do |format|
|
||||
format.html
|
||||
format.json do
|
||||
render json: RegistrationDatatable.new(view_context, conference: @conference)
|
||||
end
|
||||
format.pdf { render 'index', layout: false }
|
||||
format.xlsx do
|
||||
response.headers['Content-Disposition'] = "attachment; filename=\"#{@file_name}.xlsx\""
|
||||
render 'index', layout: false
|
||||
end
|
||||
format.csv do
|
||||
response.headers['Content-Disposition'] = "attachment; filename=\"#{@file_name}.csv\""
|
||||
render 'index', layout: false
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -15,8 +15,9 @@ module Admin
|
|||
|
||||
attended_registrants_ids = @conference.registrations.where(attended: true).pluck(:user_id)
|
||||
@missing_event_speakers = EventUser.joins(:event)
|
||||
.where('event_role = ? and program_id = ?', 'submitter', @program.id)
|
||||
.where('event_role = ? and program_id = ?', 'speaker', @program.id)
|
||||
.where.not(user_id: attended_registrants_ids)
|
||||
.where(event_id: @events.pluck(:id))
|
||||
.includes(:user, :event)
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ module Admin
|
|||
if @survey.save
|
||||
redirect_to new_admin_conference_survey_survey_question_path(@conference.short_title, @survey), notice: 'Successfully created survey'
|
||||
else
|
||||
redirect_to new_admin_conference_survey_survey_question_path(@conference.short_title, @survey), error: 'Could not create survey.' + @survey.errors.full_messages.to_sentence
|
||||
redirect_to new_admin_conference_survey_path(@conference.short_title, survey: { surveyable_type: survey_params['surveyable_type'], surveyable_id: survey_params['surveyable_id'] }), error: 'Could not create survey.' + @survey.errors.full_messages.to_sentence
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -19,12 +19,12 @@ module Admin
|
|||
format.json { render json: Track.where(state: :confirmed, program: @program).to_json }
|
||||
format.xlsx do
|
||||
response.headers['Content-Disposition'] = "attachment; filename=\"#{@file_name}.xlsx\""
|
||||
render 'tracks'
|
||||
render 'tracks', layout: false
|
||||
end
|
||||
format.pdf { render 'tracks' }
|
||||
format.pdf { render 'tracks', layout: false }
|
||||
format.csv do
|
||||
response.headers['Content-Disposition'] = "attachment; filename=\"#{@file_name}.csv\""
|
||||
render 'tracks'
|
||||
render 'tracks', layout: false
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -40,9 +40,9 @@ module Admin
|
|||
def render_commercial
|
||||
result = Commercial.render_from_url(params[:url])
|
||||
if result[:error]
|
||||
render text: result[:error], status: 400
|
||||
render plain: result[:error], status: 400
|
||||
else
|
||||
render text: result[:html]
|
||||
render plain: result[:html]
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue