1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2025-01-25 14:08:19 +01:00

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
This commit is contained in:
epriestley 2014-06-28 16:36:52 -07:00
parent d8bba221b5
commit 8887febd84

View file

@ -110,55 +110,98 @@ final class LegalpadDocumentSignatureSearchEngine
$viewer = $this->requireViewer(); $viewer = $this->requireViewer();
$list = new PHUIObjectItemListView(); Javelin::initBehavior('phabricator-tooltips');
$list->setUser($viewer);
$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) { foreach ($signatures as $signature) {
$created = phabricator_date($signature->getDateCreated(), $viewer);
$data = $signature->getSignatureData(); $data = $signature->getSignatureData();
$name = idx($data, 'name');
$email = idx($data, 'email');
$sig_data = phutil_tag( $document = $signature->getDocument();
'div',
array(), if (!$signature->isVerified()) {
array( $sig_icon = $sig_unverified;
phutil_tag( } else if ($signature->getDocumentVersion() != $document->getVersions()) {
'div', $sig_icon = $sig_old;
array(), } else {
$sig_icon = $sig_good;
}
$rows[] = array(
$sig_icon,
$handles[$signature->getSignerPHID()]->renderLink(),
$name,
phutil_tag( phutil_tag(
'a', 'a',
array( array(
'href' => 'mailto:'.$data['email'], 'href' => 'mailto:'.$email,
), ),
$data['email'])), $email),
phabricator_datetime($signature->getDateCreated(), $viewer),
);
}
$table = id(new AphrontTableView($rows))
->setHeaders(
array(
'',
pht('Account'),
pht('Name'),
pht('Email'),
pht('Signed'),
))
->setColumnClasses(
array(
'',
'',
'',
'wide',
'right',
)); ));
$item = id(new PHUIObjectItemView()) $box = id(new PHUIObjectBoxView())
->setObject($signature) ->setHeaderText(pht('Signatures'))
->setHeader($data['name']) ->appendChild($table);
->setSubhead($sig_data)
->addIcon('none', pht('Signed %s', $created));
$good_sig = true; return $box;
if (!$signature->isVerified()) {
$item->addFootIcon('disable', 'Unverified Email');
$good_sig = false;
} }
$document = $signature->getDocument(); private function renderIcon($icon, $color, $title) {
if ($signature->getDocumentVersion() != $document->getVersions()) { Javelin::initBehavior('phabricator-tooltips');
$item->addFootIcon('delete', 'Stale Signature');
$good_sig = false;
}
if ($good_sig) { return array(
$item->setBarColor('green'); id(new PHUIIconView())
} ->setIconFont($icon, $color)
->addSigil('has-tooltip')
$list->addItem($item); ->setMetadata(array('tip' => $title)),
} javelin_tag(
'span',
return $list; array(
'aural' => true,
),
$title),
);
} }
} }