@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 Files to new UI

Summary: Modernize Files a bit, use newPage

Test Plan: New file, drag and drop file, view file, edit file

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin

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

+89 -68
+1 -4
src/applications/files/controller/PhabricatorFileComposeController.php
··· 155 155 'defaultIcon' => $value_icon, 156 156 )); 157 157 158 - $dialog = id(new AphrontDialogView()) 159 - ->setUser($viewer) 158 + return $this->newDialog() 160 159 ->setFormID($dialog_id) 161 160 ->setClass('compose-dialog') 162 161 ->setTitle(pht('Compose Image')) ··· 188 187 ->appendChild($icon_input) 189 188 ->addCancelButton('/') 190 189 ->addSubmitButton(pht('Save Image')); 191 - 192 - return id(new AphrontDialogResponse())->setDialog($dialog); 193 190 } 194 191 195 192 private function getIconMap() {
+7 -10
src/applications/files/controller/PhabricatorFileDeleteController.php
··· 29 29 return id(new AphrontRedirectResponse())->setURI('/file/'); 30 30 } 31 31 32 - $dialog = new AphrontDialogView(); 33 - $dialog->setUser($viewer); 34 - $dialog->setTitle(pht('Really delete file?')); 35 - $dialog->appendChild(hsprintf( 32 + return $this->newDialog() 33 + ->setTitle(pht('Really delete file?')) 34 + ->appendChild(hsprintf( 36 35 '<p>%s</p>', 37 36 pht( 38 - "Permanently delete '%s'? This action can not be undone.", 39 - $file->getName()))); 40 - $dialog->addSubmitButton(pht('Delete')); 41 - $dialog->addCancelButton($file->getInfoURI()); 42 - 43 - return id(new AphrontDialogResponse())->setDialog($dialog); 37 + 'Permanently delete "%s"? This action can not be undone.', 38 + $file->getName()))) 39 + ->addSubmitButton(pht('Delete')) 40 + ->addCancelButton($file->getInfoURI()); 44 41 } 45 42 }
+19 -11
src/applications/files/controller/PhabricatorFileEditController.php
··· 19 19 return new Aphront404Response(); 20 20 } 21 21 22 - $title = pht('Edit %s', $file->getName()); 22 + $title = pht('Edit File: %s', $file->getName()); 23 23 $file_name = $file->getName(); 24 + $header_icon = 'fa-pencil'; 24 25 $view_uri = '/'.$file->getMonogram(); 25 26 $error_name = true; 26 27 $validation_exception = null; ··· 86 87 87 88 $crumbs = $this->buildApplicationCrumbs() 88 89 ->addTextCrumb($file->getMonogram(), $view_uri) 89 - ->addTextCrumb(pht('Edit')); 90 + ->addTextCrumb(pht('Edit')) 91 + ->setBorder(true); 90 92 91 - $object_box = id(new PHUIObjectBoxView()) 93 + $box = id(new PHUIObjectBoxView()) 92 94 ->setHeaderText($title) 93 95 ->setValidationException($validation_exception) 96 + ->setBackground(PHUIObjectBoxView::BLUE_PROPERTY) 94 97 ->appendChild($form); 95 98 96 - return $this->buildApplicationPage( 97 - array( 98 - $crumbs, 99 - $object_box, 100 - ), 101 - array( 102 - 'title' => $title, 103 - )); 99 + $header = id(new PHUIHeaderView()) 100 + ->setHeader($title) 101 + ->setHeaderIcon($header_icon); 102 + 103 + $view = id(new PHUITwoColumnView()) 104 + ->setHeader($header) 105 + ->setFooter($box); 106 + 107 + return $this->newPage() 108 + ->setTitle($title) 109 + ->setCrumbs($crumbs) 110 + ->appendChild($view); 111 + 104 112 } 105 113 106 114 }
+28 -24
src/applications/files/controller/PhabricatorFileInfoController.php
··· 35 35 $header = id(new PHUIHeaderView()) 36 36 ->setUser($viewer) 37 37 ->setPolicyObject($file) 38 - ->setHeader($file->getName()); 38 + ->setHeader($file->getName()) 39 + ->setHeaderIcon('fa-file-o'); 39 40 40 41 $ttl = $file->getTTL(); 41 42 if ($ttl !== null) { ··· 55 56 $header->addTag($partial_tag); 56 57 } 57 58 58 - $actions = $this->buildActionView($file); 59 + $curtain = $this->buildCurtainView($file); 59 60 $timeline = $this->buildTransactionView($file); 60 61 $crumbs = $this->buildApplicationCrumbs(); 61 62 $crumbs->addTextCrumb( 62 63 'F'.$file->getID(), 63 64 $this->getApplicationURI("/info/{$phid}/")); 65 + $crumbs->setBorder(true); 64 66 65 67 $object_box = id(new PHUIObjectBoxView()) 66 - ->setHeader($header); 68 + ->setHeaderText(pht('File')) 69 + ->setBackground(PHUIObjectBoxView::BLUE_PROPERTY); 67 70 68 - $this->buildPropertyViews($object_box, $file, $actions); 71 + $this->buildPropertyViews($object_box, $file); 72 + $title = $file->getName(); 69 73 70 - return $this->buildApplicationPage( 71 - array( 72 - $crumbs, 74 + $view = id(new PHUITwoColumnView()) 75 + ->setHeader($header) 76 + ->setCurtain($curtain) 77 + ->setMainColumn(array( 73 78 $object_box, 74 79 $timeline, 75 - ), 76 - array( 77 - 'title' => $file->getName(), 78 - 'pageObjects' => array($file->getPHID()), 79 80 )); 81 + 82 + return $this->newPage() 83 + ->setTitle($title) 84 + ->setCrumbs($crumbs) 85 + ->setPageObjectPHIDs(array($file->getPHID())) 86 + ->appendChild($view); 87 + 80 88 } 81 89 82 90 private function buildTransactionView(PhabricatorFile $file) { ··· 108 116 ); 109 117 } 110 118 111 - private function buildActionView(PhabricatorFile $file) { 119 + private function buildCurtainView(PhabricatorFile $file) { 112 120 $viewer = $this->getViewer(); 113 121 114 122 $id = $file->getID(); ··· 118 126 $file, 119 127 PhabricatorPolicyCapability::CAN_EDIT); 120 128 121 - $view = id(new PhabricatorActionListView()) 122 - ->setUser($viewer) 123 - ->setObject($file); 129 + $curtain = $this->newCurtainView($file); 124 130 125 131 $can_download = !$file->getIsPartial(); 126 132 127 133 if ($file->isViewableInBrowser()) { 128 - $view->addAction( 134 + $curtain->addAction( 129 135 id(new PhabricatorActionView()) 130 136 ->setName(pht('View File')) 131 137 ->setIcon('fa-file-o') ··· 133 139 ->setDisabled(!$can_download) 134 140 ->setWorkflow(!$can_download)); 135 141 } else { 136 - $view->addAction( 142 + $curtain->addAction( 137 143 id(new PhabricatorActionView()) 138 144 ->setUser($viewer) 139 145 ->setRenderAsForm($can_download) ··· 145 151 ->setWorkflow(!$can_download)); 146 152 } 147 153 148 - $view->addAction( 154 + $curtain->addAction( 149 155 id(new PhabricatorActionView()) 150 156 ->setName(pht('Edit File')) 151 157 ->setIcon('fa-pencil') ··· 153 159 ->setWorkflow(!$can_edit) 154 160 ->setDisabled(!$can_edit)); 155 161 156 - $view->addAction( 162 + $curtain->addAction( 157 163 id(new PhabricatorActionView()) 158 164 ->setName(pht('Delete File')) 159 165 ->setIcon('fa-times') ··· 161 167 ->setWorkflow(true) 162 168 ->setDisabled(!$can_edit)); 163 169 164 - $view->addAction( 170 + $curtain->addAction( 165 171 id(new PhabricatorActionView()) 166 172 ->setName(pht('View Transforms')) 167 173 ->setIcon('fa-crop') 168 174 ->setHref($this->getApplicationURI("/transforms/{$id}/"))); 169 175 170 - return $view; 176 + return $curtain; 171 177 } 172 178 173 179 private function buildPropertyViews( 174 180 PHUIObjectBoxView $box, 175 - PhabricatorFile $file, 176 - PhabricatorActionListView $actions) { 181 + PhabricatorFile $file) { 177 182 $request = $this->getRequest(); 178 183 $viewer = $request->getUser(); 179 184 180 185 $properties = id(new PHUIPropertyListView()); 181 - $properties->setActionList($actions); 182 186 $box->addPropertyList($properties, pht('Details')); 183 187 184 188 if ($file->getAuthorPHID()) {
+18 -9
src/applications/files/controller/PhabricatorFileTransformListController.php
··· 113 113 $crumbs = $this->buildApplicationCrumbs(); 114 114 $crumbs->addTextCrumb($monogram, '/'.$monogram); 115 115 $crumbs->addTextCrumb(pht('Transforms')); 116 + $crumbs->setBorder(true); 116 117 117 118 $dst_box = id(new PHUIObjectBoxView()) 118 119 ->setHeaderText(pht('File Sources')) 120 + ->setBackground(PHUIObjectBoxView::BLUE_PROPERTY) 119 121 ->setTable($dst_table); 120 122 121 123 $src_box = id(new PHUIObjectBoxView()) 122 124 ->setHeaderText(pht('Available Transforms')) 125 + ->setBackground(PHUIObjectBoxView::BLUE_PROPERTY) 123 126 ->setTable($src_table); 124 127 125 - return $this->buildApplicationPage( 126 - array( 127 - $crumbs, 128 + $title = pht('%s Transforms', $file->getName()); 129 + 130 + $header = id(new PHUIHeaderView()) 131 + ->setHeader($title) 132 + ->setHeaderIcon('fa-arrows-alt'); 133 + 134 + $view = id(new PHUITwoColumnView()) 135 + ->setHeader($header) 136 + ->setFooter(array( 128 137 $dst_box, 129 138 $src_box, 130 - ), 131 - array( 132 - 'title' => array( 133 - pht('%s %s', $monogram, $file->getName()), 134 - pht('Tranforms'), 135 - ), 136 139 )); 140 + 141 + return $this->newPage() 142 + ->setTitle($title) 143 + ->setCrumbs($crumbs) 144 + ->appendChild($view); 145 + 137 146 } 138 147 }
+15 -7
src/applications/files/controller/PhabricatorFileUploadController.php
··· 81 81 82 82 $crumbs = $this->buildApplicationCrumbs(); 83 83 $crumbs->addTextCrumb(pht('Upload'), $request->getRequestURI()); 84 + $crumbs->setBorder(true); 84 85 85 86 $title = pht('Upload File'); 86 87 ··· 89 90 ->setShowIfSupportedID($support_id); 90 91 91 92 $form_box = id(new PHUIObjectBoxView()) 92 - ->setHeaderText($title) 93 + ->setHeaderText(pht('File')) 93 94 ->setFormErrors($errors) 95 + ->setBackground(PHUIObjectBoxView::BLUE_PROPERTY) 94 96 ->setForm($form); 95 97 96 - return $this->buildApplicationPage( 97 - array( 98 - $crumbs, 98 + $header = id(new PHUIHeaderView()) 99 + ->setHeader($title) 100 + ->setHeaderIcon('fa-upload'); 101 + 102 + $view = id(new PHUITwoColumnView()) 103 + ->setHeader($header) 104 + ->setFooter(array( 99 105 $form_box, 100 106 $global_upload, 101 - ), 102 - array( 103 - 'title' => $title, 104 107 )); 108 + 109 + return $this->newPage() 110 + ->setTitle($title) 111 + ->setCrumbs($crumbs) 112 + ->appendChild($view); 105 113 } 106 114 107 115 }
+1 -3
src/applications/files/controller/PhabricatorFileUploadDialogController.php
··· 6 6 public function handleRequest(AphrontRequest $request) { 7 7 $viewer = $request->getViewer(); 8 8 9 - $dialog = id(new AphrontDialogView()) 10 - ->setUser($viewer) 9 + return $this->newDialog() 11 10 ->setTitle(pht('Upload File')) 12 11 ->appendChild(pht( 13 12 'To add files, drag and drop them into the comment text area.')) 14 13 ->addCancelButton('/', pht('Close')); 15 14 16 - return id(new AphrontDialogResponse())->setDialog($dialog); 17 15 } 18 16 19 17 }