mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-23 14:00:56 +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:
parent
28155a5115
commit
acd1cc8d22
3 changed files with 566 additions and 529 deletions
File diff suppressed because it is too large
Load diff
|
@ -81,6 +81,23 @@ final class DifferentialInlineCommentView extends AphrontView {
|
||||||
$handles = $this->handles;
|
$handles = $this->handles;
|
||||||
|
|
||||||
$links = array();
|
$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) {
|
if ($this->editable) {
|
||||||
$links[] = javelin_render_tag(
|
$links[] = javelin_render_tag(
|
||||||
'a',
|
'a',
|
||||||
|
@ -152,27 +169,18 @@ final class DifferentialInlineCommentView extends AphrontView {
|
||||||
return $markup;
|
return $markup;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->onRight) {
|
$left_markup = !$this->onRight ? $markup : '';
|
||||||
|
$right_markup = $this->onRight ? $markup : '';
|
||||||
|
|
||||||
return
|
return
|
||||||
'<table>'.
|
'<table>'.
|
||||||
'<tr>'.
|
'<tr class="inline">'.
|
||||||
'<th></th>'.
|
'<th></th>'.
|
||||||
'<td></td>'.
|
'<td>'.$left_markup.'</td>'.
|
||||||
'<th></th>'.
|
'<th></th>'.
|
||||||
'<td>'.$markup.'</td>'.
|
'<td>'.$right_markup.'</td>'.
|
||||||
'</tr>'.
|
'</tr>'.
|
||||||
'</table>';
|
'</table>';
|
||||||
} else {
|
|
||||||
return
|
|
||||||
'<table>'.
|
|
||||||
'<tr>'.
|
|
||||||
'<th></th>'.
|
|
||||||
'<td>'.$markup.'</td>'.
|
|
||||||
'<th></th>'.
|
|
||||||
'<td></td>'.
|
|
||||||
'</tr>'.
|
|
||||||
'</table>';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,6 @@ JX.behavior('differential-edit-inline-comments', function(config) {
|
||||||
top = bot;
|
top = bot;
|
||||||
bot = tmp;
|
bot = tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
var code = target.nextSibling;
|
var code = target.nextSibling;
|
||||||
|
|
||||||
var pos = JX.$V(top).add(1 + JX.$V.getDim(target).x, 0);
|
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(
|
JX.Stratcom.listen(
|
||||||
'mousedown',
|
'mousedown',
|
||||||
['differential-changeset', 'tag:th'],
|
['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
|
// We're shipping around raw HTML here for performance reasons, but
|
||||||
// normally you should use sigils to encode this kind of data on
|
// normally you should use sigils to encode this kind of data on
|
||||||
// the document.
|
// the document.
|
||||||
var target = insert.nextSibling;
|
var target = findInlineCommentTarget(insert.nextSibling);
|
||||||
while (target &&
|
|
||||||
(!JX.DOM.isType(target, 'tr')
|
|
||||||
|| target.className.indexOf('inline') !== -1)) {
|
|
||||||
target = target.nextSibling;
|
|
||||||
}
|
|
||||||
drawInlineComment(insert.parentNode, target, r);
|
drawInlineComment(insert.parentNode, target, r);
|
||||||
finishSelect();
|
finishSelect();
|
||||||
JX.Stratcom.invoke('differential-inline-comment-update');
|
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(
|
JX.Stratcom.listen(
|
||||||
'click',
|
'click',
|
||||||
[['differential-inline-comment', 'differential-inline-delete'],
|
[['differential-inline-comment', 'differential-inline-delete'],
|
||||||
|
|
Loading…
Reference in a new issue