improve filter form

- hide form in some places ;
- i18n
- hide status filtering with a parameter (redundant)
This commit is contained in:
2018-05-08 22:56:45 +02:00
parent 650f2c8e18
commit 69eb9648c9
8 changed files with 103 additions and 32 deletions

View File

@@ -315,15 +315,27 @@ class SingleTaskController extends Controller
public function myTasksAction()
{
return $this->redirectToRoute('chill_task_singletask_list', [
'user_id' => $this->getUser()->getId()
'user_id' => $this->getUser()->getId(),
'hide_form' => true
]);
}
/**
*
* Arguments:
* - user_id
* - scope_id
* - person_id
* - hide_form (hide the form to filter the tasks)
* - status: date state, amongst SingleTaskRepository::DATE_STATUSES, or 'closed'
*
* @Route(
* "/{_locale}/task/singletask/list",
* name="chill_task_singletask_list",
* options={ "menus": { "person" : { "order": 400, "label": "Associated tasks" } } }
* options={ "menus": {
* "person" : { "order": 400, "label": "Associated tasks" } ,
* "section": { "order": 400, "label": "Tasks", "icons": "tasks" }
* }}
* )
*/
public function listAction(
@@ -359,18 +371,21 @@ class SingleTaskController extends Controller
}
if (!empty($request->query->get('user_id', null))) {
if ($request->query->get('user_id') === '_unassigned') {
$params['unassigned'] = true;
} else {
$userId = $request->query->getInt('user_id', null);
$user = $this->getDoctrine()->getManager()
->getRepository('ChillMainBundle:User')
->find($userId);
$userId = $request->query->getInt('user_id', null);
$user = $this->getDoctrine()->getManager()
->getRepository('ChillMainBundle:User')
->find($userId);
if ($user === null) {
throw $this->createNotFoundException("This user ' $userId ' does not exist.");
}
if ($user === null) {
throw $this->createNotFoundException("This user ' $userId ' does not exist.");
$viewParams['user'] = $user;
$params['user'] = $user;
}
$viewParams['user'] = $user;
$params['user'] = $user;
}
if (!empty($request->query->get('scope_id'))) {