From 9c7d1b0b90b57ea8aebfef30bb13e7bce7e973f7 Mon Sep 17 00:00:00 2001 From: epriestley Date: Mon, 4 May 2015 12:21:21 -0700 Subject: [PATCH] Highlight cell when jumping to an inline comment Summary: Fixes T8061. Test Plan: {F392321} Reviewers: chad Reviewed By: chad Subscribers: epriestley Maniphest Tasks: T8061 Differential Revision: https://secure.phabricator.com/D12705 --- resources/celerity/map.php | 10 +++++----- .../view/PHUIDiffInlineCommentDetailView.php | 19 +++++++++++++++++-- .../diff/view/PHUIDiffInlineCommentView.php | 4 ++++ .../PHUIDiffOneUpInlineCommentRowScaffold.php | 1 + .../PHUIDiffTwoUpInlineCommentRowScaffold.php | 2 ++ .../differential/phui-inline-comment.css | 5 ++--- .../differential/revision-comment.css | 4 ---- 7 files changed, 31 insertions(+), 14 deletions(-) diff --git a/resources/celerity/map.php b/resources/celerity/map.php index af09b1b846..65443516bc 100644 --- a/resources/celerity/map.php +++ b/resources/celerity/map.php @@ -10,7 +10,7 @@ return array( 'core.pkg.css' => 'ca3f6a60', 'core.pkg.js' => '3331b919', 'darkconsole.pkg.js' => 'e7393ebb', - 'differential.pkg.css' => '13312972', + 'differential.pkg.css' => 'bb338e4b', 'differential.pkg.js' => '3cfa26f9', 'diffusion.pkg.css' => '591664fa', 'diffusion.pkg.js' => '0115b37c', @@ -58,9 +58,9 @@ return array( 'rsrc/css/application/differential/add-comment.css' => 'c47f8c40', 'rsrc/css/application/differential/changeset-view.css' => 'e19cfd6e', 'rsrc/css/application/differential/core.css' => '7ac3cabc', - 'rsrc/css/application/differential/phui-inline-comment.css' => 'df8fbd63', + 'rsrc/css/application/differential/phui-inline-comment.css' => '2174771a', 'rsrc/css/application/differential/results-table.css' => '181aa9d9', - 'rsrc/css/application/differential/revision-comment.css' => '024dda6b', + 'rsrc/css/application/differential/revision-comment.css' => '14b8565a', 'rsrc/css/application/differential/revision-history.css' => '0e8eb855', 'rsrc/css/application/differential/revision-list.css' => 'f3c47d33', 'rsrc/css/application/differential/table-of-contents.css' => '63f3ef4a', @@ -530,7 +530,7 @@ return array( 'differential-inline-comment-editor' => '2529c82d', 'differential-results-table-css' => '181aa9d9', 'differential-revision-add-comment-css' => 'c47f8c40', - 'differential-revision-comment-css' => '024dda6b', + 'differential-revision-comment-css' => '14b8565a', 'differential-revision-history-css' => '0e8eb855', 'differential-revision-list-css' => 'f3c47d33', 'differential-table-of-contents-css' => '63f3ef4a', @@ -795,7 +795,7 @@ return array( 'phui-image-mask-css' => '5a8b09c8', 'phui-info-panel-css' => '27ea50a1', 'phui-info-view-css' => 'c6f0aef8', - 'phui-inline-comment-view-css' => 'df8fbd63', + 'phui-inline-comment-view-css' => '2174771a', 'phui-list-view-css' => '2e25ebfb', 'phui-object-box-css' => '7d160002', 'phui-object-item-list-view-css' => '9db65899', diff --git a/src/infrastructure/diff/view/PHUIDiffInlineCommentDetailView.php b/src/infrastructure/diff/view/PHUIDiffInlineCommentDetailView.php index 1c2a573770..e265cafad1 100644 --- a/src/infrastructure/diff/view/PHUIDiffInlineCommentDetailView.php +++ b/src/infrastructure/diff/view/PHUIDiffInlineCommentDetailView.php @@ -71,8 +71,23 @@ final class PHUIDiffInlineCommentDetailView return $this->objectOwnerPHID; } - public function render() { + public function getAnchorName() { + $inline = $this->inlineComment; + if ($inline->getID()) { + return 'inline-'.$inline->getID(); + } + return null; + } + public function getScaffoldCellID() { + $anchor = $this->getAnchorName(); + if ($anchor) { + return 'anchor-'.$anchor; + } + return null; + } + + public function render() { require_celerity_resource('phui-inline-comment-view-css'); $inline = $this->inlineComment; @@ -218,7 +233,7 @@ final class PHUIDiffInlineCommentDetailView } } - $anchor_name = 'inline-'.$inline->getID(); + $anchor_name = $this->getAnchorName(); if ($this->editable && !$this->preview) { $edit_button = id(new PHUIButtonView()) diff --git a/src/infrastructure/diff/view/PHUIDiffInlineCommentView.php b/src/infrastructure/diff/view/PHUIDiffInlineCommentView.php index 63d9aa5e45..f2f82471d6 100644 --- a/src/infrastructure/diff/view/PHUIDiffInlineCommentView.php +++ b/src/infrastructure/diff/view/PHUIDiffInlineCommentView.php @@ -13,4 +13,8 @@ abstract class PHUIDiffInlineCommentView extends AphrontView { return $this; } + public function getScaffoldCellID() { + return null; + } + } diff --git a/src/infrastructure/diff/view/PHUIDiffOneUpInlineCommentRowScaffold.php b/src/infrastructure/diff/view/PHUIDiffOneUpInlineCommentRowScaffold.php index 3ffb732a73..6b8cb0a32e 100644 --- a/src/infrastructure/diff/view/PHUIDiffOneUpInlineCommentRowScaffold.php +++ b/src/infrastructure/diff/view/PHUIDiffOneUpInlineCommentRowScaffold.php @@ -19,6 +19,7 @@ final class PHUIDiffOneUpInlineCommentRowScaffold $attrs = array( 'colspan' => 3, 'class' => 'right3', + 'id' => $inline->getScaffoldCellID(), ); $cells = array( diff --git a/src/infrastructure/diff/view/PHUIDiffTwoUpInlineCommentRowScaffold.php b/src/infrastructure/diff/view/PHUIDiffTwoUpInlineCommentRowScaffold.php index a1284ae39a..e2c2183856 100644 --- a/src/infrastructure/diff/view/PHUIDiffTwoUpInlineCommentRowScaffold.php +++ b/src/infrastructure/diff/view/PHUIDiffTwoUpInlineCommentRowScaffold.php @@ -52,11 +52,13 @@ final class PHUIDiffTwoUpInlineCommentRowScaffold $left_attrs = array( 'class' => 'left', + 'id' => ($left_side ? $left_side->getScaffoldCellID() : null), ); $right_attrs = array( 'colspan' => 3, 'class' => 'right3', + 'id' => ($right_side ? $right_side->getScaffoldCellID() : null), ); $cells = array( diff --git a/webroot/rsrc/css/application/differential/phui-inline-comment.css b/webroot/rsrc/css/application/differential/phui-inline-comment.css index d52b874dfa..5b6e2d79ee 100644 --- a/webroot/rsrc/css/application/differential/phui-inline-comment.css +++ b/webroot/rsrc/css/application/differential/phui-inline-comment.css @@ -2,9 +2,8 @@ * @provides phui-inline-comment-view-css */ -.differential-comment-list .anchor-target { - background-color: #ffffdd; - border-color: #ffff00; +.differential-diff td.anchor-target { + background: {$lightyellow}; } /* In the document, the anchor is positioned inside the inline comment, but diff --git a/webroot/rsrc/css/application/differential/revision-comment.css b/webroot/rsrc/css/application/differential/revision-comment.css index d1ccc68b44..fbf99e3aed 100644 --- a/webroot/rsrc/css/application/differential/revision-comment.css +++ b/webroot/rsrc/css/application/differential/revision-comment.css @@ -2,10 +2,6 @@ * @provides differential-revision-comment-css */ -.differential-comment-list { - margin: 0 16px; -} - /* Spooky haunted panel which floats on the bottom of the screen. Haunt modes are: