mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-19 21:32:43 +01:00
[Redesign] Add color to diff Table of Contents
Summary: Ref T8099. I think these colors make sense, but if any seem wrong, lmk. Colors the type of file change. Test Plan: Test a few diffs locally, read carefully, ask epriestley. Reviewers: btrahan, epriestley Reviewed By: epriestley Subscribers: epriestley, Korvin Maniphest Tasks: T8099 Differential Revision: https://secure.phabricator.com/D13502
This commit is contained in:
parent
3b755115c2
commit
66afb92fb3
2 changed files with 20 additions and 0 deletions
|
@ -38,6 +38,22 @@ final class DifferentialChangeType extends Phobject {
|
|||
return idx($types, coalesce($type, '?'), '~');
|
||||
}
|
||||
|
||||
public static function getSummaryColorForChangeType($type) {
|
||||
static $types = array(
|
||||
self::TYPE_ADD => 'green',
|
||||
self::TYPE_CHANGE => 'black',
|
||||
self::TYPE_DELETE => 'red',
|
||||
self::TYPE_MOVE_AWAY => 'orange',
|
||||
self::TYPE_COPY_AWAY => 'black',
|
||||
self::TYPE_MOVE_HERE => 'green',
|
||||
self::TYPE_COPY_HERE => 'green',
|
||||
self::TYPE_MULTICOPY => 'orange',
|
||||
self::TYPE_MESSAGE => 'black',
|
||||
self::TYPE_CHILD => 'black',
|
||||
);
|
||||
return idx($types, coalesce($type, '?'), 'black');
|
||||
}
|
||||
|
||||
public static function getShortNameForFileType($type) {
|
||||
static $names = array(
|
||||
self::FILE_TEXT => null,
|
||||
|
|
|
@ -56,6 +56,7 @@ final class DifferentialDiffTableOfContentsView extends AphrontView {
|
|||
|
||||
$this->requireResource('differential-core-view-css');
|
||||
$this->requireResource('differential-table-of-contents-css');
|
||||
$this->requireResource('phui-text-css');
|
||||
|
||||
$rows = array();
|
||||
|
||||
|
@ -130,6 +131,7 @@ final class DifferentialDiffTableOfContentsView extends AphrontView {
|
|||
$char = DifferentialChangeType::getSummaryCharacterForChangeType($type);
|
||||
$chartitle = DifferentialChangeType::getFullNameForChangeType($type);
|
||||
$desc = DifferentialChangeType::getShortNameForFileType($ftype);
|
||||
$color = DifferentialChangeType::getSummaryColorForChangeType($type);
|
||||
if ($desc) {
|
||||
$desc = '('.$desc.')';
|
||||
}
|
||||
|
@ -170,6 +172,8 @@ final class DifferentialDiffTableOfContentsView extends AphrontView {
|
|||
$changeset->getAbsoluteRepositoryPath($this->repository, $this->diff);
|
||||
}
|
||||
|
||||
$char = phutil_tag('span', array('class' => 'phui-text-'.$color), $char);
|
||||
|
||||
$rows[] = array(
|
||||
$char,
|
||||
$pchar,
|
||||
|
|
Loading…
Reference in a new issue