1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-19 12:00:55 +01:00

Add project tags to workboard cards

Summary: Ref T4863. Add project tags to workboard cards.

Test Plan: {F1053509}

Reviewers: joshuaspence, #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Luke081515.2, Korvin

Maniphest Tasks: T4863

Differential Revision: https://secure.phabricator.com/D14935
This commit is contained in:
Chad Little 2016-01-29 18:44:47 -08:00
parent fcf03c2dbe
commit 080d838c69
6 changed files with 36 additions and 3 deletions

View file

@ -294,6 +294,7 @@ final class ManiphestEditEngine
$column_tasks = id(new ManiphestTaskQuery())
->setViewer($viewer)
->withPHIDs($task_phids)
->needProjectPHIDs(true)
->execute();
if ($order == PhabricatorProjectColumn::ORDER_NATURAL) {
@ -333,6 +334,7 @@ final class ManiphestEditEngine
->setViewer($viewer)
->setTask($task)
->setOwner($owner)
->setProject($column->getProject())
->setCanEdit(true)
->getItem();

View file

@ -9,7 +9,7 @@ final class PHUIHandleTagListView extends AphrontTagView {
private $slim;
private $showHovercards;
public function setHandles(array $handles) {
public function setHandles($handles) {
$this->handles = $handles;
return $this;
}

View file

@ -304,6 +304,7 @@ final class PhabricatorProjectBoardViewController
$can_edit = idx($task_can_edit_map, $task->getPHID(), false);
$cards->addItem(id(new ProjectBoardTaskCard())
->setViewer($viewer)
->setProject($project)
->setTask($task)
->setOwner($owner)
->setCanEdit($can_edit)

View file

@ -26,9 +26,10 @@ final class PhabricatorProjectMoveController
return new Aphront404Response();
}
$object = id(new PhabricatorObjectQuery())
$object = id(new ManiphestTaskQuery())
->setViewer($viewer)
->withPHIDs(array($object_phid))
->needProjectPHIDs(true)
->requireCapabilities(
array(
PhabricatorPolicyCapability::CAN_VIEW,
@ -95,6 +96,7 @@ final class PhabricatorProjectMoveController
$tasks = id(new ManiphestTaskQuery())
->setViewer($viewer)
->withPHIDs($task_phids)
->needProjectPHIDs(true)
->requireCapabilities(
array(
PhabricatorPolicyCapability::CAN_VIEW,
@ -149,11 +151,13 @@ final class PhabricatorProjectMoveController
->withPHIDs(array($object->getOwnerPHID()))
->executeOne();
}
$card = id(new ProjectBoardTaskCard())
->setViewer($viewer)
->setTask($object)
->setOwner($owner)
->setCanEdit(true)
->setProject($project)
->getItem();
return id(new AphrontAjaxResponse())->setContent(

View file

@ -3,6 +3,7 @@
final class ProjectBoardTaskCard extends Phobject {
private $viewer;
private $project;
private $task;
private $owner;
private $canEdit;
@ -15,6 +16,14 @@ final class ProjectBoardTaskCard extends Phobject {
return $this->viewer;
}
public function setProject(PhabricatorProject $project) {
$this->project = $project;
return $this;
}
public function getProject() {
return $this->project;
}
public function setTask(ManiphestTask $task) {
$this->task = $task;
return $this;
@ -44,13 +53,14 @@ final class ProjectBoardTaskCard extends Phobject {
$task = $this->getTask();
$owner = $this->getOwner();
$can_edit = $this->getCanEdit();
$viewer = $this->getViewer();
$color_map = ManiphestTaskPriority::getColorMap();
$bar_color = idx($color_map, $task->getPriority(), 'grey');
$card = id(new PHUIObjectItemView())
->setObject($task)
->setUser($this->getViewer())
->setUser($viewer)
->setObjectName('T'.$task->getID())
->setHeader($task->getTitle())
->setGrippable($can_edit)
@ -73,6 +83,18 @@ final class ProjectBoardTaskCard extends Phobject {
$card->addAttribute($owner->renderLink());
}
$project_phids = array_fuse($task->getProjectPHIDs());
unset($project_phids[$this->project->getPHID()]);
$handle_list = $viewer->loadHandles($project_phids);
$tag_list = id(new PHUIHandleTagListView())
->setSlim(true)
->setHandles($handle_list);
if (!$tag_list->isEmpty()) {
$card->addAttribute($tag_list);
}
return $card;
}

View file

@ -77,6 +77,10 @@ abstract class AphrontTagView extends AphrontView {
return $this->id;
}
public function isEmpty() {
return empty($this->getTagContent());
}
protected function getTagName() {
return 'div';
}