1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-20 05:42:40 +01:00

Make legalpad document list a little nicer for unsignable documents

Summary:
This just cleans things up a little:

  - Don't show signature status if the document isn't signable.
  - Show "Not Signable" instead of "No One" to make the meaning more clear in this context, where we don't have a "Who should sign:" sort of cue.

Test Plan: {F310538}

Reviewers: btrahan, chad

Reviewed By: chad

Subscribers: epriestley

Differential Revision: https://secure.phabricator.com/D11834
This commit is contained in:
epriestley 2015-02-20 07:26:45 -08:00
parent 9c23a74fb7
commit 543cb1c900

View file

@ -168,42 +168,49 @@ final class LegalpadDocumentSearchEngine
$title = $document->getTitle();
$type_name = $document->getSignatureTypeName();
$type_icon = $document->getSignatureTypeIcon();
$item = id(new PHUIObjectItemView())
->setObjectName($document->getMonogram())
->setHeader($title)
->setHref('/'.$document->getMonogram())
->setObject($document)
->addIcon($type_icon, $type_name)
->addIcon(
'fa-pencil grey',
pht('Version %d (%s)', $document->getVersions(), $last_updated));
->setObject($document);
if ($viewer->getPHID()) {
$signature = $document->getUserSignature($viewer->getPHID());
$no_signatures = LegalpadDocument::SIGNATURE_TYPE_NONE;
if ($document->getSignatureType() == $no_signatures) {
$item->addIcon('none', pht('Not Signable'));
} else {
$signature = null;
$type_name = $document->getSignatureTypeName();
$type_icon = $document->getSignatureTypeIcon();
$item->addIcon($type_icon, $type_name);
if ($viewer->getPHID()) {
$signature = $document->getUserSignature($viewer->getPHID());
} else {
$signature = null;
}
if ($signature) {
$item->addAttribute(
array(
id(new PHUIIconView())->setIconFont('fa-check-square-o', 'green'),
' ',
pht(
'Signed on %s',
phabricator_date($signature->getDateCreated(), $viewer)),
));
} else {
$item->addAttribute(
array(
id(new PHUIIconView())->setIconFont('fa-square-o', 'grey'),
' ',
pht('Not Signed'),
));
}
}
if ($signature) {
$item->addAttribute(
array(
id(new PHUIIconView())->setIconFont('fa-check-square-o', 'green'),
' ',
pht(
'Signed on %s',
phabricator_date($signature->getDateCreated(), $viewer)),
));
} else {
$item->addAttribute(
array(
id(new PHUIIconView())->setIconFont('fa-square-o', 'grey'),
' ',
pht('Not Signed'),
));
}
$item->addIcon(
'fa-pencil grey',
pht('Version %d (%s)', $document->getVersions(), $last_updated));
$list->addItem($item);
}