@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Update Legalpad with modern UI

Summary: Updates Legalpad Manage/Edit with new UI layouts.

Test Plan: Wrote a new document with and without a preamble, edit document, sign document

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin

Differential Revision: https://secure.phabricator.com/D15576

authored by

Chad Little and committed by
chad
72d12be8 bdeb5cf1

+75 -55
+20 -10
src/applications/legalpad/controller/LegalpadDocumentEditController.php
··· 220 220 $submit->addCancelButton($this->getApplicationURI()); 221 221 $title = pht('Create Document'); 222 222 $short = pht('Create'); 223 + $header_icon = 'fa-plus-square'; 223 224 } else { 224 225 $submit->setValue(pht('Save Document')); 225 226 $submit->addCancelButton( 226 227 $this->getApplicationURI('view/'.$document->getID())); 227 - $title = pht('Edit Document'); 228 + $title = pht('Edit Document: %s', $document->getTitle()); 228 229 $short = pht('Edit'); 230 + $header_icon = 'fa-pencil'; 229 231 230 232 $crumbs->addTextCrumb( 231 233 $document->getMonogram(), 232 234 $this->getApplicationURI('view/'.$document->getID())); 233 235 } 234 236 235 - $form 236 - ->appendChild($submit); 237 + $form->appendChild($submit); 237 238 238 239 $form_box = id(new PHUIObjectBoxView()) 239 - ->setHeaderText($title) 240 + ->setHeaderText(pht('Document')) 240 241 ->setFormErrors($errors) 242 + ->setBackground(PHUIObjectBoxView::BLUE_PROPERTY) 241 243 ->setForm($form); 242 244 243 245 $crumbs->addTextCrumb($short); 246 + $crumbs->setBorder(true); 244 247 245 248 $preview = id(new PHUIRemarkupPreviewPanel()) 246 249 ->setHeader($document->getTitle()) ··· 248 251 ->setControlID('document-text') 249 252 ->setPreviewType(PHUIRemarkupPreviewPanel::DOCUMENT); 250 253 251 - return $this->buildApplicationPage( 252 - array( 253 - $crumbs, 254 + $header = id(new PHUIHeaderView()) 255 + ->setHeader($title) 256 + ->setHeaderIcon($header_icon); 257 + 258 + $view = id(new PHUITwoColumnView()) 259 + ->setHeader($header) 260 + ->setFooter(array( 254 261 $form_box, 255 262 $preview, 256 - ), 257 - array( 258 - 'title' => $title, 259 263 )); 264 + 265 + return $this->newPage() 266 + ->setTitle($title) 267 + ->setCrumbs($crumbs) 268 + ->appendChild($view); 269 + 260 270 } 261 271 262 272 }
+55 -45
src/applications/legalpad/controller/LegalpadDocumentManageController.php
··· 43 43 $header = id(new PHUIHeaderView()) 44 44 ->setHeader($title) 45 45 ->setUser($viewer) 46 - ->setPolicyObject($document); 46 + ->setPolicyObject($document) 47 + ->setHeaderIcon('fa-gavel'); 47 48 48 - $actions = $this->buildActionView($document); 49 - $properties = $this->buildPropertyView($document, $engine, $actions); 49 + $curtain = $this->buildCurtainView($document); 50 + $properties = $this->buildPropertyView($document, $engine); 51 + $document_view = $this->buildDocumentView($document, $engine); 50 52 51 53 $comment_form_id = celerity_generate_unique_node_id(); 52 54 ··· 57 59 $document->getMonogram(), 58 60 '/'.$document->getMonogram()); 59 61 $crumbs->addTextCrumb(pht('Manage')); 62 + $crumbs->setBorder(true); 60 63 61 - $object_box = id(new PHUIObjectBoxView()) 62 - ->setHeader($header) 63 - ->addPropertyList($properties) 64 - ->addPropertyList($this->buildDocument($engine, $document_body)); 65 64 66 - $content = array( 67 - $crumbs, 68 - $object_box, 69 - $timeline, 70 - $add_comment, 71 - ); 72 - 73 - return $this->buildApplicationPage( 74 - $content, 75 - array( 76 - 'title' => $title, 77 - 'pageObjects' => array($document->getPHID()), 65 + $view = id(new PHUITwoColumnView()) 66 + ->setHeader($header) 67 + ->setCurtain($curtain) 68 + ->setMainColumn(array( 69 + $properties, 70 + $document_view, 71 + $timeline, 72 + $add_comment, 78 73 )); 74 + 75 + return $this->newPage() 76 + ->setTitle($title) 77 + ->setCrumbs($crumbs) 78 + ->setPageObjectPHIDs(array($document->getPHID())) 79 + ->appendChild($view); 79 80 } 80 81 81 - private function buildDocument( 82 - PhabricatorMarkupEngine 83 - $engine, LegalpadDocumentBody $body) { 82 + private function buildDocumentView( 83 + LegalpadDocument $document, 84 + PhabricatorMarkupEngine $engine) { 84 85 85 - $view = new PHUIPropertyListView(); 86 - $view->addClass('legalpad'); 87 - $view->addSectionHeader( 88 - pht('Document'), 'fa-file-text-o'); 89 - $view->addTextContent( 90 - $engine->getOutput($body, LegalpadDocumentBody::MARKUP_FIELD_TEXT)); 86 + $viewer = $this->getViewer(); 87 + 88 + $view = id(new PHUIPropertyListView()) 89 + ->setUser($viewer); 90 + $document_body = $document->getDocumentBody(); 91 + $document_text = $engine->getOutput( 92 + $document_body, LegalpadDocumentBody::MARKUP_FIELD_TEXT); 91 93 92 - return $view; 94 + $preamble_box = null; 95 + if (strlen($document->getPreamble())) { 96 + $preamble_text = new PHUIRemarkupView($viewer, $document->getPreamble()); 97 + $view->addTextContent($preamble_text); 98 + $view->addSectionHeader(''); 99 + $view->addTextContent($document_text); 100 + } else { 101 + $view->addTextContent($document_text); 102 + } 93 103 104 + return id(new PHUIObjectBoxView()) 105 + ->setHeaderText(pht('DOCUMENT')) 106 + ->addPropertyList($view) 107 + ->setBackground(PHUIObjectBoxView::BLUE_PROPERTY); 94 108 } 95 109 96 - private function buildActionView(LegalpadDocument $document) { 110 + private function buildCurtainView(LegalpadDocument $document) { 97 111 $viewer = $this->getViewer(); 98 112 99 - $actions = id(new PhabricatorActionListView()) 100 - ->setUser($viewer) 101 - ->setObject($document); 113 + $curtain = $this->newCurtainView($document); 102 114 103 115 $can_edit = PhabricatorPolicyFilter::hasCapability( 104 116 $viewer, ··· 107 119 108 120 $doc_id = $document->getID(); 109 121 110 - $actions->addAction( 122 + $curtain->addAction( 111 123 id(new PhabricatorActionView()) 112 124 ->setIcon('fa-pencil-square') 113 125 ->setName(pht('View/Sign Document')) 114 126 ->setHref('/'.$document->getMonogram())); 115 127 116 - $actions->addAction( 128 + $curtain->addAction( 117 129 id(new PhabricatorActionView()) 118 130 ->setIcon('fa-pencil') 119 131 ->setName(pht('Edit Document')) ··· 121 133 ->setDisabled(!$can_edit) 122 134 ->setWorkflow(!$can_edit)); 123 135 124 - $actions->addAction( 136 + $curtain->addAction( 125 137 id(new PhabricatorActionView()) 126 138 ->setIcon('fa-terminal') 127 139 ->setName(pht('View Signatures')) 128 140 ->setHref($this->getApplicationURI('/signatures/'.$doc_id.'/'))); 129 141 130 - return $actions; 142 + return $curtain; 131 143 } 132 144 133 145 private function buildPropertyView( 134 146 LegalpadDocument $document, 135 - PhabricatorMarkupEngine $engine, 136 - PhabricatorActionListView $actions) { 147 + PhabricatorMarkupEngine $engine) { 137 148 138 149 $viewer = $this->getViewer(); 139 150 140 151 $properties = id(new PHUIPropertyListView()) 141 - ->setUser($viewer) 142 - ->setObject($document) 143 - ->setActionList($actions); 152 + ->setUser($viewer); 144 153 145 154 $properties->addProperty( 146 155 pht('Signature Type'), ··· 166 175 ->setAsInline(true)); 167 176 } 168 177 169 - $properties->invokeWillRenderEvent(); 170 - 171 - return $properties; 178 + return id(new PHUIObjectBoxView()) 179 + ->setHeaderText(pht('PROPERTIES')) 180 + ->addPropertyList($properties) 181 + ->setBackground(PHUIObjectBoxView::BLUE_PROPERTY); 172 182 } 173 183 174 184 private function buildAddCommentView(