From e98e1f2698aaad3987b5e53312d3096be2857b75 Mon Sep 17 00:00:00 2001 From: afornerot Date: Fri, 12 Apr 2024 20:27:25 +0200 Subject: [PATCH] color priority --- src/Controller/ScrumController.php | 11 +++++++++++ src/Entity/Scrumissue.php | 17 +++++++++++++++++ templates/Scrum/view.html.twig | 9 +++++++-- 3 files changed, 35 insertions(+), 2 deletions(-) diff --git a/src/Controller/ScrumController.php b/src/Controller/ScrumController.php index 0399796..98f0739 100755 --- a/src/Controller/ScrumController.php +++ b/src/Controller/ScrumController.php @@ -187,6 +187,16 @@ class ScrumController extends AbstractController // Mise à jour des issues par rapport à gitea $em->getRepository("App:Scrum")->getGitea($data,$giteaassignees,$giteacolumns,$giteamilestones,$giteateams,$giteaprioritys,$giteatypes,$gitealabels,$forcereload); + + // default color priority + $prioritycolor="#70c24a"; + if(is_array($giteaprioritys)) { + + $priority=$em->getRepository("App:Scrumpriority")->findOneBy(["scrum"=>$data,"giteaid"=>$giteaprioritys[array_key_last($giteaprioritys)]]); + if($priority) { + $prioritycolor="#".$priority->getGiteajson()["color"]; + } + } // Création du tableau des issues $issues=$data->getScrumissues(); @@ -404,6 +414,7 @@ class ScrumController extends AbstractController 'sprints' => $data->getScrumsprintstosee($viewclosed), 'giteateams' => $giteateams, 'giteaprioritys' => $giteaprioritys, + 'prioritycolor' => $prioritycolor, 'giteatypes' => $giteatypes, 'gitealabels' => $gitealabels, 'viewcondensed' => $viewcondensed, diff --git a/src/Entity/Scrumissue.php b/src/Entity/Scrumissue.php index 2ef309e..fb46756 100644 --- a/src/Entity/Scrumissue.php +++ b/src/Entity/Scrumissue.php @@ -33,6 +33,11 @@ class Scrumissue */ private $weight=0; + /** + * @ORM\Column(type="string", nullable=true) + */ + private $color; + /** * @ORM\Column(type="integer") */ @@ -332,4 +337,16 @@ class Scrumissue return $this; } + + public function getColor(): ?string + { + return $this->color; + } + + public function setColor(?string $color): self + { + $this->color = $color; + + return $this; + } } \ No newline at end of file diff --git a/templates/Scrum/view.html.twig b/templates/Scrum/view.html.twig index 7656b5c..af07d07 100644 --- a/templates/Scrum/view.html.twig +++ b/templates/Scrum/view.html.twig @@ -195,6 +195,7 @@ {% set datateams="" %} {% set datatypes="" %} {% set dataprioritys="datapriority"~giteaprioritys|last %} + {% set issuprioritycolor=prioritycolor %} {% for label in issue.giteajson.labels %} {% if label.id not in giteacolumns and label.id in giteateams %} {% set datateams=datateams~"datateam"~label.id~" " %} @@ -206,6 +207,7 @@ {% if label.id not in giteacolumns and label.id in giteaprioritys %} {% set dataprioritys="datapriority"~label.id~" " %} + {% set issuprioritycolor="#"~label.color %} {% endif %} {% if label.id not in giteacolumns and label.id not in giteateams and label.id not in giteatypes and label.id not in giteaprioritys %} @@ -218,7 +220,7 @@ {% set dataassignees=dataassignees~"dataassignee"~assignee.id~" " %} {% endfor %} -
+