mirror of
https://we.phorge.it/source/phorge.git
synced 2025-02-27 22:19:29 +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:
parent
5ef4954a36
commit
edd8bea85b
3 changed files with 57 additions and 82 deletions
|
@ -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',
|
||||||
|
|
|
@ -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) {
|
||||||
|
@ -178,57 +173,55 @@ final class LegalpadDocumentSignController extends LegalpadController {
|
||||||
$form = id(new AphrontFormView())
|
$form = id(new AphrontFormView())
|
||||||
->setUser($user)
|
->setUser($user)
|
||||||
->appendChild(
|
->appendChild(
|
||||||
id(new AphrontFormInsetView())
|
id(new AphrontFormTextControl())
|
||||||
->setTitle(pht('Sign and Agree'))
|
->setLabel(pht('Name'))
|
||||||
->setDescription($instructions)
|
->setValue(idx($data, 'name', ''))
|
||||||
->setContent(phutil_tag('br', array()))
|
->setName('name')
|
||||||
->appendChild(
|
->setError($e_name)
|
||||||
id(new AphrontFormTextControl())
|
->setDisabled($has_signed))
|
||||||
->setLabel(pht('Name'))
|
->appendChild(
|
||||||
->setValue(idx($data, 'name', ''))
|
id(new AphrontFormTextControl())
|
||||||
->setName('name')
|
->setLabel(pht('Email'))
|
||||||
->setError($e_name)
|
->setValue(idx($data, 'email', ''))
|
||||||
->setDisabled($has_signed))
|
->setName('email')
|
||||||
->appendChild(
|
->setError($e_email)
|
||||||
id(new AphrontFormTextControl())
|
->setDisabled($has_signed))
|
||||||
->setLabel(pht('Email'))
|
->appendChild(
|
||||||
->setValue(idx($data, 'email', ''))
|
id(new AphrontFormTextControl())
|
||||||
->setName('email')
|
->setLabel(pht('Address line 1'))
|
||||||
->setError($e_email)
|
->setValue(idx($data, 'address_1', ''))
|
||||||
->setDisabled($has_signed))
|
->setName('address_1')
|
||||||
->appendChild(
|
->setError($e_address_1)
|
||||||
id(new AphrontFormTextControl())
|
->setDisabled($has_signed))
|
||||||
->setLabel(pht('Address line 1'))
|
->appendChild(
|
||||||
->setValue(idx($data, 'address_1', ''))
|
id(new AphrontFormTextControl())
|
||||||
->setName('address_1')
|
->setLabel(pht('Address line 2'))
|
||||||
->setError($e_address_1)
|
->setValue(idx($data, 'address_2', ''))
|
||||||
->setDisabled($has_signed))
|
->setName('address_2')
|
||||||
->appendChild(
|
->setDisabled($has_signed))
|
||||||
id(new AphrontFormTextControl())
|
->appendChild(
|
||||||
->setLabel(pht('Address line 2'))
|
id(new AphrontFormTextControl())
|
||||||
->setValue(idx($data, 'address_2', ''))
|
->setLabel(pht('Phone'))
|
||||||
->setName('address_2')
|
->setValue(idx($data, 'phone', ''))
|
||||||
->setDisabled($has_signed))
|
->setName('phone')
|
||||||
->appendChild(
|
->setDisabled($has_signed))
|
||||||
id(new AphrontFormTextControl())
|
->appendChild(
|
||||||
->setLabel(pht('Phone'))
|
id(new AphrontFormCheckboxControl())
|
||||||
->setValue(idx($data, 'phone', ''))
|
->addCheckbox(
|
||||||
->setName('phone')
|
'agree',
|
||||||
->setDisabled($has_signed))
|
'agree',
|
||||||
->appendChild(
|
pht('I agree to the terms laid forth above.'),
|
||||||
id(new AphrontFormCheckboxControl())
|
$has_signed)
|
||||||
->addCheckbox(
|
->setDisabled($has_signed))
|
||||||
'agree',
|
->appendChild(
|
||||||
'agree',
|
id(new AphrontFormSubmitControl())
|
||||||
pht('I agree to the terms laid forth above.'),
|
->setValue(pht('Sign and Agree'))
|
||||||
$has_signed)
|
->setDisabled($has_signed));
|
||||||
->setDisabled($has_signed))
|
|
||||||
->appendChild(
|
|
||||||
id(new AphrontFormSubmitControl())
|
|
||||||
->setValue(pht('Sign and Agree'))
|
|
||||||
->setDisabled($has_signed)));
|
|
||||||
|
|
||||||
return $form;
|
return id(new PHUIObjectBoxView())
|
||||||
|
->setHeaderText(pht('Sign and Agree'))
|
||||||
|
->setFormError($error_view)
|
||||||
|
->setForm($form);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +0,0 @@
|
||||||
/**
|
|
||||||
* @provides legalpad-documentbody-css
|
|
||||||
*/
|
|
||||||
|
|
||||||
.legalpad-documentbody {
|
|
||||||
position: relative;
|
|
||||||
padding: 1.25em 2%
|
|
||||||
}
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue