From 8887febd84598e5a55dec3fc3350d8c6860b4b3b Mon Sep 17 00:00:00 2001 From: epriestley Date: Sat, 28 Jun 2014 16:36:52 -0700 Subject: [PATCH] Show signatures in a table instead of an object list Summary: Ref T3116. Since this UI was written we've moved away from footer icons and made tables work better on mobile. This seems reasonable to use a pure table for. I've also reduced the number of required fields here. Use a table and make this UI accessible. The "Restricted External Account" stuff is T3732, which I'll tackle next. Test Plan: {F171584} Reviewers: chad Reviewed By: chad Subscribers: epriestley Maniphest Tasks: T3116 Differential Revision: https://secure.phabricator.com/D9766 --- .../LegalpadDocumentSignatureSearchEngine.php | 123 ++++++++++++------ 1 file changed, 83 insertions(+), 40 deletions(-) diff --git a/src/applications/legalpad/query/LegalpadDocumentSignatureSearchEngine.php b/src/applications/legalpad/query/LegalpadDocumentSignatureSearchEngine.php index c46af12ade..b75fe0c649 100644 --- a/src/applications/legalpad/query/LegalpadDocumentSignatureSearchEngine.php +++ b/src/applications/legalpad/query/LegalpadDocumentSignatureSearchEngine.php @@ -110,55 +110,98 @@ final class LegalpadDocumentSignatureSearchEngine $viewer = $this->requireViewer(); - $list = new PHUIObjectItemListView(); - $list->setUser($viewer); + Javelin::initBehavior('phabricator-tooltips'); + $sig_good = $this->renderIcon( + 'fa-check', + null, + pht('Verified, Current')); + + $sig_old = $this->renderIcon( + 'fa-clock-o', + 'orange', + pht('Signed Older Version')); + + $sig_unverified = $this->renderIcon( + 'fa-envelope', + 'red', + pht('Unverified Email')); + + id(new PHUIIconView()) + ->setIconFont('fa-envelope', 'red') + ->addSigil('has-tooltip') + ->setMetadata(array('tip' => pht('Unverified Email'))); + + $rows = array(); foreach ($signatures as $signature) { - $created = phabricator_date($signature->getDateCreated(), $viewer); - $data = $signature->getSignatureData(); - - $sig_data = phutil_tag( - 'div', - array(), - array( - phutil_tag( - 'div', - array(), - phutil_tag( - 'a', - array( - 'href' => 'mailto:'.$data['email'], - ), - $data['email'])), - )); - - $item = id(new PHUIObjectItemView()) - ->setObject($signature) - ->setHeader($data['name']) - ->setSubhead($sig_data) - ->addIcon('none', pht('Signed %s', $created)); - - $good_sig = true; - if (!$signature->isVerified()) { - $item->addFootIcon('disable', 'Unverified Email'); - $good_sig = false; - } + $name = idx($data, 'name'); + $email = idx($data, 'email'); $document = $signature->getDocument(); - if ($signature->getDocumentVersion() != $document->getVersions()) { - $item->addFootIcon('delete', 'Stale Signature'); - $good_sig = false; + + if (!$signature->isVerified()) { + $sig_icon = $sig_unverified; + } else if ($signature->getDocumentVersion() != $document->getVersions()) { + $sig_icon = $sig_old; + } else { + $sig_icon = $sig_good; } - if ($good_sig) { - $item->setBarColor('green'); - } - - $list->addItem($item); + $rows[] = array( + $sig_icon, + $handles[$signature->getSignerPHID()]->renderLink(), + $name, + phutil_tag( + 'a', + array( + 'href' => 'mailto:'.$email, + ), + $email), + phabricator_datetime($signature->getDateCreated(), $viewer), + ); } - return $list; + $table = id(new AphrontTableView($rows)) + ->setHeaders( + array( + '', + pht('Account'), + pht('Name'), + pht('Email'), + pht('Signed'), + )) + ->setColumnClasses( + array( + '', + '', + '', + 'wide', + 'right', + )); + + $box = id(new PHUIObjectBoxView()) + ->setHeaderText(pht('Signatures')) + ->appendChild($table); + + return $box; + } + + private function renderIcon($icon, $color, $title) { + Javelin::initBehavior('phabricator-tooltips'); + + return array( + id(new PHUIIconView()) + ->setIconFont($icon, $color) + ->addSigil('has-tooltip') + ->setMetadata(array('tip' => $title)), + javelin_tag( + 'span', + array( + 'aural' => true, + ), + $title), + ); } }