Sha256: 3856b2b8ca8a451b1678a70fd6e56ea43b4ddf5266039f492e1e8b4d6952a8c6

Contents?: true

Size: 918 Bytes

Versions: 32

Compression:

Stored size: 918 Bytes

Contents

class AssignmentsController < ArtfullyOseController
  def new
    @order = Order.find(params[:order_id])
    if is_search(params)
      @people = Person.search_index(params[:search].dup, current_user.current_organization)
    else
      @people = Person.recent(current_user.current_organization)
    end
    @people = @people.paginate(:page => params[:page], :per_page => 20)
  end
  
  def create
    @person = Person.find(params[:person_id])
    @order = Order.find(params[:order_id])
    if @order.assign_person(@person)
      flash[:success] = "Order #{@order.id} was successfully assigned to #{@person}."
      redirect_to order_path(@order)
    else
      flash[:error] = "Sorry, but we couldn't assign this order. Contact support if you think this is an error."
      redirect_to new_order_assignment_path(@order)
    end
  end

  private    
    def is_search(params)
      params[:commit].present?
    end
end

Version data entries

32 entries across 32 versions & 1 rubygems

Version Path
artfully_ose-1.2.0.pre.11 app/controllers/assignments_controller.rb
artfully_ose-1.2.0.pre.10 app/controllers/assignments_controller.rb
artfully_ose-1.2.0.pre.9 app/controllers/assignments_controller.rb
artfully_ose-1.2.0.pre.8 app/controllers/assignments_controller.rb
artfully_ose-1.2.0.pre.7 app/controllers/assignments_controller.rb
artfully_ose-1.2.0.pre.6 app/controllers/assignments_controller.rb
artfully_ose-1.2.0.pre.5 app/controllers/assignments_controller.rb
artfully_ose-1.2.0.pre.4 app/controllers/assignments_controller.rb
artfully_ose-1.2.0.pre.3 app/controllers/assignments_controller.rb
artfully_ose-1.2.0.pre.2 app/controllers/assignments_controller.rb
artfully_ose-1.2.0.pre.1 app/controllers/assignments_controller.rb
artfully_ose-1.2.0.pre app/controllers/assignments_controller.rb