mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-10 00:42:41 +01:00
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:
parent
81e3ec5998
commit
30dbdf322d
3 changed files with 116 additions and 61 deletions
|
@ -111,76 +111,122 @@ class PhabricatorProjectProfileController
|
|||
$profile->getBlurb(),
|
||||
'//Nothing is known about this elusive project.//');
|
||||
|
||||
$factory = new DifferentialMarkupEngineFactory();
|
||||
$engine = $factory->newDifferentialCommentMarkupEngine();
|
||||
$blurb = $engine->markupText($blurb);
|
||||
$factory = new DifferentialMarkupEngineFactory();
|
||||
$engine = $factory->newDifferentialCommentMarkupEngine();
|
||||
$blurb = $engine->markupText($blurb);
|
||||
|
||||
$affiliations = $project->loadAffiliations();
|
||||
$affiliations = $project->loadAffiliations();
|
||||
|
||||
$phids = array_merge(
|
||||
array($project->getAuthorPHID()),
|
||||
mpull($affiliations, 'getUserPHID'));
|
||||
$handles = id(new PhabricatorObjectHandleData($phids))
|
||||
->loadHandles();
|
||||
$phids = array_merge(
|
||||
array($project->getAuthorPHID()),
|
||||
mpull($affiliations, 'getUserPHID'));
|
||||
$handles = id(new PhabricatorObjectHandleData($phids))
|
||||
->loadHandles();
|
||||
|
||||
$affiliated = array();
|
||||
foreach ($affiliations as $affiliation) {
|
||||
$user = $handles[$affiliation->getUserPHID()]->renderLink();
|
||||
$role = phutil_escape_html($affiliation->getRole());
|
||||
$affiliated = array();
|
||||
foreach ($affiliations as $affiliation) {
|
||||
$user = $handles[$affiliation->getUserPHID()]->renderLink();
|
||||
$role = phutil_escape_html($affiliation->getRole());
|
||||
|
||||
$status = null;
|
||||
if ($affiliation->getStatus() == 'former') {
|
||||
$role = '<em>Former '.$role.'</em>';
|
||||
}
|
||||
$status = null;
|
||||
if ($affiliation->getStatus() == 'former') {
|
||||
$role = '<em>Former '.$role.'</em>';
|
||||
}
|
||||
|
||||
$affiliated[] = '<li>'.$user.' — '.$role.$status.'</li>';
|
||||
}
|
||||
if ($affiliated) {
|
||||
$affiliated = '<ul>'.implode("\n", $affiliated).'</ul>';
|
||||
} else {
|
||||
$affiliated = '<p><em>No one is affiliated with this project.</em></p>';
|
||||
}
|
||||
$affiliated[] = '<li>'.$user.' — '.$role.$status.'</li>';
|
||||
}
|
||||
if ($affiliated) {
|
||||
$affiliated = '<ul>'.implode("\n", $affiliated).'</ul>';
|
||||
} else {
|
||||
$affiliated = '<p><em>No one is affiliated with this project.</em></p>';
|
||||
}
|
||||
|
||||
$timestamp = phabricator_format_timestamp($project->getDateCreated());
|
||||
$status = PhabricatorProjectStatus::getNameForStatus(
|
||||
$project->getStatus());
|
||||
$timestamp = phabricator_format_timestamp($project->getDateCreated());
|
||||
$status = PhabricatorProjectStatus::getNameForStatus(
|
||||
$project->getStatus());
|
||||
|
||||
$content =
|
||||
'<div class="phabricator-profile-info-group">
|
||||
<h1 class="phabricator-profile-info-header">Basic Information</h1>
|
||||
<div class="phabricator-profile-info-pane">
|
||||
<table class="phabricator-profile-info-table">
|
||||
<tr>
|
||||
<th>Creator</th>
|
||||
<td>'.$handles[$project->getAuthorPHID()]->renderLink().'</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Status</th>
|
||||
<td><strong>'.phutil_escape_html($status).'</strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Created</th>
|
||||
<td>'.$timestamp.'</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>PHID</th>
|
||||
<td>'.phutil_escape_html($project->getPHID()).'</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Blurb</th>
|
||||
<td>'.$blurb.'</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>';
|
||||
$content =
|
||||
'<div class="phabricator-profile-info-group">
|
||||
<h1 class="phabricator-profile-info-header">Basic Information</h1>
|
||||
<div class="phabricator-profile-info-pane">
|
||||
<table class="phabricator-profile-info-table">
|
||||
<tr>
|
||||
<th>Creator</th>
|
||||
<td>'.$handles[$project->getAuthorPHID()]->renderLink().'</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Status</th>
|
||||
<td><strong>'.phutil_escape_html($status).'</strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Created</th>
|
||||
<td>'.$timestamp.'</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>PHID</th>
|
||||
<td>'.phutil_escape_html($project->getPHID()).'</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Blurb</th>
|
||||
<td>'.$blurb.'</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>';
|
||||
|
||||
$content .=
|
||||
'<div class="phabricator-profile-info-group">
|
||||
<h1 class="phabricator-profile-info-header">Resources</h1>
|
||||
<div class="phabricator-profile-info-pane">'.
|
||||
$content .=
|
||||
'<div class="phabricator-profile-info-group">
|
||||
<h1 class="phabricator-profile-info-header">Resources</h1>
|
||||
<div class="phabricator-profile-info-pane">'.
|
||||
$affiliated.
|
||||
'</div>
|
||||
</div>';
|
||||
'</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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue