Implements targets and campaigns for conference
This commit is contained in:
parent
678fe38a25
commit
857ac43e74
40 changed files with 1086 additions and 44 deletions
65
app/controllers/admin/campaigns_controller.rb
Normal file
65
app/controllers/admin/campaigns_controller.rb
Normal file
|
|
@ -0,0 +1,65 @@
|
|||
module Admin
|
||||
class CampaignsController < ApplicationController
|
||||
before_filter :verify_organizer
|
||||
|
||||
def index
|
||||
@conference = Conference.find_by(short_title: params[:conference_id])
|
||||
@campaigns = @conference.campaigns
|
||||
end
|
||||
|
||||
def create
|
||||
@conference = Conference.find_by(short_title: params[:conference_id])
|
||||
@campaign = @conference.campaigns.new(params[:campaign])
|
||||
@campaign.conference_id = @conference.id
|
||||
|
||||
if @conference.save
|
||||
redirect_to(admin_conference_campaigns_path(conference_id: @conference.short_title),
|
||||
notice: 'Campaign successfully created.')
|
||||
else
|
||||
redirect_to(new_admin_conference_campaign_path(conference_id: @conference.short_title),
|
||||
alert: "Creating of Campaign for #{@conference.short_title} failed." \
|
||||
"#{@campaign.errors.full_messages.join('. ')}.")
|
||||
end
|
||||
end
|
||||
|
||||
def new
|
||||
@conference = Conference.find_by(short_title: params[:conference_id])
|
||||
@campaign = @conference.campaigns.new
|
||||
end
|
||||
|
||||
def edit
|
||||
@conference = Conference.find_by(short_title: params[:conference_id])
|
||||
@campaign = Campaign.find(params[:id])
|
||||
end
|
||||
|
||||
def update
|
||||
@conference = Conference.find_by(short_title: params[:conference_id])
|
||||
@campaign = Campaign.find(params[:id])
|
||||
|
||||
if @campaign.update_attributes(params[:campaign])
|
||||
redirect_to(admin_conference_campaigns_path(
|
||||
conference_id: @conference.short_title),
|
||||
notice: "Campaign '#{@campaign.name}' successfully updated.")
|
||||
else
|
||||
redirect_to(edit_admin_conference_campaign_path(
|
||||
conference_id: @conference.short_title,
|
||||
id: @campaign.id),
|
||||
alert: "Update of Campaign for #{@conference.short_title} failed." \
|
||||
"#{@campaign.errors.full_messages.join('. ')}.")
|
||||
end
|
||||
end
|
||||
|
||||
def destroy
|
||||
@conference = Conference.find_by(short_title: params[:conference_id])
|
||||
@campaign = Campaign.find(params[:id])
|
||||
if @campaign.destroy
|
||||
redirect_to(admin_conference_campaigns_path(conference_id: @conference.short_title),
|
||||
notice: "Campaign '#{@campaign.name}' successfully deleted.")
|
||||
else
|
||||
redirect_to(admin_conference_campaigns_path(conference_id: @conference.short_title),
|
||||
alert: "Delete of Campaign for #{@conference.short_title} failed." \
|
||||
"#{@campaign.errors.full_messages.join('. ')}.")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -144,6 +144,14 @@ class Admin::ConferenceController < ApplicationController
|
|||
|
||||
@top_submitter = @conference.get_top_submitter
|
||||
|
||||
# get targets
|
||||
@registration_targets = @conference.get_targets(Target.units[:registrations])
|
||||
@submission_targets = @conference.get_targets(Target.units[:submissions])
|
||||
@program_minutes_targets = @conference.get_targets(Target.units[:program_minutes])
|
||||
|
||||
# get campaigns
|
||||
@campaigns = @conference.get_campaigns
|
||||
|
||||
respond_to do |format|
|
||||
format.html
|
||||
format.json { render json: @conference.to_json }
|
||||
|
|
|
|||
21
app/controllers/admin/targets_controller.rb
Normal file
21
app/controllers/admin/targets_controller.rb
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
module Admin
|
||||
class TargetsController < ApplicationController
|
||||
before_filter :verify_organizer
|
||||
|
||||
def index
|
||||
end
|
||||
|
||||
def update
|
||||
if @conference.update_attributes(params[:conference])
|
||||
redirect_to(admin_conference_targets_path(
|
||||
conference_id: @conference.short_title),
|
||||
notice: 'Targets were successfully updated.')
|
||||
else
|
||||
redirect_to(admin_conference_targets_path(
|
||||
conference_id: @conference.short_title),
|
||||
alert: 'Targets update failed: ' \
|
||||
"#{@conference.errors.full_messages.join('. ')}")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -75,6 +75,8 @@ class ConferenceRegistrationController < ApplicationController
|
|||
if update_registration
|
||||
redirect_message = "Registration updated."
|
||||
else
|
||||
# Track ahoy event
|
||||
ahoy.track 'Registered', title: 'New registration'
|
||||
if conference.email_settings.send_on_registration?
|
||||
Mailbot.registration_mail(conference, current_user.person).deliver
|
||||
end
|
||||
|
|
|
|||
|
|
@ -137,6 +137,7 @@ class ProposalController < ApplicationController
|
|||
end
|
||||
|
||||
registration = person.registrations.where(:conference_id => @conference.id).first
|
||||
ahoy.track 'Event submission', title: 'New submission'
|
||||
if registration.nil?
|
||||
redirect_to(register_conference_path(@conference.short_title), :notice => 'Event was successfully submitted. You probably want to register for the conference now!')
|
||||
else
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue