1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-10 08:52:39 +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();
$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),
);
}
}