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..b5973c012 100644 --- a/Resources/public/sass/_task.scss +++ b/Resources/public/sass/_task.scss @@ -1,12 +1,82 @@ +@import '../../../../main/Resources/public/sass/custom/config/colors'; + +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-label { + display: inline-flex; + margin-bottom: 0.2em; + font-size: 0.8em; + text-transform: capitalize; +} + +.bt-task { + display: block; + height: 0; + width: 8px; + padding-right: 3px;; +} + +.bt-task-exchange { + background: $chill-green; +} +.bt-task-exchange:hover { + background: $chill-green-dark; +} + +.bt-task-exchange::before { + @extend .bt-task; + width: 10px; + content: url(../svg/exchange-alt.svg); +} .bt-task-start::before { + @extend .bt-task; content: url(../svg/play.svg); } .bt-task-cancel::before { - content: url(../svg/times.svg); + @extend .bt-task; + content: url(../svg/archive.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; + box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2); + padding: 0.4em 0.7em; + z-index: 1; +} + +.bt-dropdown:hover .bt-dropdown-content { + display: block; } diff --git a/Resources/public/svg/archive.svg b/Resources/public/svg/archive.svg new file mode 100644 index 000000000..394dad2db --- /dev/null +++ b/Resources/public/svg/archive.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/Resources/public/svg/check.svg b/Resources/public/svg/check.svg new file mode 100644 index 000000000..2ec27cf84 --- /dev/null +++ b/Resources/public/svg/check.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/Resources/public/svg/exchange-alt.svg b/Resources/public/svg/exchange-alt.svg new file mode 100644 index 000000000..82ef60e98 --- /dev/null +++ b/Resources/public/svg/exchange-alt.svg @@ -0,0 +1,52 @@ + + + + + + image/svg+xml + + + + + + + + diff --git a/Resources/public/svg/stop.svg b/Resources/public/svg/stop.svg deleted file mode 100644 index 40338d449..000000000 --- a/Resources/public/svg/stop.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/Resources/public/svg/times.svg b/Resources/public/svg/times.svg deleted file mode 100644 index 02eef1b8f..000000000 --- a/Resources/public/svg/times.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/Resources/translations/messages.fr.yml b/Resources/translations/messages.fr.yml index 32f51b789..f9d54eb57 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,14 +39,26 @@ 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' 'in_progress': 'en cours' 'closed': 'fermée' 'canceled': 'supprimée' +start: démarrer +close: clotûrer +cancel: annuler #Flash messages 'The task is created': 'La tâche a été créée' 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..f3f5dfb3f 100644 --- a/Resources/views/SingleTask/_list.html.twig +++ b/Resources/views/SingleTask/_list.html.twig @@ -26,29 +26,25 @@ {% for place in workflow_marked_places(task) %} {{ place|trans }} {% endfor %} - - {% for transition in workflow_transitions(task) %} - {{ task_workflow_metadata(task, 'transition.verb', transition) }} - {% endfor %} {% 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 +52,16 @@