mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-21 04:50:55 +01:00
Pimping PhrictionListController
Summary: - adding dust - updating filters, removing stubs and moved - adding Project of a doc Test Plan: saw them Reviewers: epriestley, chad, btrahan CC: aran, Korvin Maniphest Tasks: T2686 Differential Revision: https://secure.phabricator.com/D5284
This commit is contained in:
parent
eb010b2efc
commit
45a49b99a9
1 changed files with 53 additions and 1 deletions
|
@ -78,15 +78,54 @@ final class PhrictionListController
|
||||||
|
|
||||||
$rows = array();
|
$rows = array();
|
||||||
foreach ($documents as $document) {
|
foreach ($documents as $document) {
|
||||||
|
$project_link = 'None';
|
||||||
|
if ($document->hasProject()) {
|
||||||
|
$project_phid = $document->getProject()->getPHID();
|
||||||
|
$project_link = $handles[$project_phid]->renderLink();
|
||||||
|
}
|
||||||
|
|
||||||
$content = $document->getContent();
|
$content = $document->getContent();
|
||||||
|
|
||||||
|
$change_type = null;
|
||||||
|
if ($this->view == 'updates') {
|
||||||
|
$change_type = $content->getChangeType();
|
||||||
|
switch ($content->getChangeType()) {
|
||||||
|
case PhrictionChangeType::CHANGE_DELETE:
|
||||||
|
case PhrictionChangeType::CHANGE_EDIT:
|
||||||
|
$change_type = PhrictionChangeType::getChangeTypeLabel(
|
||||||
|
$change_type);
|
||||||
|
break;
|
||||||
|
case PhrictionChangeType::CHANGE_MOVE_HERE:
|
||||||
|
case PhrictionChangeType::CHANGE_MOVE_AWAY:
|
||||||
|
$change_ref = $content->getChangeRef();
|
||||||
|
$ref_doc = $documents[$change_ref];
|
||||||
|
$ref_doc_slug = PhrictionDocument::getSlugURI(
|
||||||
|
$ref_doc->getSlug());
|
||||||
|
$ref_doc_link = hsprintf('<br /><a href="%s">%s</a>', $ref_doc_slug,
|
||||||
|
phutil_utf8_shorten($ref_doc_slug, 15));
|
||||||
|
|
||||||
|
if ($change_type == PhrictionChangeType::CHANGE_MOVE_HERE) {
|
||||||
|
$change_type = pht('Moved from %s', $ref_doc_link);
|
||||||
|
} else {
|
||||||
|
$change_type = pht('Moved to %s', $ref_doc_link);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
throw new Exception("Unknown change type!");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$rows[] = array(
|
$rows[] = array(
|
||||||
$handles[$content->getAuthorPHID()]->renderLink(),
|
$handles[$content->getAuthorPHID()]->renderLink(),
|
||||||
|
$change_type,
|
||||||
phutil_tag(
|
phutil_tag(
|
||||||
'a',
|
'a',
|
||||||
array(
|
array(
|
||||||
'href' => PhrictionDocument::getSlugURI($document->getSlug()),
|
'href' => PhrictionDocument::getSlugURI($document->getSlug()),
|
||||||
),
|
),
|
||||||
$content->getTitle()),
|
$content->getTitle()),
|
||||||
|
$project_link,
|
||||||
phabricator_date($content->getDateCreated(), $user),
|
phabricator_date($content->getDateCreated(), $user),
|
||||||
phabricator_time($content->getDateCreated(), $user),
|
phabricator_time($content->getDateCreated(), $user),
|
||||||
);
|
);
|
||||||
|
@ -96,20 +135,32 @@ final class PhrictionListController
|
||||||
$document_table->setHeaders(
|
$document_table->setHeaders(
|
||||||
array(
|
array(
|
||||||
pht('Last Editor'),
|
pht('Last Editor'),
|
||||||
|
pht('Change Type'),
|
||||||
pht('Title'),
|
pht('Title'),
|
||||||
|
pht('Project'),
|
||||||
pht('Last Update'),
|
pht('Last Update'),
|
||||||
pht('Time'),
|
pht('Time'),
|
||||||
));
|
));
|
||||||
|
|
||||||
$document_table->setColumnClasses(
|
$document_table->setColumnClasses(
|
||||||
array(
|
array(
|
||||||
|
'',
|
||||||
'',
|
'',
|
||||||
'wide pri',
|
'wide pri',
|
||||||
|
'',
|
||||||
'right',
|
'right',
|
||||||
'right',
|
'right',
|
||||||
));
|
));
|
||||||
|
|
||||||
$view_header = $views[$this->view];
|
$document_table->setColumnVisibility(
|
||||||
|
array(
|
||||||
|
true,
|
||||||
|
$this->view == 'updates',
|
||||||
|
true,
|
||||||
|
true,
|
||||||
|
true,
|
||||||
|
true,
|
||||||
|
));
|
||||||
|
|
||||||
$panel = new AphrontPanelView();
|
$panel = new AphrontPanelView();
|
||||||
$panel->setNoBackground();
|
$panel->setNoBackground();
|
||||||
|
@ -122,6 +173,7 @@ final class PhrictionListController
|
||||||
$nav,
|
$nav,
|
||||||
array(
|
array(
|
||||||
'title' => pht('Phriction Main'),
|
'title' => pht('Phriction Main'),
|
||||||
|
'dust' => true,
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue