Sha256: 6a2df28d653336010a516ef6c486776f98841520897950366e3bf58c77a31f7b

Contents?: true

Size: 1.47 KB

Versions: 15

Compression:

Stored size: 1.47 KB

Contents

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

  before_action :set_lists

  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 edit
    @campaign = Ish::EmailCampaign.find params[:id]
    authorize! :edit, @campaign
  end

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

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

  def show
    @campaign = Ish::EmailCampaign.find params[:id]
    authorize! :show, @campaign
    @leads = @campaign.leads
    if params[:q].present?
      @leads = @leads.where(" email LIKE ? ", "%#{params[:q]}%" )
    end
    @leads = @leads.page( params[:leads_page ] ).per( current_profile.per_page )
  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

15 entries across 15 versions & 1 rubygems

Version Path
ish_manager-0.1.8.443 app/controllers/ish_manager/email_campaigns_controller.rb
ish_manager-0.1.8.442 app/controllers/ish_manager/email_campaigns_controller.rb
ish_manager-0.1.8.441 app/controllers/ish_manager/email_campaigns_controller.rb
ish_manager-0.1.8.440 app/controllers/ish_manager/email_campaigns_controller.rb
ish_manager-0.1.8.439 app/controllers/ish_manager/email_campaigns_controller.rb
ish_manager-0.1.8.438 app/controllers/ish_manager/email_campaigns_controller.rb
ish_manager-0.1.8.437 app/controllers/ish_manager/email_campaigns_controller.rb
ish_manager-0.1.8.436 app/controllers/ish_manager/email_campaigns_controller.rb
ish_manager-0.1.8.435 app/controllers/ish_manager/email_campaigns_controller.rb
ish_manager-0.1.8.434 app/controllers/ish_manager/email_campaigns_controller.rb
ish_manager-0.1.8.433 app/controllers/ish_manager/email_campaigns_controller.rb
ish_manager-0.1.8.432 app/controllers/ish_manager/email_campaigns_controller.rb
ish_manager-0.1.8.431 app/controllers/ish_manager/email_campaigns_controller.rb
ish_manager-0.1.8.430 app/controllers/ish_manager/email_campaigns_controller.rb
ish_manager-0.1.8.429 app/controllers/ish_manager/email_campaigns_controller.rb