1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-10 00:42:41 +01:00

"Reply" for inline comments

Summary:
"Reply" for inline comments

Test Plan:
Add consecutive and overlapping new inline comments and replies.

Reviewed By: epriestley
Reviewers: epriestley
CC: aran, epriestley
Differential Revision: 143
This commit is contained in:
adonohue 2011-04-14 18:08:10 -07:00
parent 28155a5115
commit acd1cc8d22
3 changed files with 566 additions and 529 deletions

File diff suppressed because it is too large Load diff

View file

@ -81,6 +81,23 @@ final class DifferentialInlineCommentView extends AphrontView {
$handles = $this->handles;
$links = array();
$links[] = javelin_render_tag(
'a',
array(
'href' => '#',
'mustcapture' => true,
'sigil' => 'differential-inline-reply',
'meta' => array(
'is_new' => true,
'changeset' => $inline->getChangesetID(),
'number' => $inline->getLineNumber(),
'length' => $inline->getLineLength(),
'on_right' => $this->onRight,
)
),
'Reply');
if ($this->editable) {
$links[] = javelin_render_tag(
'a',
@ -152,27 +169,18 @@ final class DifferentialInlineCommentView extends AphrontView {
return $markup;
}
if ($this->onRight) {
$left_markup = !$this->onRight ? $markup : '';
$right_markup = $this->onRight ? $markup : '';
return
'<table>'.
'<tr>'.
'<tr class="inline">'.
'<th></th>'.
'<td></td>'.
'<td>'.$left_markup.'</td>'.
'<th></th>'.
'<td>'.$markup.'</td>'.
'<td>'.$right_markup.'</td>'.
'</tr>'.
'</table>';
} else {
return
'<table>'.
'<tr>'.
'<th></th>'.
'<td>'.$markup.'</td>'.
'<th></th>'.
'<td></td>'.
'</tr>'.
'</table>';
}
}
}

View file

@ -25,7 +25,6 @@ JX.behavior('differential-edit-inline-comments', function(config) {
top = bot;
bot = tmp;
}
var code = target.nextSibling;
var pos = JX.$V(top).add(1 + JX.$V.getDim(target).x, 0);
@ -70,6 +69,20 @@ JX.behavior('differential-edit-inline-comments', function(config) {
}
}
function isInlineCommentNode(target) {
return target &&
(!JX.DOM.isType(target, 'tr')
|| target.className.indexOf('inline') !== -1);
}
function findInlineCommentTarget(target) {
while (isInlineCommentNode(target)) {
target = target.nextSibling;
}
return target;
}
JX.Stratcom.listen(
'mousedown',
['differential-changeset', 'tag:th'],
@ -153,12 +166,7 @@ JX.behavior('differential-edit-inline-comments', function(config) {
// We're shipping around raw HTML here for performance reasons, but
// normally you should use sigils to encode this kind of data on
// the document.
var target = insert.nextSibling;
while (target &&
(!JX.DOM.isType(target, 'tr')
|| target.className.indexOf('inline') !== -1)) {
target = target.nextSibling;
}
var target = findInlineCommentTarget(insert.nextSibling);
drawInlineComment(insert.parentNode, target, r);
finishSelect();
JX.Stratcom.invoke('differential-inline-comment-update');
@ -208,6 +216,27 @@ JX.behavior('differential-edit-inline-comments', function(config) {
}
});
JX.Stratcom.listen(
'click',
[['differential-inline-comment', 'differential-inline-reply']],
function(e) {
new JX.Workflow(config.uri, e.getNodeData('differential-inline-reply'))
.setHandler(function(r) {
var base_row =
findInlineCommentTarget(
e.getNode('differential-inline-comment')
.parentNode
.parentNode
);
drawInlineComment(base_row.parentNode, base_row, r);
JX.Stratcom.invoke('differential-inline-comment-update');
})
.start();
e.kill();
}
);
JX.Stratcom.listen(
'click',
[['differential-inline-comment', 'differential-inline-delete'],