diff --git a/src/applications/phid/view/PHUIHandleTagListView.php b/src/applications/phid/view/PHUIHandleTagListView.php index baad938051..0bbfc4d249 100644 --- a/src/applications/phid/view/PHUIHandleTagListView.php +++ b/src/applications/phid/view/PHUIHandleTagListView.php @@ -1,127 +1,120 @@ handles = $handles; return $this; } public function setAnnotations(array $annotations) { $this->annotations = $annotations; return $this; } public function setLimit($limit) { $this->limit = $limit; return $this; } public function setNoDataString($no_data) { $this->noDataString = $no_data; return $this; } public function setSlim($slim) { $this->slim = true; return $this; } public function setShowHovercards($show_hovercards) { $this->showHovercards = $show_hovercards; return $this; } protected function getTagName() { return 'ul'; } protected function getTagAttributes() { return array( 'class' => 'phabricator-handle-tag-list', ); } protected function getTagContent() { $handles = $this->handles; - // Remove any archived projects from the list. - foreach ($handles as $key => $handle) { - if ($handle->getStatus() == PhabricatorObjectHandle::STATUS_CLOSED) { - unset($handles[$key]); - } - } - // If the list is empty, we may render a "No Projects" tag. if (!$handles) { if (strlen($this->noDataString)) { $no_data_tag = $this->newPlaceholderTag() ->setName($this->noDataString); return $this->newItem($no_data_tag); } } if ($this->limit) { $handles = array_slice($handles, 0, $this->limit); } $list = array(); foreach ($handles as $handle) { $tag = $handle->renderTag(); if ($this->showHovercards) { $tag->setPHID($handle->getPHID()); } if ($this->slim) { $tag->setSlimShady(true); } $list[] = $this->newItem( array( $tag, idx($this->annotations, $handle->getPHID(), null), )); } if ($this->limit) { if ($this->limit < count($this->handles)) { $tip_text = implode(', ', mpull($this->handles, 'getName')); $more = $this->newPlaceholderTag() ->setName("\xE2\x80\xA6") ->addSigil('has-tooltip') ->setMetadata( array( 'tip' => $tip_text, 'size' => 200, )); $list[] = $this->newItem($more); } } return $list; } private function newItem($content) { return phutil_tag( 'li', array( 'class' => 'phabricator-handle-tag-list-item', ), $content); } private function newPlaceholderTag() { return id(new PHUITagView()) ->setType(PHUITagView::TYPE_OBJECT) ->setShade(PHUITagView::COLOR_DISABLED) ->setSlimShady($this->slim); } } diff --git a/src/applications/project/view/ProjectBoardTaskCard.php b/src/applications/project/view/ProjectBoardTaskCard.php index 087e9c1789..7be0af2c2f 100644 --- a/src/applications/project/view/ProjectBoardTaskCard.php +++ b/src/applications/project/view/ProjectBoardTaskCard.php @@ -1,131 +1,141 @@ 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_BLUE) ->setSlimShady(true) ->setName($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) { $tag_list = id(new PHUIHandleTagListView()) ->setSlim(true) ->setHandles($project_handles); $card->addAttribute($tag_list); } $card->addClass('phui-workcard'); return $card; } }