@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Convert Projects to use ObjectItemList

Summary: Converts the old table to a new item list, also added ability to link icons on right side of item stack.

Test Plan: Tested adding removing, sorting of projects both active and inactive.

Reviewers: epriestley, btrahan

Reviewed By: epriestley

CC: aran, Korvin

Differential Revision: https://secure.phabricator.com/D4960

+54 -37
+12 -3
src/applications/project/constants/PhabricatorProjectStatus.php
··· 6 6 const STATUS_ARCHIVED = 100; 7 7 8 8 public static function getNameForStatus($status) { 9 - static $map = array( 10 - self::STATUS_ACTIVE => 'Active', 11 - self::STATUS_ARCHIVED => 'Archived', 9 + $map = array( 10 + self::STATUS_ACTIVE => pht('Active'), 11 + self::STATUS_ARCHIVED => pht('Archived'), 12 12 ); 13 13 14 14 return idx($map, coalesce($status, '?'), 'Unknown'); 15 + } 16 + 17 + public static function getIconForStatus($status) { 18 + $map = array( 19 + self::STATUS_ACTIVE => 'check', 20 + self::STATUS_ARCHIVED => 'disable', 21 + ); 22 + 23 + return idx($map, $status); 15 24 } 16 25 17 26 public static function getStatusMap() {
+28 -32
src/applications/project/controller/PhabricatorProjectListController.php
··· 79 79 80 80 $group = idx($groups, $phid, array()); 81 81 $task_count = count($group); 82 - 83 82 $population = count($members); 84 83 85 84 if ($profile) { ··· 89 88 $blurb = null; 90 89 } 91 90 91 + $tasks_href = pht('%d Open Task(s)', $task_count); 92 92 93 93 $rows[] = array( 94 - phutil_tag( 95 - 'a', 96 - array( 97 - 'href' => '/project/view/'.$project->getID().'/', 98 - ), 99 - $project->getName()), 94 + $project->getName(), 95 + '/project/view/'.$project->getID().'/', 100 96 PhabricatorProjectStatus::getNameForStatus($project->getStatus()), 97 + PhabricatorProjectStatus::getIconForStatus($project->getStatus()), 101 98 $blurb, 102 - $population, 99 + pht('%d Member(s)', $population), 103 100 phutil_tag( 104 101 'a', 105 102 array( 106 103 'href' => '/maniphest/view/all/?projects='.$phid, 107 104 ), 108 - $task_count), 105 + $tasks_href), 106 + '/project/edit/'.$project->getID().'/', 109 107 ); 110 108 } 111 109 112 - $table = new AphrontTableView($rows); 113 - $table->setHeaders( 114 - array( 115 - pht('Project'), 116 - pht('Status'), 117 - pht('Description'), 118 - pht('Population'), 119 - pht('Open Tasks'), 120 - )); 121 - $table->setColumnClasses( 122 - array( 123 - 'pri', 124 - '', 125 - 'wide', 126 - '', 127 - '' 128 - )); 110 + $list = new PhabricatorObjectItemListView(); 111 + $list->setStackable(); 112 + foreach ($rows as $row) { 113 + $item = id(new PhabricatorObjectItemView()) 114 + ->setHeader($row[0]) 115 + ->setHref($row[1]) 116 + ->addIcon($row[3], $row[2]) 117 + ->addIcon('edit', pht('Edit Project'), $row[7]) 118 + ->addAttribute($row[4]) 119 + ->addAttribute($row[5]) 120 + ->addAttribute($row[6]); 121 + $list->addItem($item); 122 + } 129 123 130 - $panel = new AphrontPanelView(); 131 - $panel->setHeader($table_header); 132 - $panel->appendChild($table); 133 - $panel->setNoBackground(); 134 - $panel->appendChild($pager); 124 + $header = id(new PhabricatorHeaderView()) 125 + ->setHeader($table_header); 135 126 136 - $nav->appendChild($panel); 127 + $nav->appendChild( 128 + array( 129 + $header, 130 + $list, 131 + $pager, 132 + )); 137 133 138 134 $crumbs = $this->buildApplicationCrumbs($this->buildSideNavView()); 139 135 $crumbs->addCrumb(
+14 -2
src/view/layout/PhabricatorObjectItemView.php
··· 48 48 return $this->header; 49 49 } 50 50 51 - public function addIcon($icon, $label = null) { 51 + public function addIcon($icon, $label = null, $href = null) { 52 52 $this->icons[] = array( 53 53 'icon' => $icon, 54 54 'label' => $label, 55 + 'href' => $href, 55 56 ); 56 57 return $this; 57 58 } ··· 100 101 ), 101 102 $spec['label']); 102 103 104 + 105 + if ($spec['href']) { 106 + $icon_href = phutil_tag( 107 + 'a', 108 + array('href' => $spec['href']), 109 + array($label, $icon) 110 + ); 111 + } else { 112 + $icon_href = array($label, $icon); 113 + } 114 + 103 115 $icon_list[] = phutil_tag( 104 116 'li', 105 117 array( 106 118 'class' => 'phabricator-object-item-icon', 107 119 ), 108 - array($label, $icon)); 120 + $icon_href); 109 121 } 110 122 111 123 $icons = phutil_tag(