From 543cb1c9004a8618d5e02a61f6ee28c8446a3207 Mon Sep 17 00:00:00 2001 From: epriestley Date: Fri, 20 Feb 2015 07:26:45 -0800 Subject: [PATCH] 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 --- .../query/LegalpadDocumentSearchEngine.php | 63 ++++++++++--------- 1 file changed, 35 insertions(+), 28 deletions(-) diff --git a/src/applications/legalpad/query/LegalpadDocumentSearchEngine.php b/src/applications/legalpad/query/LegalpadDocumentSearchEngine.php index ebc9cd2b03..104da068a8 100644 --- a/src/applications/legalpad/query/LegalpadDocumentSearchEngine.php +++ b/src/applications/legalpad/query/LegalpadDocumentSearchEngine.php @@ -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); }