Show open tasks on project pages
Summary: This is pretty basic but gets us most of the way there I think. Could use some style tweaks at some point. Test Plan: Looked at a project page with open tasks, and one without open tasks. Reviewed By: tuomaspelkonen Reviewers: cadamo, aran, jungejason, tuomaspelkonen CC: aran, tuomaspelkonen, epriestley Differential Revision: 609
This commit is contained in:
@@ -182,6 +182,52 @@ class PhabricatorProjectProfileController
|
||||
'</div>
|
||||
</div>';
|
||||
|
||||
$query = id(new ManiphestTaskQuery())
|
||||
->withProjects(array($project->getPHID()))
|
||||
->withStatus(ManiphestTaskQuery::STATUS_OPEN)
|
||||
->setOrderBy(ManiphestTaskQuery::ORDER_PRIORITY)
|
||||
->setLimit(10)
|
||||
->setCalculateRows(true);
|
||||
$tasks = $query->execute();
|
||||
$count = $query->getRowCount();
|
||||
|
||||
$task_views = array();
|
||||
foreach ($tasks as $task) {
|
||||
$view = id(new ManiphestTaskSummaryView())
|
||||
->setTask($task)
|
||||
->setHandles($handles)
|
||||
->setUser($this->getRequest()->getUser());
|
||||
$task_views[] = $view->render();
|
||||
}
|
||||
|
||||
if (empty($tasks)) {
|
||||
$task_views = '<em>No open tasks.</em>';
|
||||
} else {
|
||||
$task_views = implode('', $task_views);
|
||||
}
|
||||
|
||||
$open = number_format($count);
|
||||
|
||||
$more_link = phutil_render_tag(
|
||||
'a',
|
||||
array(
|
||||
'href' => '/maniphest/view/all/?projects='.$project->getPHID(),
|
||||
),
|
||||
"View All Open Tasks \xC2\xBB");
|
||||
|
||||
$content .=
|
||||
'<div class="phabricator-profile-info-group">
|
||||
<h1 class="phabricator-profile-info-header">'.
|
||||
"Open Tasks ({$open})".
|
||||
'</h1>'.
|
||||
'<div class="phabricator-profile-info-pane">'.
|
||||
$task_views.
|
||||
'<div class="phabricator-profile-info-pane-more-link">'.
|
||||
$more_link.
|
||||
'</div>'.
|
||||
'</div>
|
||||
</div>';
|
||||
|
||||
return $content;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
phutil_require_module('phabricator', 'aphront/response/404');
|
||||
phutil_require_module('phabricator', 'applications/differential/parser/markup');
|
||||
phutil_require_module('phabricator', 'applications/files/uri');
|
||||
phutil_require_module('phabricator', 'applications/maniphest/query');
|
||||
phutil_require_module('phabricator', 'applications/maniphest/view/tasksummary');
|
||||
phutil_require_module('phabricator', 'applications/phid/handle/data');
|
||||
phutil_require_module('phabricator', 'applications/project/constants/status');
|
||||
phutil_require_module('phabricator', 'applications/project/controller/base');
|
||||
|
||||
@@ -95,3 +95,10 @@ img.phabricator-profile-image {
|
||||
width: 280px;
|
||||
margin: 10px;
|
||||
}
|
||||
|
||||
.phabricator-profile-info-pane-more-link {
|
||||
text-align: right;
|
||||
padding: .25em;
|
||||
font-weight: bold;
|
||||
margin: .5em 1em 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user