1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-30 02:32:42 +01:00

Clean up legalpad sign UI

Summary: Moves stuff to ObjectBox, Error UI

Test Plan: Signed Document, Missed a Form Field, Resigned Form Document. Fixes T4037

Reviewers: epriestley, btrahan

Reviewed By: epriestley

CC: Korvin, epriestley, aran

Differential Revision: https://secure.phabricator.com/D7463
This commit is contained in:
Chad Little 2013-10-30 15:50:46 -07:00
parent 5ef4954a36
commit edd8bea85b
3 changed files with 57 additions and 82 deletions

View file

@ -2981,15 +2981,6 @@ celerity_register_resource_map(array(
), ),
'disk' => '/rsrc/externals/javelin/lib/Workflow.js', 'disk' => '/rsrc/externals/javelin/lib/Workflow.js',
), ),
'legalpad-documentbody-css' =>
array(
'uri' => '/res/034c3494/rsrc/css/application/legalpad/legalpad-documentbody.css',
'type' => 'css',
'requires' =>
array(
),
'disk' => '/rsrc/css/application/legalpad/legalpad-documentbody.css',
),
'lightbox-attachment-css' => 'lightbox-attachment-css' =>
array( array(
'uri' => '/res/4657e15d/rsrc/css/aphront/lightbox-attachment.css', 'uri' => '/res/4657e15d/rsrc/css/aphront/lightbox-attachment.css',

View file

@ -47,7 +47,8 @@ final class LegalpadDocumentSignController extends LegalpadController {
$has_signed = true; $has_signed = true;
$error_view = id(new AphrontErrorView()) $error_view = id(new AphrontErrorView())
->setSeverity(AphrontErrorView::SEVERITY_NOTICE) ->setSeverity(AphrontErrorView::SEVERITY_NOTICE)
->setTitle(pht('You have already agreed to these terms.')); ->setTitle(pht('Already Signed'))
->appendChild(pht('Thank you for signing and agreeing'));
$data = $signature->getSignatureData(); $data = $signature->getSignatureData();
} }
@ -101,7 +102,8 @@ final class LegalpadDocumentSignController extends LegalpadController {
$has_signed = true; $has_signed = true;
$error_view = id(new AphrontErrorView()) $error_view = id(new AphrontErrorView())
->setSeverity(AphrontErrorView::SEVERITY_NOTICE) ->setSeverity(AphrontErrorView::SEVERITY_NOTICE)
->setTitle(pht('Signature successful. Thank you.')); ->setTitle(pht('Signature successful'))
->appendChild(pht('Thank you for signing and agreeing'));
} else { } else {
$error_view = id(new AphrontErrorView()) $error_view = id(new AphrontErrorView())
->setTitle(pht('Error in submission.')) ->setTitle(pht('Error in submission.'))
@ -126,14 +128,14 @@ final class LegalpadDocumentSignController extends LegalpadController {
id(new PHUIDocumentView()) id(new PHUIDocumentView())
->setHeader($header) ->setHeader($header)
->appendChild($this->buildDocument($engine, $document_body)), ->appendChild($this->buildDocument($engine, $document_body)),
$error_view,
$this->buildSignatureForm( $this->buildSignatureForm(
$document_body, $document_body,
$signature, $signature,
$has_signed, $has_signed,
$e_name, $e_name,
$e_email, $e_email,
$e_address_1)); $e_address_1,
$error_view));
return $this->buildApplicationPage( return $this->buildApplicationPage(
$content, $content,
@ -148,15 +150,7 @@ final class LegalpadDocumentSignController extends LegalpadController {
PhabricatorMarkupEngine PhabricatorMarkupEngine
$engine, LegalpadDocumentBody $body) { $engine, LegalpadDocumentBody $body) {
require_celerity_resource('legalpad-documentbody-css'); return $engine->getOutput($body, LegalpadDocumentBody::MARKUP_FIELD_TEXT);
return phutil_tag(
'div',
array(
'class' => 'legalpad-documentbody'
),
$engine->getOutput($body, LegalpadDocumentBody::MARKUP_FIELD_TEXT));
} }
private function buildSignatureForm( private function buildSignatureForm(
@ -165,7 +159,8 @@ final class LegalpadDocumentSignController extends LegalpadController {
$has_signed = false, $has_signed = false,
$e_name = true, $e_name = true,
$e_email = true, $e_email = true,
$e_address_1 = true) { $e_address_1 = true,
$error_view = null) {
$user = $this->getRequest()->getUser(); $user = $this->getRequest()->getUser();
if ($has_signed) { if ($has_signed) {
@ -177,11 +172,6 @@ final class LegalpadDocumentSignController extends LegalpadController {
$data = $signature->getSignatureData(); $data = $signature->getSignatureData();
$form = id(new AphrontFormView()) $form = id(new AphrontFormView())
->setUser($user) ->setUser($user)
->appendChild(
id(new AphrontFormInsetView())
->setTitle(pht('Sign and Agree'))
->setDescription($instructions)
->setContent(phutil_tag('br', array()))
->appendChild( ->appendChild(
id(new AphrontFormTextControl()) id(new AphrontFormTextControl())
->setLabel(pht('Name')) ->setLabel(pht('Name'))
@ -226,9 +216,12 @@ final class LegalpadDocumentSignController extends LegalpadController {
->appendChild( ->appendChild(
id(new AphrontFormSubmitControl()) id(new AphrontFormSubmitControl())
->setValue(pht('Sign and Agree')) ->setValue(pht('Sign and Agree'))
->setDisabled($has_signed))); ->setDisabled($has_signed));
return $form; return id(new PHUIObjectBoxView())
->setHeaderText(pht('Sign and Agree'))
->setFormError($error_view)
->setForm($form);
} }
} }

View file

@ -1,9 +0,0 @@
/**
* @provides legalpad-documentbody-css
*/
.legalpad-documentbody {
position: relative;
padding: 1.25em 2%
}