diff --git a/resources/celerity/map.php b/resources/celerity/map.php index 17138d6604..70896d400d 100644 --- a/resources/celerity/map.php +++ b/resources/celerity/map.php @@ -12,7 +12,7 @@ return array( 'core.pkg.css' => 'ce8c2a58', 'core.pkg.js' => '4c79d74f', 'darkconsole.pkg.js' => '1f9a31bc', - 'differential.pkg.css' => '45951e9e', + 'differential.pkg.css' => '1522c3ad', 'differential.pkg.js' => '19ee9979', 'diffusion.pkg.css' => 'a2d17c7d', 'diffusion.pkg.js' => '6134c5a1', @@ -121,7 +121,7 @@ return array( 'rsrc/css/font/font-awesome.css' => 'e838e088', 'rsrc/css/font/font-lato.css' => 'c7ccd872', 'rsrc/css/font/phui-font-icon-base.css' => '870a7360', - 'rsrc/css/layout/phabricator-filetree-view.css' => 'fccf9f82', + 'rsrc/css/layout/phabricator-filetree-view.css' => 'ea5b30a9', 'rsrc/css/layout/phabricator-source-code-view.css' => 'aea41829', 'rsrc/css/phui/button/phui-button-bar.css' => 'f1ff5494', 'rsrc/css/phui/button/phui-button-simple.css' => '8e1baf68', @@ -784,7 +784,7 @@ return array( 'phabricator-favicon' => '1fe2510c', 'phabricator-feed-css' => 'ecd4ec57', 'phabricator-file-upload' => '680ea2c8', - 'phabricator-filetree-view-css' => 'fccf9f82', + 'phabricator-filetree-view-css' => 'ea5b30a9', 'phabricator-flag-css' => 'bba8f811', 'phabricator-keyboard-shortcut' => '1ae869f2', 'phabricator-keyboard-shortcut-manager' => 'c19dd9b9', diff --git a/src/applications/differential/storage/DifferentialChangeset.php b/src/applications/differential/storage/DifferentialChangeset.php index ebdaeacd0a..dbb06fe72b 100644 --- a/src/applications/differential/storage/DifferentialChangeset.php +++ b/src/applications/differential/storage/DifferentialChangeset.php @@ -221,6 +221,51 @@ final class DifferentialChangeset return $this->assertAttached($this->diff); } + public function newFileTreeIcon() { + $file_type = $this->getFileType(); + $change_type = $this->getChangeType(); + + $change_icons = array( + DifferentialChangeType::TYPE_DELETE => 'fa-file-o', + ); + + if (isset($change_icons[$change_type])) { + $icon = $change_icons[$change_type]; + } else { + $icon = DifferentialChangeType::getIconForFileType($file_type); + } + + $change_colors = array( + DifferentialChangeType::TYPE_ADD => 'green', + DifferentialChangeType::TYPE_DELETE => 'red', + DifferentialChangeType::TYPE_MOVE_AWAY => 'orange', + DifferentialChangeType::TYPE_MOVE_HERE => 'orange', + DifferentialChangeType::TYPE_COPY_HERE => 'orange', + DifferentialChangeType::TYPE_MULTICOPY => 'orange', + ); + + $color = idx($change_colors, $change_type, 'bluetext'); + + return id(new PHUIIconView()) + ->setIcon($icon.' '.$color); + } + + public function getFileTreeClass() { + switch ($this->getChangeType()) { + case DifferentialChangeType::TYPE_ADD: + return 'filetree-added'; + case DifferentialChangeType::TYPE_DELETE: + return 'filetree-deleted'; + case DifferentialChangeType::TYPE_MOVE_AWAY: + case DifferentialChangeType::TYPE_MOVE_HERE: + case DifferentialChangeType::TYPE_COPY_HERE: + case DifferentialChangeType::TYPE_MULTICOPY: + return 'filetree-movecopy'; + } + + return null; + } + /* -( PhabricatorPolicyInterface )----------------------------------------- */ diff --git a/src/applications/differential/view/DifferentialChangesetFileTreeSideNavBuilder.php b/src/applications/differential/view/DifferentialChangesetFileTreeSideNavBuilder.php index 14050e942c..9781fb0d02 100644 --- a/src/applications/differential/view/DifferentialChangesetFileTreeSideNavBuilder.php +++ b/src/applications/differential/view/DifferentialChangesetFileTreeSideNavBuilder.php @@ -83,6 +83,9 @@ final class DifferentialChangesetFileTreeSideNavBuilder extends Phobject { while (($path = $path->getNextNode())) { $data = $path->getData(); + $classes = array(); + $classes[] = 'phabricator-filetree-item'; + $name = $path->getName(); $style = 'padding-left: '.(2 + (3 * $path->getDepth())).'px'; @@ -90,8 +93,9 @@ final class DifferentialChangesetFileTreeSideNavBuilder extends Phobject { if ($data) { $href = '#'.$data->getAnchorName(); $title = $name; - $icon = id(new PHUIIconView()) - ->setIcon('fa-file-text-o bluetext'); + + $icon = $data->newFileTreeIcon(); + $classes[] = $data->getFileTreeClass(); } else { $name .= '/'; $title = $path->getFullPath().'/'; @@ -112,7 +116,7 @@ final class DifferentialChangesetFileTreeSideNavBuilder extends Phobject { 'href' => $href, 'style' => $style, 'title' => $title, - 'class' => 'phabricator-filetree-item', + 'class' => implode(' ', $classes), ), array($icon, $name_element)); } diff --git a/webroot/rsrc/css/layout/phabricator-filetree-view.css b/webroot/rsrc/css/layout/phabricator-filetree-view.css index b247f5e4f9..21bbe9f0af 100644 --- a/webroot/rsrc/css/layout/phabricator-filetree-view.css +++ b/webroot/rsrc/css/layout/phabricator-filetree-view.css @@ -54,3 +54,15 @@ background-color: {$hovergrey}; border-left: 4px solid {$sky}; } + +.phabricator-filetree .filetree-added { + background: {$sh-greenbackground}; +} + +.phabricator-filetree .filetree-deleted { + background: {$sh-redbackground}; +} + +.phabricator-filetree .filetree-movecopy { + background: {$sh-orangebackground}; +}