@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.

Modernized Phriction's Diff Controller

Summary:
Refs T2686

- Added additional crumb to link back to History view
- Revert buttons hidden for Stub and Move changes, too
- added colors to the change set to reflect the colors in the diff

Test Plan: looked at various changes, verified correct appearance

Reviewers: epriestley, chad, btrahan

CC: aran, Korvin

Maniphest Tasks: T2686

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

authored by

Anh Nhan Nguyen and committed by
epriestley
4c57f8aa cb84cb1c

+42 -37
+1 -1
src/__celerity_resource_map__.php
··· 3397 3397 ), 3398 3398 'phriction-document-css' => 3399 3399 array( 3400 - 'uri' => '/res/8d09bd7f/rsrc/css/application/phriction/phriction-document-css.css', 3400 + 'uri' => '/res/e71e4a67/rsrc/css/application/phriction/phriction-document-css.css', 3401 3401 'type' => 'css', 3402 3402 'requires' => 3403 3403 array(
+40 -32
src/applications/phriction/controller/PhrictionDiffController.php
··· 107 107 $crumbs->addCrumb($view); 108 108 } 109 109 110 + $crumbs->addCrumb( 111 + id(new PhabricatorCrumbView()) 112 + ->setName(pht('History')) 113 + ->setHref(PhrictionDocument::getSlugURI($slug, 'history'))); 114 + 110 115 111 116 $title = "Version $l vs $r"; 112 117 ··· 115 120 116 121 $crumbs->addCrumb( 117 122 id(new PhabricatorCrumbView()) 118 - ->setName($title)); 123 + ->setName($title) 124 + ->setHref($request->getRequestURI())); 119 125 120 126 121 127 $comparison_table = $this->renderComparisonTable( ··· 164 170 $link_l, 165 171 $link_r); 166 172 } 167 - 168 173 169 174 170 175 $output = hsprintf( ··· 202 207 $document_id = $content->getDocumentID(); 203 208 $version = $content->getVersion(); 204 209 205 - if ($content->getChangeType() == PhrictionChangeType::CHANGE_DELETE) { 206 - // Don't show an edit/revert button for changes which deleted the content 207 - // since it's silly. 210 + $hidden_statuses = array( 211 + PhrictionChangeType::CHANGE_DELETE => true, // Silly 212 + PhrictionChangeType::CHANGE_MOVE_AWAY => true, // Plain silly 213 + PhrictionChangeType::CHANGE_STUB => true, // Utterly silly 214 + ); 215 + if (isset($hidden_statuses[$content->getChangeType()])) { 216 + // Don't show an edit/revert button for changes which deleted, moved or 217 + // stubbed the content since it's silly. 208 218 return null; 209 219 } 210 220 ··· 236 246 $phids = mpull($content, 'getAuthorPHID'); 237 247 $handles = $this->loadViewerHandles($phids); 238 248 239 - $rows = array(); 249 + $list = new PhabricatorObjectItemListView(); 250 + 251 + $first = true; 240 252 foreach ($content as $c) { 241 - $rows[] = array( 242 - phabricator_date($c->getDateCreated(), $user), 243 - phabricator_time($c->getDateCreated(), $user), 244 - 'Version '.$c->getVersion(), 245 - $handles[$c->getAuthorPHID()]->renderLink(), 246 - $c->getDescription(), 247 - ); 248 - } 253 + $author = $handles[$c->getAuthorPHID()]->renderLink(); 254 + $item = id(new PhabricatorObjectItemView()) 255 + ->setHeader(pht('%s by %s, %s', 256 + PhrictionChangeType::getChangeTypeLabel($c->getChangeType()), 257 + $author, 258 + pht('Version %s', $c->getVersion()))) 259 + ->addAttribute(pht('%s %s', 260 + phabricator_date($c->getDateCreated(), $user), 261 + phabricator_time($c->getDateCreated(), $user))); 249 262 263 + if ($c->getDescription()) { 264 + $item->addAttribute($c->getDescription()); 265 + } 250 266 251 - $table = new AphrontTableView($rows); 252 - $table->setHeaders( 253 - array( 254 - pht('Date'), 255 - pht('Time'), 256 - pht('Version'), 257 - pht('Author'), 258 - pht('Description'), 259 - )); 260 - $table->setColumnClasses( 261 - array( 262 - '', 263 - 'right', 264 - 'pri', 265 - '', 266 - 'wide', 267 - )); 267 + if ($first == true) { 268 + $item->setBarColor('green'); 269 + $first = false; 270 + } else { 271 + $item->setBarColor('red'); 272 + } 268 273 269 - return $table; 274 + $list->addItem($item); 275 + } 276 + 277 + return $list; 270 278 } 271 279 272 280 }
+1 -4
webroot/rsrc/css/application/phriction/phriction-document-css.css
··· 64 64 font-size: 11px; 65 65 } 66 66 67 - 68 67 .phriction-document-history-diff { 69 - margin: 0 0 0 2em; 70 - padding-bottom: 2em; 71 - max-width: 1162px; 68 + padding: 0 2em 2em; 72 69 } 73 70 74 71 .phriction-revert-table {