Sha256: 5efb1377dbf9bccfbc9e076bf743d7a8c1f94955331e3ce6cf72a47f55ffcb6e

Contents?: true

Size: 1.32 KB

Versions: 11

Compression:

Stored size: 1.32 KB

Contents

class IshManager::LeadsController < IshManager::ApplicationController

  ## alphabetized : )

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

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

  def index
    authorize! :index, Ish::Lead
    @leads = Ish::Lead.all # where( :profile => current_user.profile, :is_trash => false )
    if params[:is_done]
      @leads = @leads.where( :is_done => true )
    else
      @leads = @leads.where( :is_done => false )
    end
    render :layout => 'ish_manager/application_no_material'
  end

  def new
    @new_lead = Ish::Lead.new
    authorize! :new, @new_lead
  end

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

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

end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
ish_manager-0.1.8.315 app/controllers/ish_manager/leads_controller.rb
ish_manager-0.1.8.314 app/controllers/ish_manager/leads_controller.rb
ish_manager-0.1.8.313 app/controllers/ish_manager/leads_controller.rb
ish_manager-0.1.8.312 app/controllers/ish_manager/leads_controller.rb
ish_manager-0.1.8.311 app/controllers/ish_manager/leads_controller.rb
ish_manager-0.1.8.310 app/controllers/ish_manager/leads_controller.rb
ish_manager-0.1.8.309 app/controllers/ish_manager/leads_controller.rb
ish_manager-0.1.8.308 app/controllers/ish_manager/leads_controller.rb
ish_manager-0.1.8.307 app/controllers/ish_manager/leads_controller.rb
ish_manager-0.1.8.306 app/controllers/ish_manager/leads_controller.rb
ish_manager-0.1.8.305 app/controllers/ish_manager/leads_controller.rb