Improve inline comment previews

Summary:
  - When an inline comment preview corresponds to an inline comment on the page, link to it. Just punt in the tough case where the inline is on some other page.
  - In "haunted" mode, "z" now toggles through three modes: normal, comment area only, and comment + previews.

Test Plan:
  - Viewed visible and not-visible inline comment previews, clicked "View" links.
  - Tapped "z" a bunch to toggle haunt modes.

Reviewers: btrahan

Reviewed By: btrahan

CC: aran, epriestley

Maniphest Tasks: T517, T214

Differential Revision: https://secure.phabricator.com/D2041
This commit is contained in:
epriestley
2012-03-28 10:11:41 -07:00
parent 99b03ffd47
commit 29d8fc04e5
4 changed files with 69 additions and 21 deletions

View File

@@ -136,6 +136,8 @@ final class DifferentialInlineCommentView extends AphrontView {
}
}
$anchor_name = 'inline-'.$inline->getID();
if ($this->editable && !$this->preview) {
$links[] = javelin_render_tag(
'a',
@@ -153,6 +155,16 @@ final class DifferentialInlineCommentView extends AphrontView {
'sigil' => 'differential-inline-delete',
),
'Delete');
} else if ($this->preview) {
$links[] = javelin_render_tag(
'a',
array(
'meta' => array(
'anchor' => $anchor_name,
),
'sigil' => 'differential-inline-preview-jump',
),
'Not Visible');
}
if ($links) {
@@ -178,16 +190,18 @@ final class DifferentialInlineCommentView extends AphrontView {
}
}
$anchor_name = 'inline-'.$inline->getID();
$anchor = phutil_render_tag(
'a',
array(
'name' => $anchor_name,
'id' => $anchor_name,
'class' => 'differential-inline-comment-anchor',
),
'');
if ($this->preview) {
$anchor = null;
} else {
$anchor = phutil_render_tag(
'a',
array(
'name' => $anchor_name,
'id' => $anchor_name,
'class' => 'differential-inline-comment-anchor',
),
'');
}
$classes = array(
'differential-inline-comment',