How to show task status icon in project workboard?


#1

6C333C01-0ACE-449C-BF36-8B0A0D8626FC

Because there are multiple states, I want to show the status icon. Like the closed task show status icon.


#2

solved thx


#3

It will probably help others if you can share how you solved this…


#4

Edit ProjectBoardTaskCard.php

   // 总是显示状态图标
    $status_icon = ManiphestTaskStatus::getStatusIcon($task->getStatus());
    $icon = id(new PHUIIconView())
      ->setIcon($status_icon);
    if ($task->isClosed()) {
      $icon = $icon->setIcon($status_icon.' grey');
      $card->setBarColor('grey');
    }   
    $card->addAttribute($icon);

#5

If you add the priority color then it can color the icon to match how its displayed in the ManiphestViewController

    $status_icon = ManiphestTaskStatus::getStatusIcon($task->getStatus());
    $priority_color = ManiphestTaskPriority::getTaskPriorityColor($task->getPriority());

    $icon = id(new PHUIIconView());
    $icon = $icon->setIcon($status_icon." ".$priority_color);

    if ($task->isClosed()) {
      $card->setBarColor('grey');
    }
    $card->addAttribute($icon);

The diff against current master

diff --git a/src/applications/project/view/ProjectBoardTaskCard.php b/src/applications/project/view/ProjectBoardTaskCard.php
index 3a7016c..0fef50a 100644
--- a/src/applications/project/view/ProjectBoardTaskCard.php
+++ b/src/applications/project/view/ProjectBoardTaskCard.php
@@ -125,13 +125,16 @@ final class ProjectBoardTaskCard extends Phobject {
       $card->addAttribute($subtype_tag);
     }

+    $status_icon = ManiphestTaskStatus::getStatusIcon($task->getStatus());
+    $priority_color = ManiphestTaskPriority::getTaskPriorityColor($task->getPriority());
+
+    $icon = id(new PHUIIconView());
+    $icon = $icon->setIcon($status_icon." ".$priority_color);
+
     if ($task->isClosed()) {
-      $icon = ManiphestTaskStatus::getStatusIcon($task->getStatus());
-      $icon = id(new PHUIIconView())
-        ->setIcon($icon.' grey');
-      $card->addAttribute($icon);
       $card->setBarColor('grey');
     }
+    $card->addAttribute($icon);

     $project_handles = $this->getProjectHandles();