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:
parent
fcf03c2dbe
commit
080d838c69
6 changed files with 36 additions and 3 deletions
|
@ -294,6 +294,7 @@ final class ManiphestEditEngine
|
||||||
$column_tasks = id(new ManiphestTaskQuery())
|
$column_tasks = id(new ManiphestTaskQuery())
|
||||||
->setViewer($viewer)
|
->setViewer($viewer)
|
||||||
->withPHIDs($task_phids)
|
->withPHIDs($task_phids)
|
||||||
|
->needProjectPHIDs(true)
|
||||||
->execute();
|
->execute();
|
||||||
|
|
||||||
if ($order == PhabricatorProjectColumn::ORDER_NATURAL) {
|
if ($order == PhabricatorProjectColumn::ORDER_NATURAL) {
|
||||||
|
@ -333,6 +334,7 @@ final class ManiphestEditEngine
|
||||||
->setViewer($viewer)
|
->setViewer($viewer)
|
||||||
->setTask($task)
|
->setTask($task)
|
||||||
->setOwner($owner)
|
->setOwner($owner)
|
||||||
|
->setProject($column->getProject())
|
||||||
->setCanEdit(true)
|
->setCanEdit(true)
|
||||||
->getItem();
|
->getItem();
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ final class PHUIHandleTagListView extends AphrontTagView {
|
||||||
private $slim;
|
private $slim;
|
||||||
private $showHovercards;
|
private $showHovercards;
|
||||||
|
|
||||||
public function setHandles(array $handles) {
|
public function setHandles($handles) {
|
||||||
$this->handles = $handles;
|
$this->handles = $handles;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
|
@ -304,6 +304,7 @@ final class PhabricatorProjectBoardViewController
|
||||||
$can_edit = idx($task_can_edit_map, $task->getPHID(), false);
|
$can_edit = idx($task_can_edit_map, $task->getPHID(), false);
|
||||||
$cards->addItem(id(new ProjectBoardTaskCard())
|
$cards->addItem(id(new ProjectBoardTaskCard())
|
||||||
->setViewer($viewer)
|
->setViewer($viewer)
|
||||||
|
->setProject($project)
|
||||||
->setTask($task)
|
->setTask($task)
|
||||||
->setOwner($owner)
|
->setOwner($owner)
|
||||||
->setCanEdit($can_edit)
|
->setCanEdit($can_edit)
|
||||||
|
|
|
@ -26,9 +26,10 @@ final class PhabricatorProjectMoveController
|
||||||
return new Aphront404Response();
|
return new Aphront404Response();
|
||||||
}
|
}
|
||||||
|
|
||||||
$object = id(new PhabricatorObjectQuery())
|
$object = id(new ManiphestTaskQuery())
|
||||||
->setViewer($viewer)
|
->setViewer($viewer)
|
||||||
->withPHIDs(array($object_phid))
|
->withPHIDs(array($object_phid))
|
||||||
|
->needProjectPHIDs(true)
|
||||||
->requireCapabilities(
|
->requireCapabilities(
|
||||||
array(
|
array(
|
||||||
PhabricatorPolicyCapability::CAN_VIEW,
|
PhabricatorPolicyCapability::CAN_VIEW,
|
||||||
|
@ -95,6 +96,7 @@ final class PhabricatorProjectMoveController
|
||||||
$tasks = id(new ManiphestTaskQuery())
|
$tasks = id(new ManiphestTaskQuery())
|
||||||
->setViewer($viewer)
|
->setViewer($viewer)
|
||||||
->withPHIDs($task_phids)
|
->withPHIDs($task_phids)
|
||||||
|
->needProjectPHIDs(true)
|
||||||
->requireCapabilities(
|
->requireCapabilities(
|
||||||
array(
|
array(
|
||||||
PhabricatorPolicyCapability::CAN_VIEW,
|
PhabricatorPolicyCapability::CAN_VIEW,
|
||||||
|
@ -149,11 +151,13 @@ final class PhabricatorProjectMoveController
|
||||||
->withPHIDs(array($object->getOwnerPHID()))
|
->withPHIDs(array($object->getOwnerPHID()))
|
||||||
->executeOne();
|
->executeOne();
|
||||||
}
|
}
|
||||||
|
|
||||||
$card = id(new ProjectBoardTaskCard())
|
$card = id(new ProjectBoardTaskCard())
|
||||||
->setViewer($viewer)
|
->setViewer($viewer)
|
||||||
->setTask($object)
|
->setTask($object)
|
||||||
->setOwner($owner)
|
->setOwner($owner)
|
||||||
->setCanEdit(true)
|
->setCanEdit(true)
|
||||||
|
->setProject($project)
|
||||||
->getItem();
|
->getItem();
|
||||||
|
|
||||||
return id(new AphrontAjaxResponse())->setContent(
|
return id(new AphrontAjaxResponse())->setContent(
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
final class ProjectBoardTaskCard extends Phobject {
|
final class ProjectBoardTaskCard extends Phobject {
|
||||||
|
|
||||||
private $viewer;
|
private $viewer;
|
||||||
|
private $project;
|
||||||
private $task;
|
private $task;
|
||||||
private $owner;
|
private $owner;
|
||||||
private $canEdit;
|
private $canEdit;
|
||||||
|
@ -15,6 +16,14 @@ final class ProjectBoardTaskCard extends Phobject {
|
||||||
return $this->viewer;
|
return $this->viewer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function setProject(PhabricatorProject $project) {
|
||||||
|
$this->project = $project;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
public function getProject() {
|
||||||
|
return $this->project;
|
||||||
|
}
|
||||||
|
|
||||||
public function setTask(ManiphestTask $task) {
|
public function setTask(ManiphestTask $task) {
|
||||||
$this->task = $task;
|
$this->task = $task;
|
||||||
return $this;
|
return $this;
|
||||||
|
@ -44,13 +53,14 @@ final class ProjectBoardTaskCard extends Phobject {
|
||||||
$task = $this->getTask();
|
$task = $this->getTask();
|
||||||
$owner = $this->getOwner();
|
$owner = $this->getOwner();
|
||||||
$can_edit = $this->getCanEdit();
|
$can_edit = $this->getCanEdit();
|
||||||
|
$viewer = $this->getViewer();
|
||||||
|
|
||||||
$color_map = ManiphestTaskPriority::getColorMap();
|
$color_map = ManiphestTaskPriority::getColorMap();
|
||||||
$bar_color = idx($color_map, $task->getPriority(), 'grey');
|
$bar_color = idx($color_map, $task->getPriority(), 'grey');
|
||||||
|
|
||||||
$card = id(new PHUIObjectItemView())
|
$card = id(new PHUIObjectItemView())
|
||||||
->setObject($task)
|
->setObject($task)
|
||||||
->setUser($this->getViewer())
|
->setUser($viewer)
|
||||||
->setObjectName('T'.$task->getID())
|
->setObjectName('T'.$task->getID())
|
||||||
->setHeader($task->getTitle())
|
->setHeader($task->getTitle())
|
||||||
->setGrippable($can_edit)
|
->setGrippable($can_edit)
|
||||||
|
@ -73,6 +83,18 @@ final class ProjectBoardTaskCard extends Phobject {
|
||||||
$card->addAttribute($owner->renderLink());
|
$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;
|
return $card;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -77,6 +77,10 @@ abstract class AphrontTagView extends AphrontView {
|
||||||
return $this->id;
|
return $this->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function isEmpty() {
|
||||||
|
return empty($this->getTagContent());
|
||||||
|
}
|
||||||
|
|
||||||
protected function getTagName() {
|
protected function getTagName() {
|
||||||
return 'div';
|
return 'div';
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue