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