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

Modernize "revision update history" in Differential

Summary:
Ref T4585.

- Use modern UI kit.
- Make mobile-ish.
- Fix a couple minor things.

Test Plan:
{F127155}

{F127156}

Reviewers: btrahan, chad

Reviewed By: chad

Subscribers: aran, epriestley, chad

Maniphest Tasks: T4585

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

+173 -108
+122 -55
src/applications/differential/view/DifferentialRevisionUpdateHistoryView.php
··· 61 61 $disable = false; 62 62 $radios = array(); 63 63 $last_base = null; 64 + $rowc = array(); 64 65 foreach ($data as $row) { 65 66 66 67 $diff = $row['obj']; 67 68 $name = $row['name']; 68 69 $id = $row['id']; 69 70 70 - $old_class = null; 71 - $new_class = null; 71 + $old_class = false; 72 + $new_class = false; 72 73 73 74 if ($id) { 74 75 $new_checked = ($this->selectedDiffID == $id); ··· 82 83 'sigil' => 'differential-new-radio', 83 84 )); 84 85 if ($new_checked) { 85 - $new_class = " revhistory-new-now"; 86 + $new_class = true; 86 87 $disable = true; 87 88 } 89 + $new = phutil_tag( 90 + 'div', 91 + array( 92 + 'class' => 'differential-update-history-radio', 93 + ), 94 + $new); 88 95 } else { 89 96 $new = null; 90 97 } ··· 104 111 )); 105 112 $radios[] = $uniq; 106 113 if ($old_checked) { 107 - $old_class = " revhistory-old-now"; 114 + $old_class = true; 108 115 } 116 + $old = phutil_tag( 117 + 'div', 118 + array( 119 + 'class' => 'differential-update-history-radio', 120 + ), 121 + $old); 109 122 } else { 110 123 $old = null; 111 124 } ··· 118 131 $age = null; 119 132 } 120 133 121 - if (++$idx % 2) { 122 - $class = 'alt'; 123 - } else { 124 - $class = null; 125 - } 126 - 127 - $lint_attrs = array('class' => 'revhistory-star'); 128 - $unit_attrs = array('class' => 'revhistory-star'); 129 134 if ($diff) { 130 135 $lint = self::renderDiffLintStar($row['obj']); 136 + $lint = phutil_tag( 137 + 'div', 138 + array( 139 + 'class' => 'lintunit-star', 140 + 'title' => self::getDiffLintMessage($diff), 141 + ), 142 + $lint); 143 + 131 144 $unit = self::renderDiffUnitStar($row['obj']); 132 - $lint_attrs['title'] = self::getDiffLintMessage($diff); 133 - $unit_attrs['title'] = self::getDiffUnitMessage($diff); 145 + $unit = phutil_tag( 146 + 'div', 147 + array( 148 + 'class' => 'lintunit-star', 149 + 'title' => self::getDiffUnitMessage($diff), 150 + ), 151 + $unit); 152 + 134 153 $base = $this->renderBaseRevision($diff); 135 154 } else { 136 155 $lint = null; ··· 145 164 146 165 $id_link = phutil_tag( 147 166 'a', 148 - array('href' => '/differential/diff/'.$id.'/'), 149 - $id); 150 - $rows[] = phutil_tag( 151 - 'tr', 152 - array('class' => $class), 153 167 array( 154 - phutil_tag('td', array('class' => 'revhistory-name'), $name), 155 - phutil_tag('td', array('class' => 'revhistory-id'), $id_link), 156 - phutil_tag('td', array('class' => 'revhistory-base'), $base), 157 - phutil_tag('td', array('class' => 'revhistory-desc'), $desc), 158 - phutil_tag('td', array('class' => 'revhistory-age'), $age), 159 - phutil_tag('td', $lint_attrs, $lint), 160 - phutil_tag('td', $unit_attrs, $unit), 161 - phutil_tag('td', array('class' => 'revhistory-old'.$old_class), $old), 162 - phutil_tag('td', array('class' => 'revhistory-new'.$new_class), $new), 163 - )); 168 + 'href' => '/differential/diff/'.$id.'/', 169 + ), 170 + $id); 171 + 172 + $rows[] = array( 173 + $name, 174 + $id_link, 175 + $base, 176 + $desc, 177 + $age, 178 + $lint, 179 + $unit, 180 + $old, 181 + $new, 182 + ); 183 + 184 + $classes = array(); 185 + if ($old_class) { 186 + $classes[] = 'differential-update-history-old-now'; 187 + } 188 + if ($new_class) { 189 + $classes[] = 'differential-update-history-new-now'; 190 + } 191 + $rowc[] = nonempty(implode(' ', $classes), null); 164 192 } 165 193 166 194 Javelin::initBehavior( ··· 190 218 } 191 219 $select = phutil_tag('select', array('name' => 'whitespace'), $options); 192 220 193 - array_unshift($rows, phutil_tag('tr', array(), array( 194 - phutil_tag('th', array(), pht('Diff')), 195 - phutil_tag('th', array(), pht('ID')), 196 - phutil_tag('th', array(), pht('Base')), 197 - phutil_tag('th', array(), pht('Description')), 198 - phutil_tag('th', array(), pht('Created')), 199 - phutil_tag('th', array(), pht('Lint')), 200 - phutil_tag('th', array(), pht('Unit')), 201 - ))); 202 221 203 - $label = pht('Whitespace Changes: %s', $select); 222 + $table = id(new AphrontTableView($rows)); 223 + $table->setHeaders( 224 + array( 225 + pht('Diff'), 226 + pht('ID'), 227 + pht('Base'), 228 + pht('Description'), 229 + pht('Created'), 230 + pht('Lint'), 231 + pht('Unit'), 232 + '', 233 + '', 234 + )); 235 + $table->setColumnClasses( 236 + array( 237 + 'pri', 238 + '', 239 + '', 240 + 'wide', 241 + 'date', 242 + 'center', 243 + 'center', 244 + 'center differential-update-history-old', 245 + 'center differential-update-history-new', 246 + )); 247 + $table->setRowClasses($rowc); 248 + $table->setDeviceVisibility( 249 + array( 250 + true, 251 + true, 252 + false, 253 + true, 254 + false, 255 + false, 256 + false, 257 + true, 258 + true, 259 + )); 204 260 205 - $content = phutil_tag_div( 206 - 'differential-revision-history differential-panel', 207 - phutil_tag( 208 - 'form', 209 - array('action' => '#toc'), 261 + $show_diff = phutil_tag( 262 + 'div', 263 + array( 264 + 'class' => 'differential-update-history-footer', 265 + ), 266 + array( 210 267 phutil_tag( 211 - 'table', 212 - array('class' => 'differential-revision-history-table'), array( 213 - phutil_implode_html("\n", $rows), 214 - phutil_tag('tr', array(), phutil_tag( 215 - 'td', 216 - array('colspan' => 9, 'class' => 'diff-differ-submit'), 217 - array( 218 - phutil_tag('label', array(), $label), 219 - phutil_tag('button', array(), pht('Show Diff')), 220 - ))) 221 - )))); 268 + 'label', 269 + array(), 270 + array( 271 + pht('Whitespace Changes:'), 272 + $select, 273 + )), 274 + phutil_tag( 275 + 'button', 276 + array(), 277 + pht('Show Diff')), 278 + )); 279 + 280 + $content = phabricator_form( 281 + $this->getUser(), 282 + array( 283 + 'action' => '#toc', 284 + ), 285 + array( 286 + $table, 287 + $show_diff, 288 + )); 222 289 223 290 return id(new PHUIObjectBoxView()) 224 291 ->setHeaderText(pht('Revision Update History'))
+5 -2
src/view/control/AphrontTableView.php
··· 153 153 $classes[] = $col_classes[$col_num]; 154 154 } 155 155 156 - if (empty($device_visiblity[$col_num])) { 157 - $classes[] = 'aphront-table-nodevice'; 156 + if (empty($device_visibility[$col_num])) { 157 + $classes[] = 'aphront-table-view-nodevice'; 158 158 } 159 159 160 160 if ($sort_values[$col_num] !== null) { ··· 251 251 continue; 252 252 } 253 253 $class = $col_classes[$col_num]; 254 + if (empty($device_visibility[$col_num])) { 255 + $class = trim($class.' aphront-table-view-nodevice'); 256 + } 254 257 if (!empty($this->cellClasses[$row_num][$col_num])) { 255 258 $class = trim($class.' '.$this->cellClasses[$row_num][$col_num]); 256 259 }
+12
webroot/rsrc/css/aphront/table-view.css
··· 144 144 145 145 .aphront-table-view td.pri { 146 146 font-weight: bold; 147 + color: {$darkbluetext}; 147 148 } 148 149 149 150 .aphront-table-view td.wide { ··· 229 230 .aphront-table-view td.radio { 230 231 text-align: center; 231 232 padding: 2px 4px 0px; 233 + } 234 + 235 + .aphront-table-view th.center, 236 + .aphront-table-view td.center { 237 + text-align: center; 238 + } 239 + 240 + .device .aphront-table-view td + td.center, 241 + .device .aphront-table-view th + th.center { 242 + padding-left: 3px; 243 + padding-right: 3px; 232 244 } 233 245 234 246 .device-desktop .aphront-table-view-device {
+34 -51
webroot/rsrc/css/application/differential/revision-history.css
··· 2 2 * @provides differential-revision-history-css 3 3 */ 4 4 5 - .differential-revision-history-table { 6 - width: 100%; 7 - border-collapse: separate; 8 - border-spacing: 1px; 9 - } 10 - 11 - .differential-revision-history-table th, 12 - .differential-revision-history-table td { 13 - color: {$darkbluetext}; 5 + .differential-update-history-footer { 6 + text-align: right; 7 + vertical-align: middle; 14 8 padding: 4px 8px; 9 + border-top: 1px solid {$lightblueborder}; 10 + background: {$lightbluebackground}; 15 11 } 16 12 17 - .differential-revision-history-table td { 18 - white-space: nowrap; 13 + .differential-update-history-footer label { 14 + margin-right: 12px; 15 + color: {$greytext}; 19 16 } 20 17 21 - .differential-revision-history-table tr.alt { 22 - background: {$greybackground}; 18 + .differential-update-history-footer select { 19 + margin-left: 8px; 23 20 } 24 21 25 - .differential-revision-history-table td.revhistory-desc { 26 - width: 100%; 27 - white-space: normal; 22 + .device .differential-update-history-footer label { 23 + display: block; 24 + margin-right: 0; 25 + margin-bottom: 4px; 28 26 } 29 27 30 - .differential-revision-history-table td.revhistory-name { 31 - font-weight: bold; 28 + .differential-update-history-radio { 29 + padding: 0 8px; 32 30 } 33 31 34 - .differential-revision-history-table td.revhistory-age { 35 - text-align: right; 32 + .aphront-table-view td.differential-update-history-old { 33 + background: #f9d0d0; 36 34 } 37 35 38 - .differential-revision-history-table td.revhistory-old, 39 - .differential-revision-history-table td.revhistory-new { 40 - padding: 0 16px; 41 - text-align: center; 36 + .aphront-table-view td.differential-update-history-new { 37 + background: #d0ffd0; 42 38 } 43 39 44 - .differential-revision-history-table td.revhistory-old { 45 - background: #f9d0d0; 46 - } 47 - 48 - .differential-revision-history-table td.revhistory-old-now { 40 + .aphront-table-view 41 + .differential-update-history-old-now 42 + td.differential-update-history-old, 43 + .aphront-table-view 44 + .alt-differential-update-history-old-now 45 + td.differential-update-history-old { 49 46 background: #ffaaaa; 50 47 } 51 48 52 - .differential-revision-history-table td.revhistory-new { 53 - background: #d0ffd0; 54 - } 55 - 56 - .differential-revision-history-table td.revhistory-new-now { 49 + .aphront-table-view 50 + .differential-update-history-new-now 51 + td.differential-update-history-new, 52 + .aphront-table-view 53 + .alt-differential-update-history-new-now 54 + td.differential-update-history-new { 57 55 background: #aaffaa; 58 56 } 59 57 60 - .differential-revision-history-table td.revhistory-star { 58 + .lintunit-star { 61 59 text-align: center; 62 - } 63 - 64 - .differential-revision-history-table td.diff-differ-submit { 65 - text-align: right; 66 - border-bottom: none; 67 - padding: 8px 0 4px 0; 68 - } 69 - 70 - .differential-revision-history-table td.diff-differ-submit button { 71 - margin-left: 12px; 72 - } 73 - 74 - .differential-revision-history-table td.diff-differ-submit label { 75 - font-weight: bold; 76 - padding-right: 4px; 77 - color: {$darkgreytext}; 60 + padding: 0 16px; 78 61 }