Every campaign has an end.

Drop ahoy, because it's more trouble than it's worth. This means dropping
visits, campaigns, targets.

Campaigns are better run to analytics, such as:
* https://matomo.org/docs/tracking-campaigns/
* https://matomo.org/docs/tracking-goals-web-analytics/
* https://support.google.com/analytics/answer/1012040?hl=en
This commit is contained in:
James Mason 2018-10-08 17:58:41 -07:00 committed by Henne Vogelsang
parent 62056fc044
commit b11001cdba
47 changed files with 19 additions and 1420 deletions

View file

@ -1,56 +0,0 @@
# frozen_string_literal: true
module Admin
class CampaignsController < Admin::BaseController
load_and_authorize_resource :conference, find_by: :short_title
load_and_authorize_resource :campaign, through: :conference
def index
authorize! :index, Campaign.new(conference_id: @conference.id)
@campaigns = @conference.campaigns
end
def create
@campaign.attributes = campaign_params
if @conference.save
redirect_to admin_conference_campaigns_path(conference_id: @conference.short_title),
notice: 'Campaign successfully created.'
else
flash.now[:error] = 'Campaign creation failed. ' + @campaign.errors.full_messages.to_sentence
render action: 'new'
end
end
def new; end
def edit; end
def update
if @campaign.update_attributes(campaign_params)
redirect_to admin_conference_campaigns_path(conference_id: @conference.short_title),
notice: "Campaign '#{@campaign.name}' successfully updated."
else
flash.now[:error] = "Campaign update failed. #{@campaign.errors.full_messages.to_sentence}"
render action: 'edit'
end
end
def destroy
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),
error: "Delete of Campaign for #{@conference.short_title} failed."\
"#{@campaign.errors.full_messages.join('. ')}."
end
end
private
def campaign_params
params.require(:campaign).permit(:name, :utm_source, :utm_medium, :utm_term, :utm_content, :utm_campaign, :target_ids, :conference_id)
end
end
end

View file

@ -189,14 +189,6 @@ module Admin
@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 }
@ -225,8 +217,8 @@ module Admin
:use_vpositions, :use_vdays, :vdays_attributes,
:vpositions_attributes, :use_volunteers, :color,
:sponsorship_levels_attributes, :sponsors_attributes,
:targets, :targets_attributes,
:campaigns, :campaigns_attributes, :registration_limit, :organization_id, :ticket_layout, :booth_limit)
:registration_limit, :organization_id, :ticket_layout,
:booth_limit)
end
end
end

View file

@ -92,7 +92,6 @@ module Admin
@event.submitter = current_user
if @event.save
ahoy.track 'Event submission', title: 'New submission'
redirect_to admin_conference_program_events_path(@conference.short_title), notice: 'Event was successfully submitted.'
else
flash.now[:error] = "Could not submit proposal: #{@event.errors.full_messages.join(', ')}"

View file

@ -1,54 +0,0 @@
# frozen_string_literal: true
module Admin
class TargetsController < Admin::BaseController
load_and_authorize_resource :conference, find_by: :short_title
load_and_authorize_resource :target, through: :conference
def index; end
def new
@target = @conference.targets.new
end
def create
@target = @conference.targets.new(target_params)
if @target.save(target_params)
redirect_to admin_conference_targets_path(conference_id: @conference.short_title),
notice: 'Target successfully created.'
else
flash.now[:error] = "Creating target failed: #{@target.errors.full_messages.join('. ')}."
render :new
end
end
def edit; end
def update
if @target.update_attributes(target_params)
redirect_to admin_conference_targets_path(conference_id: @conference.short_title),
notice: 'Target successfully updated.'
else
flash.now[:error] = "Target update failed: #{@target.errors.full_messages.join('. ')}."
render :edit
end
end
def destroy
if @target.destroy
redirect_to admin_conference_targets_path(conference_id: @conference.short_title),
notice: 'Target successfully destroyed.'
else
redirect_to admin_conference_targets_path(conference_id: @conference.short_title),
error: "Could not delete target for #{@conference.title}: "\
"#{@target.errors.full_messages.join('. ')}."
end
end
private
def target_params
params.require(:target).permit(:due_date, :target_count, :unit, :conference_id)
end
end
end