add list by person, user and scope + formatting of submit button in edit

This commit is contained in:
nobohan
2018-04-26 21:54:49 +02:00
parent 4b391d03d5
commit bf0db0de3f
7 changed files with 243 additions and 130 deletions

View File

@@ -16,12 +16,12 @@ class TaskController extends Controller
{
/**
* Apply a transition to a task
*
*
* @Route(
* "/{_locale}/task/transition/{kind}/{taskId}/{transition}",
* name="chill_task_task_transition"
* )
*
*
* @param string $kind
* @param int $taskId
* @param string $transition
@@ -32,7 +32,7 @@ class TaskController extends Controller
* @return Response
*/
public function applyTransitionAction(
$kind,
$kind,
$taskId,
$transition,
SingleTaskRepository $singleTaskRepository,
@@ -51,32 +51,32 @@ class TaskController extends Controller
);
break;
default:
return new Response("The type '$kind' is not implemented",
return new Response("The type '$kind' is not implemented",
Response::HTTP_BAD_REQUEST);
}
if (NULL === $task) {
$this->createHttpNotFoundException("task with id '$taskId' and type "
$this->createNotFoundException("task with id '$taskId' and type "
. "'$type' does not exists");
}
// we simply check that the user can see the task. Other ACL checks
// should be performed using `guard` events.
$this->denyAccessUnlessGranted(TaskVoter::SHOW, $task);
$workflow = $registry->get($task);
if ($workflow->can($task, $transition)) {
$workflow->apply($task, $transition);
$em->flush();
$this->addFlash('success', 'The transition is sucessfully appliyed');
} else {
$this->addFlash('error', 'The transition could not be appliyed');
}
return $this->redirect($request->query->get('return_path', $defaultReturnPath));
}
}