Sha256: f27f8b41815223ffe4cf9132b6baf7ae8be5c58042317b27d5eabf212e886cd7

Contents?: true

Size: 1.27 KB

Versions: 12

Compression:

Stored size: 1.27 KB

Contents

class ::IshManager::EmailCampaignsController < IshManager::ApplicationController

  before_action :set_lists

  def index
    authorize! :index, Ish::EmailCampaign
    @campaigns = Ish::EmailCampaign.all
  end

  def new
    @campaign = Ish::EmailCampaign.new
    authorize! :new, @campaign
  end

  def create
    @campaign = Ish::EmailCampaign.new params[:campaign].permit!
    authorize! :create, @campaign
    if @campaign.save
      flash[:notice] = "created campaign"
    else
      flash[:alert] = "Cannot create campaign: #{@campaign.errors.messages}"
    end
    redirect_to :action => 'index'
  end

  def do_send
    @campaign = Ish::EmailCampaign.find params[:id]
    authorize! :send, @campaign
    @campaign.do_send
  end

  def show
    @campaign = Ish::EmailCampaign.find params[:id]
    authorize! :show, @campaign
  end

  def edit
    @campaign = Ish::EmailCampaign.find params[:id]
    authorize! :edit, @campaign
  end

  def update
    @campaign = Ish::EmailCampaign.find params[:id]
    authorize! :update, @campaign
    if @campaign.update_attributes params[:campaign].permit!
      flash[:notice] = 'Successfully updated campaign.'
    else
      flash[:alert] = "Cannot update campaign: #{@campaign.errors.messages}"
    end
    redirect_to :action => 'index'
  end

end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
ish_manager-0.1.8.425 app/controllers/ish_manager/email_campaigns_controller.rb
ish_manager-0.1.8.424 app/controllers/ish_manager/email_campaigns_controller.rb
ish_manager-0.1.8.423 app/controllers/ish_manager/email_campaigns_controller.rb
ish_manager-0.1.8.422 app/controllers/ish_manager/email_campaigns_controller.rb
ish_manager-0.1.8.421 app/controllers/ish_manager/email_campaigns_controller.rb
ish_manager-0.1.8.420 app/controllers/ish_manager/email_campaigns_controller.rb
ish_manager-0.1.8.419 app/controllers/ish_manager/email_campaigns_controller.rb
ish_manager-0.1.8.418 app/controllers/ish_manager/email_campaigns_controller.rb
ish_manager-0.1.8.417 app/controllers/ish_manager/email_campaigns_controller.rb
ish_manager-0.1.8.416 app/controllers/ish_manager/email_campaigns_controller.rb
ish_manager-0.1.8.415 app/controllers/ish_manager/email_campaigns_controller.rb
ish_manager-0.1.8.414 app/controllers/ish_manager/email_campaigns_controller.rb