1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-23 22:10:55 +01:00

Make it so the diffusion comment panel can be haunted

Summary: ...basically by pounding the DOM a bit to be a little closer to differential. I also make the "add comment" UI show up if and only if the commit is rendering properly.

Test Plan: prezzed "Z" on diffusion and noted it was like differential now

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin

Maniphest Tasks: T1177

Differential Revision: https://secure.phabricator.com/D3027
This commit is contained in:
Bob Trahan 2012-07-23 09:15:10 -07:00
parent 96860c5cc1
commit ac46ea39b8

View file

@ -149,6 +149,7 @@ final class DiffusionCommitController extends DiffusionController {
'r'.$callsign.$commit->getCommitIdentifier());
}
$pane_id = null;
if ($bad_commit) {
$error_panel = new AphrontErrorView();
$error_panel->setWidth(AphrontErrorView::WIDTH_WIDE);
@ -268,16 +269,22 @@ final class DiffusionCommitController extends DiffusionController {
// TODO: This is pretty awkward, unify the CSS between Diffusion and
// Differential better.
require_celerity_resource('differential-core-view-css');
$change_list =
'<div class="differential-primary-pane">'.
$change_list->render().
'</div>';
$pane_id = celerity_generate_unique_node_id();
$add_comment_view = $this->renderAddCommentPanel($commit,
$audit_requests,
$pane_id);
$main_pane = phutil_render_tag(
'div',
array(
'class' => 'differential-primary-pane',
'id' => $pane_id
),
$change_list->render().
$add_comment_view);
$content[] = $change_list;
$content[] = $main_pane;
}
$content[] = $this->buildAddCommentView($commit, $audit_requests);
return $this->buildStandardPageResponse(
$content,
array(
@ -462,9 +469,10 @@ final class DiffusionCommitController extends DiffusionController {
return $view;
}
private function buildAddCommentView(
private function renderAddCommentPanel(
PhabricatorRepositoryCommit $commit,
array $audit_requests) {
array $audit_requests,
$pane_id = null) {
assert_instances_of($audit_requests, 'PhabricatorRepositoryAuditRequest');
$user = $this->getRequest()->getUser();
@ -473,8 +481,7 @@ final class DiffusionCommitController extends DiffusionController {
Javelin::initBehavior(
'differential-keyboard-navigation',
array(
// TODO: Make this comment panel hauntable
'haunt' => null,
'haunt' => $pane_id,
));
$draft = id(new PhabricatorDraft())->loadOneWhere(
@ -537,6 +544,8 @@ final class DiffusionCommitController extends DiffusionController {
$panel = new AphrontPanelView();
$panel->setHeader($is_serious ? 'Audit Commit' : 'Creative Accounting');
$panel->appendChild($form);
$panel->addClass('aphront-panel-accent');
$panel->addClass('aphront-panel-flush');
require_celerity_resource('phabricator-transaction-view-css');
@ -574,7 +583,7 @@ final class DiffusionCommitController extends DiffusionController {
));
$preview_panel =
'<div class="aphront-panel-preview">
'<div class="aphront-panel-preview aphront-panel-flush">
<div id="audit-preview">
<div class="aphront-panel-preview-loading-text">
Loading preview...
@ -582,13 +591,16 @@ final class DiffusionCommitController extends DiffusionController {
</div>
</div>';
$view = new AphrontNullView();
$view->appendChild($panel);
$view->appendChild($preview_panel);
return $view;
return
phutil_render_tag(
'div',
array(
'class' => 'differential-add-comment-panel',
),
$panel->render().
$preview_panel);
}
/**
* Return a map of available audit actions for rendering into a <select />.
* This shows the user valid actions, and does not show nonsense/invalid