From f5b09cf42e0241e6c35e2a5e0f033305afb25e65 Mon Sep 17 00:00:00 2001 From: nobohan Date: Mon, 30 Apr 2018 14:53:57 +0200 Subject: [PATCH] front-end/design single tasks --- Controller/SingleTaskController.php | 39 +++++++------ Resources/public/sass/_task.scss | 66 +++++++++++++++++++++- Resources/translations/messages.fr.yml | 19 +++++-- Resources/translations/validators.fr.yml | 3 +- Resources/views/SingleTask/_list.html.twig | 18 ++++-- Resources/views/SingleTask/show.html.twig | 48 ++++++++++++---- 6 files changed, 151 insertions(+), 42 deletions(-) diff --git a/Controller/SingleTaskController.php b/Controller/SingleTaskController.php index 26ee96df4..d5a460432 100644 --- a/Controller/SingleTaskController.php +++ b/Controller/SingleTaskController.php @@ -33,26 +33,29 @@ class SingleTaskController extends Controller public function newAction(Request $request) { - $personId = $request->query->getInt('person_id', null); + $task = (new SingleTask()) + ->setAssignee($this->getUser()) + ->setType('task_default') + ; - if ($personId === null) { - return new Response("You must provide a person_id", Response::HTTP_BAD_REQUEST); + if ($request->query->has('person_id')) { + $personId = $request->query->getInt('person_id', null); + + if ($personId === null) { + return new Response("You must provide a person_id", Response::HTTP_BAD_REQUEST); + } + + $person = $this->getDoctrine()->getManager() + ->getRepository(Person::class) + ->find($personId); + + if ($person === null) { + $this->createNotFoundException("Invalid person id"); + } + + $task->setPerson($person); } - $person = $this->getDoctrine()->getManager() - ->getRepository(Person::class) - ->find($personId); - - if ($person === null) { - $this->createNotFoundException("Invalid person id"); - } - - $task = (new SingleTask()) - ->setAssignee($this->getUser()) - ->setPerson($person) - ->setType('task_default') - ; - $this->denyAccessUnlessGranted(TaskVoter::CREATE, $task, 'You are not ' . 'allowed to create this task'); @@ -69,7 +72,7 @@ class SingleTaskController extends Controller $this->addFlash('success', "The task is created"); - return $this->redirectToRoute('chill_task_task_list_by_person', [ + return $this->redirectToRoute('chill_task_singletask_list', [ 'person_id' => $task->getPerson()->getId() ]); diff --git a/Resources/public/sass/_task.scss b/Resources/public/sass/_task.scss index 0f800f792..bdd71e2a1 100644 --- a/Resources/public/sass/_task.scss +++ b/Resources/public/sass/_task.scss @@ -1,12 +1,72 @@ -.bt-task-start::before { - content: url(../svg/play.svg); + +div#single_task_warningInterval { + display: flex; + flex-direction: row; + justify-content: flex-end; + div.container { + display: flex; + flex-direction: row; + justify-content: flex-end; + & > div:first-child { + display:none; /* Hide the label container */ + } + & > div { + padding-right: 0; + width: 7em; + } + input[type="text"] { + height: 35px; + } + } +} + +.bt-task { + display: block; + height: 12px; + width: 12px; + font-size: 0.8em; +} + +.bt-task-exchange { + @extend .bt-task; + &::before { + content: url(../svg/exchange-alt.svg); + } +} + +.bt-task-start { + @extend .bt-task; + &::before { + content: url(../svg/play.svg); + } } .bt-task-cancel::before { + @extend .bt-task; content: url(../svg/times.svg); } .bt-task-close::before { - content: url(../svg/stop.svg); + @extend .bt-task; + content: url(../svg/check.svg); +} + +.bt-dropdown { + position: relative; + display: inline-block; +} + +.bt-dropdown-content { + display: none; + position: absolute; + background-color: #f9f9f9; + min-width: 160px; + box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2); + padding: 12px 16px; + z-index: 1; +} + +.bt-dropdown:hover .bt-dropdown-content { + display: block; } diff --git a/Resources/translations/messages.fr.yml b/Resources/translations/messages.fr.yml index 32f51b789..bad2028fb 100644 --- a/Resources/translations/messages.fr.yml +++ b/Resources/translations/messages.fr.yml @@ -26,9 +26,9 @@ User: Utilisateur 'Task start date': 'Date de début' 'Task warning date': "Date d'avertissement" 'Task end date': "Date d'échéance" -'Start: ': 'Début: ' -'Warning: ': 'Avertissement: ' -'End: ': 'Échéance: ' +'Start': 'Début: ' +'Warning': 'Avertissement: ' +'End': 'Échéance: ' 'Task type': 'Type' 'Task status': 'Statut' 'Edit the task': 'Éditer la tâche' @@ -39,8 +39,17 @@ User: Utilisateur 'Remove task': 'Supprimer la tâche' 'Are you sure you want to remove the task about "%name%" ?': 'Êtes-vous sûr·e de vouloir supprimer la tâche de "%name%"?' 'See more': 'Voir plus' -Associated tasks: Tâches associées -My tasks: Mes tâches +'Associated tasks': 'Tâches associées' +'My tasks': 'Mes tâches' +'No description': 'Pas de description' +'No dates specified': 'Dates non spécifiées' +'No one assignee': 'Aucune personne assignée' +Days: Jour(s) +Weeks: Semaine(s) +Months: Mois +Year: Année(s) + + # transitions 'new': 'nouvelle' diff --git a/Resources/translations/validators.fr.yml b/Resources/translations/validators.fr.yml index c6c444163..daf6ffe54 100644 --- a/Resources/translations/validators.fr.yml +++ b/Resources/translations/validators.fr.yml @@ -1 +1,2 @@ -The start date must be before the end date: La date de début doit être avant la date de fin \ No newline at end of file +The start date must be before the end date: La date de début doit être avant la date de fin +This form contains errors: Le formulaire contient des erreurs diff --git a/Resources/views/SingleTask/_list.html.twig b/Resources/views/SingleTask/_list.html.twig index dfd766369..fbb2052e5 100644 --- a/Resources/views/SingleTask/_list.html.twig +++ b/Resources/views/SingleTask/_list.html.twig @@ -33,22 +33,22 @@ {% if task.startDate is null and task.warningDate is null and task.endDate is null %} - {{'Unknown dates'|trans}} + {{'No dates specified'|trans}} {% else %} @@ -56,6 +56,16 @@