Improve behavior of inline comment dialog

Summary:
Fixes T2669.

  - Currently, making an inline comment does not focus the textarea. Instead, focus the textarea.
  - Currently, the positioning is kind of buggy. Make it viewport-relative and put the dialog slightly below the inline reticle.
  - Use `JX.Workflow` more and simplify some of the ajax stuff.

Test Plan: Created inline comments.

Reviewers: chad

Reviewed By: chad

CC: aran

Maniphest Tasks: T2669

Differential Revision: https://secure.phabricator.com/D5229
This commit is contained in:
epriestley
2013-03-05 12:30:05 -08:00
parent bd4ce3580c
commit ec6f566bc1
4 changed files with 39 additions and 46 deletions

View File

@@ -1891,7 +1891,7 @@ celerity_register_resource_map(array(
),
'javelin-behavior-pholio-mock-view' =>
array(
'uri' => '/res/02f1a38f/rsrc/js/application/pholio/behavior-pholio-mock-view.js',
'uri' => '/res/c320fd85/rsrc/js/application/pholio/behavior-pholio-mock-view.js',
'type' => 'js',
'requires' =>
array(
@@ -1903,7 +1903,8 @@ celerity_register_resource_map(array(
5 => 'javelin-magical-init',
6 => 'javelin-request',
7 => 'javelin-history',
8 => 'phabricator-keyboard-shortcut',
8 => 'javelin-workflow',
9 => 'phabricator-keyboard-shortcut',
),
'disk' => '/rsrc/js/application/pholio/behavior-pholio-mock-view.js',
),
@@ -3247,7 +3248,7 @@ celerity_register_resource_map(array(
),
'pholio-inline-comments-css' =>
array(
'uri' => '/res/be86f544/rsrc/css/application/pholio/pholio-inline-comments.css',
'uri' => '/res/a0f7ddc4/rsrc/css/application/pholio/pholio-inline-comments.css',
'type' => 'css',
'requires' =>
array(

View File

@@ -24,14 +24,13 @@ final class PholioInlineSaveController extends PholioController {
return new Aphront404Response();
}
$this->operation = $request->getBool('op');
$this->operation = $request->getStr('op');
if ($this->getOperation() == 'save') {
$new_content = $request->getStr('comment');
$new_content = $request->getStr('text');
if (strlen(trim($new_content)) == 0) {
return id(new AphrontAjaxResponse())
->setContent(array('success' => false));
if (!strlen($new_content)) {
throw new Exception("Content must not be empty.");
}
$draft = id(new PholioTransactionComment());
@@ -78,7 +77,7 @@ final class PholioInlineSaveController extends PholioController {
$dialog->setUser($user);
$dialog->setSubmitURI($request->getRequestURI());
$dialog->setTitle(pht('Make inline comment'));
$dialog->setTitle(pht('Add Inline Comment'));
$dialog->addHiddenInput('op', 'save');

View File

@@ -38,6 +38,8 @@ final class PholioInlineCommentSaveView extends AphrontView {
'action' => $this->uri,
'method' => 'POST',
'sigil' => 'inline-save-form',
'class' => 'pholio-new-inline-comment',
'id' => 'pholio-new-inline-comment-dialog'
),
$this->renderSingleView(
array(
@@ -117,8 +119,6 @@ final class PholioInlineCommentSaveView extends AphrontView {
return javelin_tag(
'div',
array(
'class' => 'pholio-new-inline-comment',
'id' => 'pholio-new-inline-comment-dialog'
),
$this->renderSingleView(
array(