diff --git a/src/applications/maniphest/view/ManiphestTaskListView.php b/src/applications/maniphest/view/ManiphestTaskListView.php index 5c01a2d9fb..6f714d0c5c 100644 --- a/src/applications/maniphest/view/ManiphestTaskListView.php +++ b/src/applications/maniphest/view/ManiphestTaskListView.php @@ -1,157 +1,157 @@ tasks = $tasks; return $this; } public function setHandles(array $handles) { assert_instances_of($handles, 'PhabricatorObjectHandle'); $this->handles = $handles; return $this; } public function setShowBatchControls($show_batch_controls) { $this->showBatchControls = $show_batch_controls; return $this; } public function setShowSubpriorityControls($show_subpriority_controls) { $this->showSubpriorityControls = $show_subpriority_controls; return $this; } public function setNoDataString($text) { $this->noDataString = $text; return $this; } public function render() { $handles = $this->handles; require_celerity_resource('maniphest-task-summary-css'); $list = new PHUIObjectItemListView(); if ($this->noDataString) { $list->setNoDataString($this->noDataString); } else { $list->setNoDataString(pht('No tasks.')); } $status_map = ManiphestTaskStatus::getTaskStatusMap(); $color_map = ManiphestTaskPriority::getColorMap(); $priority_map = ManiphestTaskPriority::getTaskPriorityMap(); if ($this->showBatchControls) { Javelin::initBehavior('maniphest-list-editor'); } foreach ($this->tasks as $task) { $item = id(new PHUIObjectItemView()) ->setUser($this->getUser()) ->setObject($task) ->setObjectName('T'.$task->getID()) ->setHeader($task->getTitle()) ->setHref('/T'.$task->getID()); if ($task->getOwnerPHID()) { $owner = $handles[$task->getOwnerPHID()]; $item->addByline(pht('Assigned: %s', $owner->renderLink())); } $status = $task->getStatus(); $pri = idx($priority_map, $task->getPriority()); $status_name = idx($status_map, $task->getStatus()); $tooltip = pht('%s, %s', $status_name, $pri); $icon = ManiphestTaskStatus::getStatusIcon($task->getStatus()); $color = idx($color_map, $task->getPriority(), 'grey'); if ($task->isClosed()) { $item->setDisabled(true); $color = 'grey'; } $item->setStatusIcon($icon.' '.$color, $tooltip); $item->addIcon( 'none', phabricator_datetime($task->getDateModified(), $this->getUser())); if ($this->showSubpriorityControls) { $item->setGrippable(true); } if ($this->showSubpriorityControls || $this->showBatchControls) { $item->addSigil('maniphest-task'); } $project_handles = array_select_keys( $handles, - $task->getProjectPHIDs()); + array_reverse($task->getProjectPHIDs())); $item->addAttribute( id(new PHUIHandleTagListView()) ->setLimit(4) ->setNoDataString(pht('No Projects')) ->setSlim(true) ->setHandles($project_handles)); $item->setMetadata( array( 'taskID' => $task->getID(), )); if ($this->showBatchControls) { $href = new PhutilURI('/maniphest/task/edit/'.$task->getID().'/'); if (!$this->showSubpriorityControls) { $href->setQueryParam('ungrippable', 'true'); } $item->addAction( id(new PHUIListItemView()) ->setIcon('fa-pencil') ->addSigil('maniphest-edit-task') ->setHref($href)); } $list->addItem($item); } return $list; } public static function loadTaskHandles( PhabricatorUser $viewer, array $tasks) { assert_instances_of($tasks, 'ManiphestTask'); $phids = array(); foreach ($tasks as $task) { $assigned_phid = $task->getOwnerPHID(); if ($assigned_phid) { $phids[] = $assigned_phid; } foreach ($task->getProjectPHIDs() as $project_phid) { $phids[] = $project_phid; } } if (!$phids) { return array(); } return id(new PhabricatorHandleQuery()) ->setViewer($viewer) ->withPHIDs($phids) ->execute(); } } diff --git a/src/applications/project/view/ProjectBoardTaskCard.php b/src/applications/project/view/ProjectBoardTaskCard.php index a7ee93dd76..ba5213a623 100644 --- a/src/applications/project/view/ProjectBoardTaskCard.php +++ b/src/applications/project/view/ProjectBoardTaskCard.php @@ -1,142 +1,143 @@ viewer = $viewer; return $this; } public function getViewer() { return $this->viewer; } public function setProjectHandles(array $handles) { $this->projectHandles = $handles; return $this; } public function getProjectHandles() { return $this->projectHandles; } public function setCoverImageFile(PhabricatorFile $cover_image_file) { $this->coverImageFile = $cover_image_file; return $this; } public function getCoverImageFile() { return $this->coverImageFile; } public function setTask(ManiphestTask $task) { $this->task = $task; return $this; } public function getTask() { return $this->task; } public function setOwner(PhabricatorObjectHandle $owner = null) { $this->owner = $owner; return $this; } public function getOwner() { return $this->owner; } public function setCanEdit($can_edit) { $this->canEdit = $can_edit; return $this; } public function getCanEdit() { return $this->canEdit; } public function getItem() { $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($viewer) ->setObjectName('T'.$task->getID()) ->setHeader($task->getTitle()) ->setGrippable($can_edit) ->setHref('/T'.$task->getID()) ->addSigil('project-card') ->setDisabled($task->isClosed()) ->addAction( id(new PHUIListItemView()) ->setName(pht('Edit')) ->setIcon('fa-pencil') ->addSigil('edit-project-card') ->setHref('/maniphest/task/edit/'.$task->getID().'/')) ->setBarColor($bar_color); if ($owner) { $card->addHandleIcon($owner, $owner->getName()); } $cover_file = $this->getCoverImageFile(); if ($cover_file) { $card->setCoverImage($cover_file->getBestURI()); } if (ManiphestTaskPoints::getIsEnabled()) { $points = $task->getPoints(); if ($points !== null) { $points_tag = id(new PHUITagView()) ->setType(PHUITagView::TYPE_SHADE) ->setShade(PHUITagView::COLOR_GREY) ->setSlimShady(true) ->setName($points) ->addClass('phui-workcard-points'); $card->addAttribute($points_tag); } } if ($task->isClosed()) { $icon = ManiphestTaskStatus::getStatusIcon($task->getStatus()); $icon = id(new PHUIIconView()) ->setIcon($icon.' grey'); $card->addAttribute($icon); $card->setBarColor('grey'); } $project_handles = $this->getProjectHandles(); // Remove any archived projects from the list. if ($project_handles) { foreach ($project_handles as $key => $handle) { if ($handle->getStatus() == PhabricatorObjectHandle::STATUS_CLOSED) { unset($project_handles[$key]); } } } if ($project_handles) { + $project_handles = array_reverse($project_handles); $tag_list = id(new PHUIHandleTagListView()) ->setSlim(true) ->setHandles($project_handles); $card->addAttribute($tag_list); } $card->addClass('phui-workcard'); return $card; } }