From b530a4d8ff9f40ef86115fa2697ae8d0907979f1 Mon Sep 17 00:00:00 2001 From: afornerot Date: Fri, 12 Apr 2024 21:56:11 +0200 Subject: [PATCH] color --- config/routes.yaml | 4 ++++ src/Controller/ScrumissueController.php | 18 +++++++++++++++- templates/Scrum/view.html.twig | 28 +++++++++++++++++++++++-- 3 files changed, 47 insertions(+), 3 deletions(-) diff --git a/config/routes.yaml b/config/routes.yaml index 83a423b..57c57bd 100644 --- a/config/routes.yaml +++ b/config/routes.yaml @@ -346,6 +346,10 @@ app_scrumissue_unblock: path: /user/scrumissue/unblock defaults: { _controller: App\Controller\ScrumissueController:unblock } +app_scrumissue_color: + path: /user/scrumissue/color + defaults: { _controller: App\Controller\ScrumissueController:color } + app_scrumissue_ctrlchange: path: /user/scrumissue/ctrlchange defaults: { _controller: App\Controller\ScrumissueController:ctrlchange } diff --git a/src/Controller/ScrumissueController.php b/src/Controller/ScrumissueController.php index 60ad378..c174ce3 100755 --- a/src/Controller/ScrumissueController.php +++ b/src/Controller/ScrumissueController.php @@ -250,7 +250,7 @@ class ScrumissueController extends AbstractController // Bloquer l'issue $response=$this->giteaservice->postIssueblocks($scrumissue->getScrum()->getGiteajson()["owner"]["login"],$scrumissue->getScrum()->getGiteajson()["name"],$scrumissue->getGiteanumber(),$issueblocked); - dump($response); + if(!$response) return new JsonResponse(['message' => 'Error api'], 403); return new JsonResponse([]); @@ -275,6 +275,22 @@ class ScrumissueController extends AbstractController return new JsonResponse([]); } + public function color(Request $request) + { + $em = $this->getDoctrine()->getManager(); + + $id=$request->get('id'); + $color=$request->get('color'); + + // Rechercher l'issue en cours + $scrumissue=$em->getRepository("App:Scrumissue")->find($id); + if(!$scrumissue) return new JsonResponse(['message' => 'No Issue'], 403); + $scrumissue->setColor($color); + $em->flush(); + + return new JsonResponse([]); + } + public function ctrlchange(Request $request) { $em = $this->getDoctrine()->getManager(); diff --git a/templates/Scrum/view.html.twig b/templates/Scrum/view.html.twig index 8e652ea..37d4cb0 100644 --- a/templates/Scrum/view.html.twig +++ b/templates/Scrum/view.html.twig @@ -220,8 +220,15 @@ {% set dataassignees=dataassignees~"dataassignee"~assignee.id~" " %} {% endfor %} + {% set backcolor="" %} + {% if not issue.color is empty %} + {% set backcolor="background-color:"~issue.color~";" %} + {% elseif issue.scrumissueblock and not issue.scrumissueblock.color is empty %} + {% set backcolor="background-color:"~issue.scrumissueblock.color~";" %} + {% endif %} +
-