diff --git a/src/applications/project/constants/PhabricatorProjectStatus.php b/src/applications/project/constants/PhabricatorProjectStatus.php index 1b46c39f9d..3fc02e2683 100644 --- a/src/applications/project/constants/PhabricatorProjectStatus.php +++ b/src/applications/project/constants/PhabricatorProjectStatus.php @@ -6,14 +6,23 @@ final class PhabricatorProjectStatus { const STATUS_ARCHIVED = 100; public static function getNameForStatus($status) { - static $map = array( - self::STATUS_ACTIVE => 'Active', - self::STATUS_ARCHIVED => 'Archived', + $map = array( + self::STATUS_ACTIVE => pht('Active'), + self::STATUS_ARCHIVED => pht('Archived'), ); return idx($map, coalesce($status, '?'), 'Unknown'); } + public static function getIconForStatus($status) { + $map = array( + self::STATUS_ACTIVE => 'check', + self::STATUS_ARCHIVED => 'disable', + ); + + return idx($map, $status); + } + public static function getStatusMap() { return array( self::STATUS_ACTIVE => 'Active', diff --git a/src/applications/project/controller/PhabricatorProjectListController.php b/src/applications/project/controller/PhabricatorProjectListController.php index ffcd020baa..ce4a53e98c 100644 --- a/src/applications/project/controller/PhabricatorProjectListController.php +++ b/src/applications/project/controller/PhabricatorProjectListController.php @@ -79,7 +79,6 @@ final class PhabricatorProjectListController $group = idx($groups, $phid, array()); $task_count = count($group); - $population = count($members); if ($profile) { @@ -89,51 +88,48 @@ final class PhabricatorProjectListController $blurb = null; } + $tasks_href = pht('%d Open Task(s)', $task_count); $rows[] = array( - phutil_tag( - 'a', - array( - 'href' => '/project/view/'.$project->getID().'/', - ), - $project->getName()), + $project->getName(), + '/project/view/'.$project->getID().'/', PhabricatorProjectStatus::getNameForStatus($project->getStatus()), + PhabricatorProjectStatus::getIconForStatus($project->getStatus()), $blurb, - $population, + pht('%d Member(s)', $population), phutil_tag( 'a', array( 'href' => '/maniphest/view/all/?projects='.$phid, ), - $task_count), + $tasks_href), + '/project/edit/'.$project->getID().'/', ); } - $table = new AphrontTableView($rows); - $table->setHeaders( - array( - pht('Project'), - pht('Status'), - pht('Description'), - pht('Population'), - pht('Open Tasks'), - )); - $table->setColumnClasses( - array( - 'pri', - '', - 'wide', - '', - '' - )); + $list = new PhabricatorObjectItemListView(); + $list->setStackable(); + foreach ($rows as $row) { + $item = id(new PhabricatorObjectItemView()) + ->setHeader($row[0]) + ->setHref($row[1]) + ->addIcon($row[3], $row[2]) + ->addIcon('edit', pht('Edit Project'), $row[7]) + ->addAttribute($row[4]) + ->addAttribute($row[5]) + ->addAttribute($row[6]); + $list->addItem($item); + } - $panel = new AphrontPanelView(); - $panel->setHeader($table_header); - $panel->appendChild($table); - $panel->setNoBackground(); - $panel->appendChild($pager); + $header = id(new PhabricatorHeaderView()) + ->setHeader($table_header); - $nav->appendChild($panel); + $nav->appendChild( + array( + $header, + $list, + $pager, + )); $crumbs = $this->buildApplicationCrumbs($this->buildSideNavView()); $crumbs->addCrumb( diff --git a/src/view/layout/PhabricatorObjectItemView.php b/src/view/layout/PhabricatorObjectItemView.php index 09b9c16f88..374a183248 100644 --- a/src/view/layout/PhabricatorObjectItemView.php +++ b/src/view/layout/PhabricatorObjectItemView.php @@ -48,10 +48,11 @@ final class PhabricatorObjectItemView extends AphrontView { return $this->header; } - public function addIcon($icon, $label = null) { + public function addIcon($icon, $label = null, $href = null) { $this->icons[] = array( 'icon' => $icon, 'label' => $label, + 'href' => $href, ); return $this; } @@ -100,12 +101,23 @@ final class PhabricatorObjectItemView extends AphrontView { ), $spec['label']); + + if ($spec['href']) { + $icon_href = phutil_tag( + 'a', + array('href' => $spec['href']), + array($label, $icon) + ); + } else { + $icon_href = array($label, $icon); + } + $icon_list[] = phutil_tag( 'li', array( 'class' => 'phabricator-object-item-icon', ), - array($label, $icon)); + $icon_href); } $icons = phutil_tag(