Page MenuHomePhabricator

D9002.id.diff
No OneTemporary

D9002.id.diff

Index: src/applications/project/controller/PhabricatorProjectProfileController.php
===================================================================
--- src/applications/project/controller/PhabricatorProjectProfileController.php
+++ src/applications/project/controller/PhabricatorProjectProfileController.php
@@ -43,9 +43,11 @@
$stories = $query->execute();
$feed = $this->renderStories($stories);
+ $repos = $this->renderRepositoriesPage($project);
+
$content = phutil_tag_div(
'phabricator-project-layout',
- array($tasks, $feed));
+ array($tasks, $feed, $repos));
$id = $this->id;
$icon = id(new PHUIIconView())
@@ -121,6 +123,68 @@
$view->render());
}
+ private function renderRepositoriesPage(PhabricatorProject $project) {
+ $user = $this->getRequest()->getUser();
+
+ $query = id(new PhabricatorRepositoryQuery())
+ ->setViewer($user)
+ ->withAnyProjects(array($project->getPHID()))
+ ->setOrder(PhabricatorRepositoryQuery::ORDER_NAME)
+ ->needCommitCounts(true)
+ ;
+ $repos = $query->execute();
+
+ $list = new PHUIObjectItemListView();
+ $list->setCards(true);
+ foreach ($repos as $repository) {
+ $repository_uri = DiffusionRequest::generateDiffusionURI(
+ array(
+ 'callsign' => $repository->getCallsign(),
+ 'action' => 'branch',
+ ));
+ $item = id(new PHUIObjectItemView())
+ ->setUser($user)
+ ->setHeader($repository->getName())
+ ->setObjectName('r'.$repository->getCallsign())
+ ->setHref($repository_uri)
+ ;
+ $item->addIcon('none', PhabricatorRepositoryType::getNameForRepositoryType($repository->getVersionControlSystem()));
+
+ $size = $repository->getCommitCount();
+ if ($size) {
+ $history_uri = DiffusionRequest::generateDiffusionURI(
+ array(
+ 'callsign' => $repository->getCallsign(),
+ 'action' => 'history',
+ ));
+ $item->addAttribute(
+ phutil_tag(
+ 'a',
+ array(
+ 'href' => $history_uri,
+ ),
+ pht('%s Commit(s)', new PhutilNumber($size))));
+ } else {
+ $item->addAttribute(pht('No Commits'));
+ }
+
+ if (!$repository->isTracked()) {
+ $item->setDisabled(true);
+ $item->addIcon('disable-grey', pht('Inactive'));
+ }
+
+ $list->addItem($item);
+ }
+
+ $header = id(new PHUIHeaderView())
+ ->setHeader(pht('Repositories'));
+
+ $content = id(new PHUIObjectBoxView())
+ ->setHeader($header)
+ ->appendChild($list);
+
+ return $content;
+ }
private function renderTasksPage(PhabricatorProject $project) {

File Metadata

Mime Type
text/plain
Expires
Sun, Mar 16, 8:48 PM (2 w, 4 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7383849
Default Alt Text
D9002.id.diff (2 KB)

Event Timeline