Skip to content

Commit

Permalink
Merge pull request #1 from johnpmitsch/task_details_page
Browse files Browse the repository at this point in the history
Refs #12654 - Fixes task details page
  • Loading branch information
cpeters committed Dec 9, 2015
2 parents 7f621e0 + c7e42a0 commit 79a0e2c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 5 additions & 1 deletion app/controllers/foreman_tasks/api/tasks_controller.rb
Expand Up @@ -29,7 +29,7 @@ class TasksController < ::Api::V2::BaseController
class BadRequest < Apipie::ParamError
end

before_filter :find_resource, :only => [:show]
before_filter :find_task, :only => [:show]

api :GET, "/tasks/summary", "Show task summary"
def summary
Expand Down Expand Up @@ -259,6 +259,10 @@ def task_hash(task)

private

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

def resource_scope(options = {})
@resource_scope ||= ForemanTasks::Task.authorized("#{action_permission}_foreman_tasks")
end
Expand Down
4 changes: 2 additions & 2 deletions app/controllers/foreman_tasks/tasks_controller.rb
Expand Up @@ -5,7 +5,7 @@ class TasksController < ::ApplicationController
before_filter :restrict_dangerous_actions, :only => [:unlock, :force_unlock]

def show
@task = find_resource
@task = Task.find(params[:id])
end

def index
Expand All @@ -14,7 +14,7 @@ def index
end

def sub_tasks
task = find_resource
task = Task.find(params[:id])
@tasks = filter(task.sub_tasks)
render :index
end
Expand Down

0 comments on commit 79a0e2c

Please sign in to comment.