Sha256: 9143bbef96f9cd75046e6cea81ba4789e42dd24af0196a8c8cf039021ad572a4

Contents?: true

Size: 801 Bytes

Versions: 17

Compression:

Stored size: 801 Bytes

Contents

class TasksController < ApplicationController
  before_filter :find_task

  attr_reader :task

  def update
    authorize! :update, task

    project = task.project
    effort = params[:effort]
    effort = effort.to_d if effort
    effort = nil if effort && effort <= 0
    task.updated_by = current_user
    task.update_attributes effort: effort
    render json: [], status: :ok
  end

  def complete
    authorize! :update, task

    # !todo: authorize completing a task
    task.complete! unless task.completed?
    render json: TaskPresenter.new(task)
  end

  def reopen
    authorize! :update, task

    # !todo: authorize completing a task
    task.reopen! unless task.open?
    render json: TaskPresenter.new(task)
  end

private

  def find_task
    @task = Task.find params[:id]
  end

end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
houston-core-0.8.0.pre app/controllers/tasks_controller.rb
houston-core-0.7.0 app/controllers/tasks_controller.rb
houston-core-0.7.0.beta4 app/controllers/tasks_controller.rb
houston-core-0.7.0.beta3 app/controllers/tasks_controller.rb
houston-core-0.7.0.beta2 app/controllers/tasks_controller.rb
houston-core-0.7.0.beta app/controllers/tasks_controller.rb
houston-core-0.6.3 app/controllers/tasks_controller.rb
houston-core-0.6.2 app/controllers/tasks_controller.rb
houston-core-0.6.1 app/controllers/tasks_controller.rb
houston-core-0.6.0 app/controllers/tasks_controller.rb
houston-core-0.5.6 app/controllers/tasks_controller.rb
houston-core-0.5.5 app/controllers/tasks_controller.rb
houston-core-0.5.4 app/controllers/tasks_controller.rb
houston-core-0.5.3 app/controllers/tasks_controller.rb
houston-core-0.5.2 app/controllers/tasks_controller.rb
houston-core-0.5.1 app/controllers/tasks_controller.rb
houston-core-0.5.0 app/controllers/tasks_controller.rb