Sha256: 53d342608a0f13c24318a9f58a3af47185292df9647ccf288c067bd65c52b1fb

Contents?: true

Size: 1.67 KB

Versions: 33

Compression:

Stored size: 1.67 KB

Contents

class ::IshManager::LeadsetsController < IshManager::ApplicationController

  before_action :set_lists

  ## alphabetized : )

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

  def destroy
    leadsets = Leadset.find( params[:leadset_ids] )
    @results = []
    leadsets.each do |leadset|
      @results.push leadset.discard
    end
    flash[:notice] = "Discard outcome: #{@results.inspect}."
    redirect_to action: 'index'
  end

  def edit
    @leadset = Leadset.find params[:id]
    authorize! :edit, @leadset
  end

  def index
    authorize! :index, Leadset
    @leadsets = Leadset.all.kept # where( :profile => @current_profile, :is_trash => false )
  end

  def new
    @new_leadset = Leadset.new
    authorize! :new, @new_leadset
  end

  def show
    authorize! :redirect, IshManager::Ability
    redirect_to :action => :edit, :id => params[:id]
  end

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

  ##
  ## private
  ##
  private

  def set_lists
    super
    @tags_list = WpTag.all.map { |t| [ t.name, t.id ] }
    @leads_list = Lead.all.map { |lead| [ lead.email, lead.id ] }
    @templates_list = Ish::EmailTemplate.all.map { |t| [ t.slug, t.id ] }
  end

end

Version data entries

33 entries across 33 versions & 1 rubygems

Version Path
ish_manager-0.1.8.425 app/controllers/ish_manager/leadsets_controller.rb
ish_manager-0.1.8.424 app/controllers/ish_manager/leadsets_controller.rb
ish_manager-0.1.8.423 app/controllers/ish_manager/leadsets_controller.rb
ish_manager-0.1.8.422 app/controllers/ish_manager/leadsets_controller.rb
ish_manager-0.1.8.421 app/controllers/ish_manager/leadsets_controller.rb
ish_manager-0.1.8.420 app/controllers/ish_manager/leadsets_controller.rb
ish_manager-0.1.8.419 app/controllers/ish_manager/leadsets_controller.rb
ish_manager-0.1.8.418 app/controllers/ish_manager/leadsets_controller.rb
ish_manager-0.1.8.417 app/controllers/ish_manager/leadsets_controller.rb
ish_manager-0.1.8.416 app/controllers/ish_manager/leadsets_controller.rb
ish_manager-0.1.8.415 app/controllers/ish_manager/leadsets_controller.rb
ish_manager-0.1.8.414 app/controllers/ish_manager/leadsets_controller.rb
ish_manager-0.1.8.413 app/controllers/ish_manager/leadsets_controller.rb
ish_manager-0.1.8.412 app/controllers/ish_manager/leadsets_controller.rb
ish_manager-0.1.8.411 app/controllers/ish_manager/leadsets_controller.rb
ish_manager-0.1.8.410 app/controllers/ish_manager/leadsets_controller.rb
ish_manager-0.1.8.409 app/controllers/ish_manager/leadsets_controller.rb
ish_manager-0.1.8.408 app/controllers/ish_manager/leadsets_controller.rb
ish_manager-0.1.8.407 app/controllers/ish_manager/leadsets_controller.rb
ish_manager-0.1.8.406 app/controllers/ish_manager/leadsets_controller.rb