mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-29 18:22:41 +01:00
Add "Undo" for editing Differential inline comments
Summary: When a user hits 'cancel' on a 'new', 'edit', or 'reply' operation, add a little "Changes discarded. __Undo__" insert so they can get their change back. No undo for delete since there's an explicit prompt. Once this lands we can make 'escape' work again to close dialogs. This change started feeling really good when I was merging all the duplicate code and making things more consistent, but by the time I started writing client rendering it felt gross. I'm not really thrilled with it but I guess it's a step forward? The feature seems pretty OK in practice. Let me know how much barfing this causes and I can try to remedy the most acute concerns. This also fixes a bug where replies always (?) appear on the 'new' side of the diff (I think?). Test Plan: Applied 'new', 'edit', 'delete' and 'reply' operations, pressed 'cancel' and 'okay' in each case, with and without changing text where relevant. All behaviors seem to conform with expectations, except that canceling out of 'edit' without changing the text gives you an option to undo when it shouldn't really. There's no super easy way to get at the original text right now. Reviewed By: aran Reviewers: aran, jungejason, tuomaspelkonen CC: simpkins, aran, epriestley Differential Revision: 406
This commit is contained in:
parent
19d0d28089
commit
94d0adb140
13 changed files with 420 additions and 191 deletions
|
@ -145,7 +145,7 @@ celerity_register_resource_map(array(
|
||||||
),
|
),
|
||||||
'differential-changeset-view-css' =>
|
'differential-changeset-view-css' =>
|
||||||
array(
|
array(
|
||||||
'uri' => '/res/4cb57f5f/rsrc/css/application/differential/changeset-view.css',
|
'uri' => '/res/313e96e9/rsrc/css/application/differential/changeset-view.css',
|
||||||
'type' => 'css',
|
'type' => 'css',
|
||||||
'requires' =>
|
'requires' =>
|
||||||
array(
|
array(
|
||||||
|
@ -161,6 +161,20 @@ celerity_register_resource_map(array(
|
||||||
),
|
),
|
||||||
'disk' => '/rsrc/css/application/differential/core.css',
|
'disk' => '/rsrc/css/application/differential/core.css',
|
||||||
),
|
),
|
||||||
|
'differential-inline-comment-editor' =>
|
||||||
|
array(
|
||||||
|
'uri' => '/res/0ee4fd79/rsrc/js/application/differential/DifferentialInlineCommentEditor.js',
|
||||||
|
'type' => 'js',
|
||||||
|
'requires' =>
|
||||||
|
array(
|
||||||
|
0 => 'javelin-dom',
|
||||||
|
1 => 'javelin-workflow',
|
||||||
|
2 => 'javelin-util',
|
||||||
|
3 => 'javelin-stratcom',
|
||||||
|
4 => 'javelin-install',
|
||||||
|
),
|
||||||
|
'disk' => '/rsrc/js/application/differential/DifferentialInlineCommentEditor.js',
|
||||||
|
),
|
||||||
'differential-revision-add-comment-css' =>
|
'differential-revision-add-comment-css' =>
|
||||||
array(
|
array(
|
||||||
'uri' => '/res/849748d3/rsrc/css/application/differential/add-comment.css',
|
'uri' => '/res/849748d3/rsrc/css/application/differential/add-comment.css',
|
||||||
|
@ -197,16 +211,6 @@ celerity_register_resource_map(array(
|
||||||
),
|
),
|
||||||
'disk' => '/rsrc/css/application/differential/revision-detail.css',
|
'disk' => '/rsrc/css/application/differential/revision-detail.css',
|
||||||
),
|
),
|
||||||
0 =>
|
|
||||||
array(
|
|
||||||
'uri' => '/res/39de799e/rsrc/js/javelin/docs/Base.js',
|
|
||||||
'type' => 'js',
|
|
||||||
'requires' =>
|
|
||||||
array(
|
|
||||||
0 => 'javelin-install',
|
|
||||||
),
|
|
||||||
'disk' => '/rsrc/js/javelin/docs/Base.js',
|
|
||||||
),
|
|
||||||
'differential-revision-history-css' =>
|
'differential-revision-history-css' =>
|
||||||
array(
|
array(
|
||||||
'uri' => '/res/0d7d515d/rsrc/css/application/differential/revision-history.css',
|
'uri' => '/res/0d7d515d/rsrc/css/application/differential/revision-history.css',
|
||||||
|
@ -289,6 +293,16 @@ celerity_register_resource_map(array(
|
||||||
),
|
),
|
||||||
'disk' => '/rsrc/js/javelin/lib/behavior.js',
|
'disk' => '/rsrc/js/javelin/lib/behavior.js',
|
||||||
),
|
),
|
||||||
|
0 =>
|
||||||
|
array(
|
||||||
|
'uri' => '/res/39de799e/rsrc/js/javelin/docs/Base.js',
|
||||||
|
'type' => 'js',
|
||||||
|
'requires' =>
|
||||||
|
array(
|
||||||
|
0 => 'javelin-install',
|
||||||
|
),
|
||||||
|
'disk' => '/rsrc/js/javelin/docs/Base.js',
|
||||||
|
),
|
||||||
'javelin-behavior-aphront-basic-tokenizer' =>
|
'javelin-behavior-aphront-basic-tokenizer' =>
|
||||||
array(
|
array(
|
||||||
'uri' => '/res/bce3961b/rsrc/js/application/core/behavior-tokenizer.js',
|
'uri' => '/res/bce3961b/rsrc/js/application/core/behavior-tokenizer.js',
|
||||||
|
@ -383,15 +397,16 @@ celerity_register_resource_map(array(
|
||||||
),
|
),
|
||||||
'javelin-behavior-differential-edit-inline-comments' =>
|
'javelin-behavior-differential-edit-inline-comments' =>
|
||||||
array(
|
array(
|
||||||
'uri' => '/res/682d1a9c/rsrc/js/application/differential/behavior-edit-inline-comments.js',
|
'uri' => '/res/e21bb634/rsrc/js/application/differential/behavior-edit-inline-comments.js',
|
||||||
'type' => 'js',
|
'type' => 'js',
|
||||||
'requires' =>
|
'requires' =>
|
||||||
array(
|
array(
|
||||||
0 => 'javelin-behavior',
|
0 => 'javelin-behavior',
|
||||||
1 => 'javelin-stratcom',
|
1 => 'javelin-stratcom',
|
||||||
2 => 'javelin-dom',
|
2 => 'javelin-dom',
|
||||||
3 => 'javelin-workflow',
|
3 => 'javelin-util',
|
||||||
4 => 'javelin-vector',
|
4 => 'javelin-vector',
|
||||||
|
5 => 'differential-inline-comment-editor',
|
||||||
),
|
),
|
||||||
'disk' => '/rsrc/js/application/differential/behavior-edit-inline-comments.js',
|
'disk' => '/rsrc/js/application/differential/behavior-edit-inline-comments.js',
|
||||||
),
|
),
|
||||||
|
@ -437,7 +452,7 @@ celerity_register_resource_map(array(
|
||||||
),
|
),
|
||||||
'javelin-behavior-differential-show-more' =>
|
'javelin-behavior-differential-show-more' =>
|
||||||
array(
|
array(
|
||||||
'uri' => '/res/9cbf1c9c/rsrc/js/application/differential/behavior-show-more.js',
|
'uri' => '/res/a766c717/rsrc/js/application/differential/behavior-show-more.js',
|
||||||
'type' => 'js',
|
'type' => 'js',
|
||||||
'requires' =>
|
'requires' =>
|
||||||
array(
|
array(
|
||||||
|
@ -1042,6 +1057,23 @@ celerity_register_resource_map(array(
|
||||||
'uri' => '/res/pkg/03ef179e/diffusion.pkg.css',
|
'uri' => '/res/pkg/03ef179e/diffusion.pkg.css',
|
||||||
'type' => 'css',
|
'type' => 'css',
|
||||||
),
|
),
|
||||||
|
'234a821b' =>
|
||||||
|
array (
|
||||||
|
'name' => 'differential.pkg.css',
|
||||||
|
'symbols' =>
|
||||||
|
array (
|
||||||
|
0 => 'differential-core-view-css',
|
||||||
|
1 => 'differential-changeset-view-css',
|
||||||
|
2 => 'differential-revision-detail-css',
|
||||||
|
3 => 'differential-revision-history-css',
|
||||||
|
4 => 'differential-table-of-contents-css',
|
||||||
|
5 => 'differential-revision-comment-css',
|
||||||
|
6 => 'differential-revision-add-comment-css',
|
||||||
|
7 => 'differential-revision-comment-list-css',
|
||||||
|
),
|
||||||
|
'uri' => '/res/pkg/234a821b/differential.pkg.css',
|
||||||
|
'type' => 'css',
|
||||||
|
),
|
||||||
'33f413ef' =>
|
'33f413ef' =>
|
||||||
array (
|
array (
|
||||||
'name' => 'typeahead.pkg.js',
|
'name' => 'typeahead.pkg.js',
|
||||||
|
@ -1082,23 +1114,6 @@ celerity_register_resource_map(array(
|
||||||
'uri' => '/res/pkg/64383b02/core.pkg.css',
|
'uri' => '/res/pkg/64383b02/core.pkg.css',
|
||||||
'type' => 'css',
|
'type' => 'css',
|
||||||
),
|
),
|
||||||
'b1200c80' =>
|
|
||||||
array (
|
|
||||||
'name' => 'differential.pkg.css',
|
|
||||||
'symbols' =>
|
|
||||||
array (
|
|
||||||
0 => 'differential-core-view-css',
|
|
||||||
1 => 'differential-changeset-view-css',
|
|
||||||
2 => 'differential-revision-detail-css',
|
|
||||||
3 => 'differential-revision-history-css',
|
|
||||||
4 => 'differential-table-of-contents-css',
|
|
||||||
5 => 'differential-revision-comment-css',
|
|
||||||
6 => 'differential-revision-add-comment-css',
|
|
||||||
7 => 'differential-revision-comment-list-css',
|
|
||||||
),
|
|
||||||
'uri' => '/res/pkg/b1200c80/differential.pkg.css',
|
|
||||||
'type' => 'css',
|
|
||||||
),
|
|
||||||
'db95a6d0' =>
|
'db95a6d0' =>
|
||||||
array (
|
array (
|
||||||
'name' => 'javelin.pkg.js',
|
'name' => 'javelin.pkg.js',
|
||||||
|
@ -1134,7 +1149,7 @@ celerity_register_resource_map(array(
|
||||||
'uri' => '/res/pkg/e26c5e06/workflow.pkg.js',
|
'uri' => '/res/pkg/e26c5e06/workflow.pkg.js',
|
||||||
'type' => 'js',
|
'type' => 'js',
|
||||||
),
|
),
|
||||||
'ed383f69' =>
|
'f292b274' =>
|
||||||
array (
|
array (
|
||||||
'name' => 'differential.pkg.js',
|
'name' => 'differential.pkg.js',
|
||||||
'symbols' =>
|
'symbols' =>
|
||||||
|
@ -1145,7 +1160,7 @@ celerity_register_resource_map(array(
|
||||||
3 => 'javelin-behavior-differential-show-more',
|
3 => 'javelin-behavior-differential-show-more',
|
||||||
4 => 'javelin-behavior-differential-diff-radios',
|
4 => 'javelin-behavior-differential-diff-radios',
|
||||||
),
|
),
|
||||||
'uri' => '/res/pkg/ed383f69/differential.pkg.js',
|
'uri' => '/res/pkg/f292b274/differential.pkg.js',
|
||||||
'type' => 'js',
|
'type' => 'js',
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -1160,23 +1175,23 @@ celerity_register_resource_map(array(
|
||||||
'aphront-table-view-css' => '64383b02',
|
'aphront-table-view-css' => '64383b02',
|
||||||
'aphront-tokenizer-control-css' => '64383b02',
|
'aphront-tokenizer-control-css' => '64383b02',
|
||||||
'aphront-typeahead-control-css' => '64383b02',
|
'aphront-typeahead-control-css' => '64383b02',
|
||||||
'differential-changeset-view-css' => 'b1200c80',
|
'differential-changeset-view-css' => '234a821b',
|
||||||
'differential-core-view-css' => 'b1200c80',
|
'differential-core-view-css' => '234a821b',
|
||||||
'differential-revision-add-comment-css' => 'b1200c80',
|
'differential-revision-add-comment-css' => '234a821b',
|
||||||
'differential-revision-comment-css' => 'b1200c80',
|
'differential-revision-comment-css' => '234a821b',
|
||||||
'differential-revision-comment-list-css' => 'b1200c80',
|
'differential-revision-comment-list-css' => '234a821b',
|
||||||
'differential-revision-detail-css' => 'b1200c80',
|
'differential-revision-detail-css' => '234a821b',
|
||||||
'differential-revision-history-css' => 'b1200c80',
|
'differential-revision-history-css' => '234a821b',
|
||||||
'differential-table-of-contents-css' => 'b1200c80',
|
'differential-table-of-contents-css' => '234a821b',
|
||||||
'diffusion-commit-view-css' => '03ef179e',
|
'diffusion-commit-view-css' => '03ef179e',
|
||||||
'javelin-behavior' => 'db95a6d0',
|
'javelin-behavior' => 'db95a6d0',
|
||||||
'javelin-behavior-aphront-basic-tokenizer' => '33f413ef',
|
'javelin-behavior-aphront-basic-tokenizer' => '33f413ef',
|
||||||
'javelin-behavior-aphront-form-disable-on-submit' => 'e26c5e06',
|
'javelin-behavior-aphront-form-disable-on-submit' => 'e26c5e06',
|
||||||
'javelin-behavior-differential-diff-radios' => 'ed383f69',
|
'javelin-behavior-differential-diff-radios' => 'f292b274',
|
||||||
'javelin-behavior-differential-edit-inline-comments' => 'ed383f69',
|
'javelin-behavior-differential-edit-inline-comments' => 'f292b274',
|
||||||
'javelin-behavior-differential-feedback-preview' => 'ed383f69',
|
'javelin-behavior-differential-feedback-preview' => 'f292b274',
|
||||||
'javelin-behavior-differential-populate' => 'ed383f69',
|
'javelin-behavior-differential-populate' => 'f292b274',
|
||||||
'javelin-behavior-differential-show-more' => 'ed383f69',
|
'javelin-behavior-differential-show-more' => 'f292b274',
|
||||||
'javelin-behavior-phabricator-keyboard-shortcuts' => 'e26c5e06',
|
'javelin-behavior-phabricator-keyboard-shortcuts' => 'e26c5e06',
|
||||||
'javelin-behavior-workflow' => 'e26c5e06',
|
'javelin-behavior-workflow' => 'e26c5e06',
|
||||||
'javelin-dom' => 'db95a6d0',
|
'javelin-dom' => 'db95a6d0',
|
||||||
|
|
|
@ -49,24 +49,9 @@ class DifferentialInlineCommentEditController extends DifferentialController {
|
||||||
$edit_dialog->addSubmitButton();
|
$edit_dialog->addSubmitButton();
|
||||||
$edit_dialog->addCancelButton('#');
|
$edit_dialog->addCancelButton('#');
|
||||||
|
|
||||||
$inline = null;
|
|
||||||
if ($inline_id) {
|
|
||||||
$inline = id(new DifferentialInlineComment())
|
|
||||||
->load($inline_id);
|
|
||||||
|
|
||||||
if (!$inline ||
|
|
||||||
$inline->getAuthorPHID() != $user->getPHID() ||
|
|
||||||
$inline->getCommentID() ||
|
|
||||||
$inline->getRevisionID() != $this->revisionID) {
|
|
||||||
throw new Exception("That comment is not editable!");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
switch ($op) {
|
switch ($op) {
|
||||||
case 'delete':
|
case 'delete':
|
||||||
if (!$inline) {
|
$inline = $this->loadInlineCommentForEditing($inline_id);
|
||||||
return new Aphront400Response();
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($request->isFormPost()) {
|
if ($request->isFormPost()) {
|
||||||
$inline->delete();
|
$inline->delete();
|
||||||
|
@ -81,9 +66,7 @@ class DifferentialInlineCommentEditController extends DifferentialController {
|
||||||
|
|
||||||
return id(new AphrontDialogResponse())->setDialog($edit_dialog);
|
return id(new AphrontDialogResponse())->setDialog($edit_dialog);
|
||||||
case 'edit':
|
case 'edit':
|
||||||
if (!$inline) {
|
$inline = $this->loadInlineCommentForEditing($inline_id);
|
||||||
return new Aphront400Response();
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($request->isFormPost()) {
|
if ($request->isFormPost()) {
|
||||||
if (strlen($text)) {
|
if (strlen($text)) {
|
||||||
|
@ -106,7 +89,7 @@ class DifferentialInlineCommentEditController extends DifferentialController {
|
||||||
|
|
||||||
$edit_dialog->appendChild(
|
$edit_dialog->appendChild(
|
||||||
$this->renderTextArea(
|
$this->renderTextArea(
|
||||||
$inline->getContent()));
|
nonempty($text, $inline->getContent())));
|
||||||
|
|
||||||
return id(new AphrontDialogResponse())->setDialog($edit_dialog);
|
return id(new AphrontDialogResponse())->setDialog($edit_dialog);
|
||||||
case 'create':
|
case 'create':
|
||||||
|
@ -134,8 +117,21 @@ class DifferentialInlineCommentEditController extends DifferentialController {
|
||||||
->save();
|
->save();
|
||||||
|
|
||||||
return $this->buildRenderedCommentResponse($inline, $on_right);
|
return $this->buildRenderedCommentResponse($inline, $on_right);
|
||||||
|
|
||||||
|
case 'reply':
|
||||||
default:
|
default:
|
||||||
|
|
||||||
|
if ($op == 'reply') {
|
||||||
|
$inline = $this->loadInlineComment($inline_id);
|
||||||
|
// Override defaults.
|
||||||
|
$changeset = $inline->getChangesetID();
|
||||||
|
$is_new = $inline->getIsNewFile();
|
||||||
|
$number = $inline->getLineNumber();
|
||||||
|
$length = $inline->getLineLength();
|
||||||
|
$edit_dialog->setTitle('Reply to Inline Comment');
|
||||||
|
} else {
|
||||||
$edit_dialog->setTitle('New Inline Comment');
|
$edit_dialog->setTitle('New Inline Comment');
|
||||||
|
}
|
||||||
|
|
||||||
$edit_dialog->addHiddenInput('op', 'create');
|
$edit_dialog->addHiddenInput('op', 'create');
|
||||||
$edit_dialog->addHiddenInput('changeset', $changeset);
|
$edit_dialog->addHiddenInput('changeset', $changeset);
|
||||||
|
@ -143,7 +139,7 @@ class DifferentialInlineCommentEditController extends DifferentialController {
|
||||||
$edit_dialog->addHiddenInput('number', $number);
|
$edit_dialog->addHiddenInput('number', $number);
|
||||||
$edit_dialog->addHiddenInput('length', $length);
|
$edit_dialog->addHiddenInput('length', $length);
|
||||||
|
|
||||||
$edit_dialog->appendChild($this->renderTextArea(''));
|
$edit_dialog->appendChild($this->renderTextArea($text));
|
||||||
|
|
||||||
return id(new AphrontDialogResponse())->setDialog($edit_dialog);
|
return id(new AphrontDialogResponse())->setDialog($edit_dialog);
|
||||||
}
|
}
|
||||||
|
@ -189,13 +185,61 @@ class DifferentialInlineCommentEditController extends DifferentialController {
|
||||||
}
|
}
|
||||||
|
|
||||||
private function renderTextArea($text) {
|
private function renderTextArea($text) {
|
||||||
return phutil_render_tag(
|
return javelin_render_tag(
|
||||||
'textarea',
|
'textarea',
|
||||||
array(
|
array(
|
||||||
'class' => 'differential-inline-comment-edit-textarea',
|
'class' => 'differential-inline-comment-edit-textarea',
|
||||||
|
'sigil' => 'differential-inline-comment-edit-textarea',
|
||||||
'name' => 'text',
|
'name' => 'text',
|
||||||
),
|
),
|
||||||
phutil_escape_html($text));
|
phutil_escape_html($text));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function loadInlineComment($id) {
|
||||||
|
$inline = null;
|
||||||
|
|
||||||
|
if ($id) {
|
||||||
|
$inline = id(new DifferentialInlineComment())->load($id);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$inline) {
|
||||||
|
throw new Exception("No such inline comment!");
|
||||||
|
}
|
||||||
|
|
||||||
|
return $inline;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function loadInlineCommentForEditing($id) {
|
||||||
|
$inline = $this->loadInlineComment($id);
|
||||||
|
$user = $this->getRequest()->getUser();
|
||||||
|
|
||||||
|
if (!$this->canEditInlineComment($user, $inline, $this->revisionID)) {
|
||||||
|
throw new Exception("That comment is not editable!");
|
||||||
|
}
|
||||||
|
return $inline;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function canEditInlineComment(
|
||||||
|
PhabricatorUser $user,
|
||||||
|
DifferentialInlineComment $inline,
|
||||||
|
$revision_id) {
|
||||||
|
|
||||||
|
// Only the author may edit a comment.
|
||||||
|
if ($inline->getAuthorPHID() != $user->getPHID()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Saved comments may not be edited.
|
||||||
|
if ($inline->getCommentID()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Inline must be attached to the active revision.
|
||||||
|
if ($inline->getRevisionID() != $revision_id) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,6 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
phutil_require_module('phabricator', 'aphront/response/400');
|
|
||||||
phutil_require_module('phabricator', 'aphront/response/ajax');
|
phutil_require_module('phabricator', 'aphront/response/ajax');
|
||||||
phutil_require_module('phabricator', 'aphront/response/dialog');
|
phutil_require_module('phabricator', 'aphront/response/dialog');
|
||||||
phutil_require_module('phabricator', 'applications/differential/controller/base');
|
phutil_require_module('phabricator', 'applications/differential/controller/base');
|
||||||
|
@ -16,6 +15,7 @@ phutil_require_module('phabricator', 'applications/differential/storage/inlineco
|
||||||
phutil_require_module('phabricator', 'applications/differential/storage/revision');
|
phutil_require_module('phabricator', 'applications/differential/storage/revision');
|
||||||
phutil_require_module('phabricator', 'applications/differential/view/inlinecomment');
|
phutil_require_module('phabricator', 'applications/differential/view/inlinecomment');
|
||||||
phutil_require_module('phabricator', 'applications/phid/handle/data');
|
phutil_require_module('phabricator', 'applications/phid/handle/data');
|
||||||
|
phutil_require_module('phabricator', 'infrastructure/javelin/markup');
|
||||||
phutil_require_module('phabricator', 'view/dialog');
|
phutil_require_module('phabricator', 'view/dialog');
|
||||||
|
|
||||||
phutil_require_module('phutil', 'markup');
|
phutil_require_module('phutil', 'markup');
|
||||||
|
|
|
@ -83,13 +83,6 @@ class DifferentialChangesetDetailView extends AphrontView {
|
||||||
'<div style="clear: both;"></div>'.
|
'<div style="clear: both;"></div>'.
|
||||||
$this->renderChildren());
|
$this->renderChildren());
|
||||||
|
|
||||||
if ($edit) {
|
|
||||||
Javelin::initBehavior(
|
|
||||||
'differential-edit-inline-comments', array(
|
|
||||||
'uri' => '/differential/comment/inline/edit/'.$this->revisionID.'/',
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,6 @@
|
||||||
|
|
||||||
|
|
||||||
phutil_require_module('phabricator', 'infrastructure/celerity/api');
|
phutil_require_module('phabricator', 'infrastructure/celerity/api');
|
||||||
phutil_require_module('phabricator', 'infrastructure/javelin/api');
|
|
||||||
phutil_require_module('phabricator', 'infrastructure/javelin/markup');
|
phutil_require_module('phabricator', 'infrastructure/javelin/markup');
|
||||||
phutil_require_module('phabricator', 'view/base');
|
phutil_require_module('phabricator', 'view/base');
|
||||||
|
|
||||||
|
|
|
@ -126,9 +126,13 @@ class DifferentialChangesetListView extends AphrontView {
|
||||||
Javelin::initBehavior('differential-comment-jump', array());
|
Javelin::initBehavior('differential-comment-jump', array());
|
||||||
|
|
||||||
if ($this->editable) {
|
if ($this->editable) {
|
||||||
|
|
||||||
|
$undo_templates = $this->renderUndoTemplates();
|
||||||
|
|
||||||
$revision = $this->revision;
|
$revision = $this->revision;
|
||||||
Javelin::initBehavior('differential-edit-inline-comments', array(
|
Javelin::initBehavior('differential-edit-inline-comments', array(
|
||||||
'uri' => '/differential/comment/inline/edit/'.$revision->getID().'/',
|
'uri' => '/differential/comment/inline/edit/'.$revision->getID().'/',
|
||||||
|
'undo_templates' => $undo_templates,
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -138,4 +142,35 @@ class DifferentialChangesetListView extends AphrontView {
|
||||||
'</div>';
|
'</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Render the "Undo" markup for the inline comment undo feature.
|
||||||
|
*/
|
||||||
|
private function renderUndoTemplates() {
|
||||||
|
$link = javelin_render_tag(
|
||||||
|
'a',
|
||||||
|
array(
|
||||||
|
'href' => '#',
|
||||||
|
'sigil' => 'differential-inline-comment-undo',
|
||||||
|
),
|
||||||
|
'Undo');
|
||||||
|
|
||||||
|
$div = phutil_render_tag(
|
||||||
|
'div',
|
||||||
|
array(
|
||||||
|
'class' => 'differential-inline-undo',
|
||||||
|
),
|
||||||
|
'Changes discarded. '.$link);
|
||||||
|
|
||||||
|
$content = '<th></th><td>'.$div.'</td>';
|
||||||
|
$empty = '<th></th><td></td>';
|
||||||
|
|
||||||
|
$left = array($content, $empty);
|
||||||
|
$right = array($empty, $content);
|
||||||
|
|
||||||
|
return array(
|
||||||
|
'l' => '<table><tr>'.implode('', $left).'</tr></table>',
|
||||||
|
'r' => '<table><tr>'.implode('', $right).'</tr></table>',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
phutil_require_module('phabricator', 'applications/differential/view/changesetdetailview');
|
phutil_require_module('phabricator', 'applications/differential/view/changesetdetailview');
|
||||||
phutil_require_module('phabricator', 'infrastructure/celerity/api');
|
phutil_require_module('phabricator', 'infrastructure/celerity/api');
|
||||||
phutil_require_module('phabricator', 'infrastructure/javelin/api');
|
phutil_require_module('phabricator', 'infrastructure/javelin/api');
|
||||||
|
phutil_require_module('phabricator', 'infrastructure/javelin/markup');
|
||||||
phutil_require_module('phabricator', 'view/base');
|
phutil_require_module('phabricator', 'view/base');
|
||||||
|
|
||||||
phutil_require_module('phutil', 'markup');
|
phutil_require_module('phutil', 'markup');
|
||||||
|
|
|
@ -73,6 +73,7 @@ final class DifferentialInlineCommentView extends AphrontView {
|
||||||
'number' => $inline->getLineNumber(),
|
'number' => $inline->getLineNumber(),
|
||||||
'length' => $inline->getLineLength(),
|
'length' => $inline->getLineLength(),
|
||||||
'on_right' => $this->onRight,
|
'on_right' => $this->onRight,
|
||||||
|
'original' => $inline->getContent(),
|
||||||
);
|
);
|
||||||
|
|
||||||
$sigil = 'differential-inline-comment';
|
$sigil = 'differential-inline-comment';
|
||||||
|
@ -106,13 +107,6 @@ final class DifferentialInlineCommentView extends AphrontView {
|
||||||
'href' => '#',
|
'href' => '#',
|
||||||
'mustcapture' => true,
|
'mustcapture' => true,
|
||||||
'sigil' => 'differential-inline-reply',
|
'sigil' => 'differential-inline-reply',
|
||||||
'meta' => array(
|
|
||||||
'is_new' => true,
|
|
||||||
'changeset' => $inline->getChangesetID(),
|
|
||||||
'number' => $inline->getLineNumber(),
|
|
||||||
'length' => $inline->getLineLength(),
|
|
||||||
'on_right' => $this->onRight,
|
|
||||||
)
|
|
||||||
),
|
),
|
||||||
'Reply');
|
'Reply');
|
||||||
|
|
||||||
|
|
|
@ -78,7 +78,7 @@ class PhabricatorJavelinLinter extends ArcanistLinter {
|
||||||
// TODO: Write build documentation for the Javelin binaries and point
|
// TODO: Write build documentation for the Javelin binaries and point
|
||||||
// the user at it.
|
// the user at it.
|
||||||
$this->raiseLintAtLine(
|
$this->raiseLintAtLine(
|
||||||
0,
|
1,
|
||||||
0,
|
0,
|
||||||
self::LINT_MISSING_BINARY,
|
self::LINT_MISSING_BINARY,
|
||||||
"The 'javelinsymbols' binary in the Javelin project has not been ".
|
"The 'javelinsymbols' binary in the Javelin project has not been ".
|
||||||
|
|
|
@ -181,7 +181,6 @@
|
||||||
margin-left: 8px;
|
margin-left: 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
.differential-property-table {
|
.differential-property-table {
|
||||||
width: auto;
|
width: auto;
|
||||||
margin: .75em auto;
|
margin: .75em auto;
|
||||||
|
@ -229,3 +228,16 @@
|
||||||
.differential-property-table tr.property-table-header td.nval {
|
.differential-property-table tr.property-table-header td.nval {
|
||||||
background: #aaffaa;
|
background: #aaffaa;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.differential-inline-undo {
|
||||||
|
padding: 4px;
|
||||||
|
text-align: center;
|
||||||
|
background: #ffeeaa;
|
||||||
|
margin: 3px 0 1px;
|
||||||
|
font: 11px "Verdana";
|
||||||
|
color: 444444;
|
||||||
|
}
|
||||||
|
|
||||||
|
.differential-inline-undo a {
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,197 @@
|
||||||
|
/**
|
||||||
|
* @provides differential-inline-comment-editor
|
||||||
|
* @requires javelin-dom
|
||||||
|
* javelin-workflow
|
||||||
|
* javelin-util
|
||||||
|
* javelin-stratcom
|
||||||
|
* javelin-install
|
||||||
|
*/
|
||||||
|
|
||||||
|
JX.install('DifferentialInlineCommentEditor', {
|
||||||
|
|
||||||
|
construct : function(uri) {
|
||||||
|
this._uri = uri;
|
||||||
|
},
|
||||||
|
|
||||||
|
events : ['done'],
|
||||||
|
|
||||||
|
members : {
|
||||||
|
_uri : null,
|
||||||
|
_undoText : null,
|
||||||
|
_skipOverInlineCommentRows : function(node) {
|
||||||
|
// TODO: Move this semantic information out of class names.
|
||||||
|
while (node && node.className.indexOf('inline') !== -1) {
|
||||||
|
node = node.nextSibling;
|
||||||
|
}
|
||||||
|
return node;
|
||||||
|
},
|
||||||
|
_buildRequestData : function() {
|
||||||
|
return {
|
||||||
|
op : this.getOperation(),
|
||||||
|
on_right : this.getOnRight(),
|
||||||
|
id : this.getID(),
|
||||||
|
number : this.getLineNumber(),
|
||||||
|
is_new : this.getIsNew(),
|
||||||
|
length : this.getLength(),
|
||||||
|
changeset : this.getChangeset(),
|
||||||
|
text : this.getText() || ''
|
||||||
|
};
|
||||||
|
},
|
||||||
|
_draw : function(content, exact_row) {
|
||||||
|
var row = this.getRow();
|
||||||
|
var table = row.parentNode;
|
||||||
|
var target = exact_row ? row : this._skipOverInlineCommentRows(row);
|
||||||
|
|
||||||
|
return copyRows(table, content, target);
|
||||||
|
},
|
||||||
|
_removeUndoLink : function() {
|
||||||
|
var rows = JX.DifferentialInlineCommentEditor._undoRows;
|
||||||
|
if (rows) {
|
||||||
|
for (var ii = 0; ii < rows.length; ii++) {
|
||||||
|
JX.DOM.remove(rows[ii]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
_undo : function() {
|
||||||
|
this._removeUndoLink();
|
||||||
|
|
||||||
|
this.setText(this._undoText);
|
||||||
|
this.start();
|
||||||
|
},
|
||||||
|
_registerUndoListener : function() {
|
||||||
|
if (!JX.DifferentialInlineCommentEditor._activeEditor) {
|
||||||
|
JX.Stratcom.listen(
|
||||||
|
'click',
|
||||||
|
'differential-inline-comment-undo',
|
||||||
|
function(e) {
|
||||||
|
JX.DifferentialInlineCommentEditor._activeEditor._undo();
|
||||||
|
e.kill();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
JX.DifferentialInlineCommentEditor._activeEditor = this;
|
||||||
|
},
|
||||||
|
_didCompleteWorkflow : function(response) {
|
||||||
|
var op = this.getOperation();
|
||||||
|
|
||||||
|
// We don't get any markup back if the user deletes a comment, or saves
|
||||||
|
// an empty comment (which effects a delete).
|
||||||
|
if (response.markup) {
|
||||||
|
this._draw(JX.$N('div', JX.$H(response.markup)));
|
||||||
|
}
|
||||||
|
|
||||||
|
// These operations remove the old row (edit adds a new row first).
|
||||||
|
var remove_old = (op == 'edit' || op == 'delete');
|
||||||
|
if (remove_old) {
|
||||||
|
JX.DOM.remove(this.getRow());
|
||||||
|
}
|
||||||
|
|
||||||
|
// Once the user saves something, get rid of the 'undo' option. A
|
||||||
|
// particular case where we need this is saving a delete, when we might
|
||||||
|
// otherwise leave around an 'undo' for an earlier edit to the same
|
||||||
|
// comment.
|
||||||
|
this._removeUndoLink();
|
||||||
|
|
||||||
|
JX.Stratcom.invoke('differential-inline-comment-update');
|
||||||
|
this.invoke('done');
|
||||||
|
},
|
||||||
|
_didCancelWorkflow : function() {
|
||||||
|
this.invoke('done');
|
||||||
|
|
||||||
|
var op = this.getOperation();
|
||||||
|
if (op == 'delete') {
|
||||||
|
// No undo for delete, we prompt the user explicitly.
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
var textarea = JX.DOM.find(
|
||||||
|
document.body, // TODO: use getDialogRootNode() when available
|
||||||
|
'textarea',
|
||||||
|
'differential-inline-comment-edit-textarea');
|
||||||
|
} catch (ex) {
|
||||||
|
if (ex !== JX.$.NotFound) {
|
||||||
|
throw ex;
|
||||||
|
}
|
||||||
|
// The close handler is called whenever the dialog closes, even if the
|
||||||
|
// user closed it by completing the workflow with "Save". The
|
||||||
|
// JX.Workflow API should probably be refined to allow programmatic
|
||||||
|
// distinction of close caused by 'cancel' vs 'submit'. Testing for
|
||||||
|
// presence of the textarea serves as a proxy for detecting a 'cancel'.
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var text = textarea.value;
|
||||||
|
|
||||||
|
// If the user hasn't edited the text (i.e., no change from original for
|
||||||
|
// 'edit' or no text for 'new' or 'reply'), don't offer them an undo.
|
||||||
|
if (text == (this.getOriginalText() || '')) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Save the text so we can 'undo' back to it.
|
||||||
|
this._undoText = text;
|
||||||
|
|
||||||
|
var template = this.getOnRight()
|
||||||
|
? this.getTemplates().r
|
||||||
|
: this.getTemplates().l;
|
||||||
|
template = JX.$N('div', JX.$H(template));
|
||||||
|
|
||||||
|
// NOTE: Operation order matters here; we can't remove anything until
|
||||||
|
// after we draw the new rows because _draw uses the old rows to figure
|
||||||
|
// out where to place the comment.
|
||||||
|
|
||||||
|
// We use 'exact_row' to put the "undo" text directly above the affected
|
||||||
|
// comment.
|
||||||
|
var exact_row = true;
|
||||||
|
var rows = this._draw(template, exact_row);
|
||||||
|
|
||||||
|
this._removeUndoLink();
|
||||||
|
|
||||||
|
JX.DifferentialInlineCommentEditor._undoRows = rows;
|
||||||
|
},
|
||||||
|
|
||||||
|
start : function() {
|
||||||
|
this._registerUndoListener();
|
||||||
|
|
||||||
|
var data = this._buildRequestData();
|
||||||
|
var handler = JX.bind(this, this._didCompleteWorkflow);
|
||||||
|
var close_handler = JX.bind(this, this._didCancelWorkflow);
|
||||||
|
|
||||||
|
new JX.Workflow(this._uri, data)
|
||||||
|
.setHandler(handler)
|
||||||
|
.setCloseHandler(close_handler)
|
||||||
|
.start();
|
||||||
|
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
statics : {
|
||||||
|
/**
|
||||||
|
* Global refernece to the 'undo' rows currently rendered in the document.
|
||||||
|
*/
|
||||||
|
_undoRows : null,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Global listener for the 'undo' click associated with the currently
|
||||||
|
* displayed 'undo' link. When an editor is start()ed, it becomes the active
|
||||||
|
* editor.
|
||||||
|
*/
|
||||||
|
_activeEditor : null
|
||||||
|
},
|
||||||
|
|
||||||
|
properties : {
|
||||||
|
operation : null,
|
||||||
|
row : null,
|
||||||
|
onRight : null,
|
||||||
|
ID : null,
|
||||||
|
lineNumber : null,
|
||||||
|
changeset : null,
|
||||||
|
length : null,
|
||||||
|
isNew : null,
|
||||||
|
text : null,
|
||||||
|
templates : null,
|
||||||
|
originalText : null
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
|
@ -3,8 +3,9 @@
|
||||||
* @requires javelin-behavior
|
* @requires javelin-behavior
|
||||||
* javelin-stratcom
|
* javelin-stratcom
|
||||||
* javelin-dom
|
* javelin-dom
|
||||||
* javelin-workflow
|
* javelin-util
|
||||||
* javelin-vector
|
* javelin-vector
|
||||||
|
* differential-inline-comment-editor
|
||||||
*/
|
*/
|
||||||
|
|
||||||
JX.behavior('differential-edit-inline-comments', function(config) {
|
JX.behavior('differential-edit-inline-comments', function(config) {
|
||||||
|
@ -18,8 +19,8 @@ JX.behavior('differential-edit-inline-comments', function(config) {
|
||||||
var target = null;
|
var target = null;
|
||||||
var root = null;
|
var root = null;
|
||||||
var changeset = null;
|
var changeset = null;
|
||||||
var workflow = false;
|
|
||||||
var is_new = false;
|
var editor = null;
|
||||||
|
|
||||||
function updateReticle() {
|
function updateReticle() {
|
||||||
var top = origin;
|
var top = origin;
|
||||||
|
@ -45,16 +46,11 @@ JX.behavior('differential-edit-inline-comments', function(config) {
|
||||||
JX.DOM.hide(reticle);
|
JX.DOM.hide(reticle);
|
||||||
}
|
}
|
||||||
|
|
||||||
function finishSelect() {
|
JX.DifferentialInlineCommentEditor.listen('done', function() {
|
||||||
selecting = false;
|
selecting = false;
|
||||||
workflow = false;
|
editor = false;
|
||||||
hideReticle();
|
hideReticle();
|
||||||
}
|
});
|
||||||
|
|
||||||
function drawInlineComment(table, anchor, r) {
|
|
||||||
copyRows(table, JX.$N('div', JX.$H(r.markup)), anchor);
|
|
||||||
finishSelect();
|
|
||||||
}
|
|
||||||
|
|
||||||
function isOnRight(node) {
|
function isOnRight(node) {
|
||||||
return node.parentNode.firstChild != node;
|
return node.parentNode.firstChild != node;
|
||||||
|
@ -73,25 +69,11 @@ 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'],
|
||||||
function(e) {
|
function(e) {
|
||||||
if (workflow ||
|
if (editor ||
|
||||||
selecting ||
|
selecting ||
|
||||||
getRowNumber(e.getTarget()) === undefined) {
|
getRowNumber(e.getTarget()) === undefined) {
|
||||||
return;
|
return;
|
||||||
|
@ -119,7 +101,7 @@ JX.behavior('differential-edit-inline-comments', function(config) {
|
||||||
['differential-changeset', 'tag:th'],
|
['differential-changeset', 'tag:th'],
|
||||||
function(e) {
|
function(e) {
|
||||||
if (!selecting ||
|
if (!selecting ||
|
||||||
workflow ||
|
editor ||
|
||||||
(getRowNumber(e.getTarget()) === undefined) ||
|
(getRowNumber(e.getTarget()) === undefined) ||
|
||||||
(isOnRight(e.getTarget()) != isOnRight(origin)) ||
|
(isOnRight(e.getTarget()) != isOnRight(origin)) ||
|
||||||
(e.getNode('differential-changeset') !== root)) {
|
(e.getNode('differential-changeset') !== root)) {
|
||||||
|
@ -135,7 +117,7 @@ JX.behavior('differential-edit-inline-comments', function(config) {
|
||||||
'mouseup',
|
'mouseup',
|
||||||
null,
|
null,
|
||||||
function(e) {
|
function(e) {
|
||||||
if (workflow || !selecting) {
|
if (editor || !selecting) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -153,38 +135,16 @@ JX.behavior('differential-edit-inline-comments', function(config) {
|
||||||
insert = target.parentNode;
|
insert = target.parentNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
var data = {
|
editor = new JX.DifferentialInlineCommentEditor(config.uri)
|
||||||
op: 'new',
|
.setTemplates(config.undo_templates)
|
||||||
changeset: changeset,
|
.setOperation('new')
|
||||||
number: o,
|
.setChangeset(changeset)
|
||||||
length: len,
|
.setLineNumber(o)
|
||||||
is_new: isNewFile(target) ? 1 : 0,
|
.setLength(len)
|
||||||
on_right: isOnRight(target) ? 1 : 0
|
.setIsNew(isNewFile(target) ? 1 : 0)
|
||||||
};
|
.setOnRight(isOnRight(target) ? 1 : 0)
|
||||||
|
.setRow(insert.nextSibling)
|
||||||
workflow = true;
|
.start();
|
||||||
|
|
||||||
var w = new JX.Workflow(config.uri, data)
|
|
||||||
.setHandler(function(r) {
|
|
||||||
// Skip over any rows which contain inline feedback. Don't mimic this!
|
|
||||||
// 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 = findInlineCommentTarget(insert.nextSibling);
|
|
||||||
drawInlineComment(insert.parentNode, target, r);
|
|
||||||
finishSelect();
|
|
||||||
JX.Stratcom.invoke('differential-inline-comment-update');
|
|
||||||
})
|
|
||||||
.setCloseHandler(finishSelect);
|
|
||||||
|
|
||||||
|
|
||||||
w.listen('error', function(e) {
|
|
||||||
// TODO: uh, tell the user I guess
|
|
||||||
finishSelect();
|
|
||||||
JX.Stratcom.context().stop();
|
|
||||||
});
|
|
||||||
|
|
||||||
w.start();
|
|
||||||
|
|
||||||
e.kill();
|
e.kill();
|
||||||
});
|
});
|
||||||
|
@ -193,7 +153,7 @@ JX.behavior('differential-edit-inline-comments', function(config) {
|
||||||
['mouseover', 'mouseout'],
|
['mouseover', 'mouseout'],
|
||||||
'differential-inline-comment',
|
'differential-inline-comment',
|
||||||
function(e) {
|
function(e) {
|
||||||
if (selecting || workflow) {
|
if (selecting || editor) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -220,50 +180,28 @@ JX.behavior('differential-edit-inline-comments', function(config) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
JX.Stratcom.listen(
|
var action_handler = function(op, e) {
|
||||||
'click',
|
var data = e.getNodeData('differential-inline-comment');
|
||||||
[['differential-inline-comment', 'differential-inline-reply']],
|
var node = e.getNode('differential-inline-comment');
|
||||||
function(e) {
|
|
||||||
new JX.Workflow(config.uri, e.getNodeData('differential-inline-reply'))
|
editor = new JX.DifferentialInlineCommentEditor(config.uri)
|
||||||
.setHandler(function(r) {
|
.setTemplates(config.undo_templates)
|
||||||
var base_row =
|
.setOperation(op)
|
||||||
findInlineCommentTarget(
|
.setID(data.id)
|
||||||
e.getNode('differential-inline-comment')
|
.setOnRight(data.on_right)
|
||||||
.parentNode
|
.setOriginalText(data.original)
|
||||||
.parentNode
|
.setRow(node.parentNode.parentNode)
|
||||||
);
|
|
||||||
drawInlineComment(base_row.parentNode, base_row, r);
|
|
||||||
JX.Stratcom.invoke('differential-inline-comment-update');
|
|
||||||
})
|
|
||||||
.start();
|
.start();
|
||||||
|
|
||||||
e.kill();
|
e.kill();
|
||||||
}
|
}
|
||||||
);
|
|
||||||
|
|
||||||
|
for (var op in {'edit' : 1, 'delete' : 1, 'reply' : 1}) {
|
||||||
JX.Stratcom.listen(
|
JX.Stratcom.listen(
|
||||||
'click',
|
'click',
|
||||||
[['differential-inline-comment', 'differential-inline-delete'],
|
['differential-inline-comment', 'differential-inline-' + op],
|
||||||
['differential-inline-comment', 'differential-inline-edit']],
|
JX.bind(null, action_handler, op));
|
||||||
function(e) {
|
|
||||||
var data = {
|
|
||||||
op: e.getNode('differential-inline-edit') ? 'edit' : 'delete',
|
|
||||||
id: e.getNodeData('differential-inline-comment').id,
|
|
||||||
on_right: e.getNodeData('differential-inline-comment').on_right
|
|
||||||
};
|
|
||||||
new JX.Workflow(config.uri, data)
|
|
||||||
.setHandler(function(r) {
|
|
||||||
var base_row = e.getNode('differential-inline-comment')
|
|
||||||
.parentNode
|
|
||||||
.parentNode;
|
|
||||||
if (data.op == 'edit' && r.markup) {
|
|
||||||
drawInlineComment(base_row.parentNode, base_row, r);
|
|
||||||
}
|
}
|
||||||
JX.DOM.remove(base_row);
|
|
||||||
JX.Stratcom.invoke('differential-inline-comment-update');
|
|
||||||
})
|
|
||||||
.start();
|
|
||||||
e.kill();
|
|
||||||
});
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -44,4 +44,5 @@ function copyRows(dst, src, before) {
|
||||||
dst.appendChild(rows[ii]);
|
dst.appendChild(rows[ii]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return rows;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue