1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-10 08:52:39 +01:00

Convert Maniphest to curtain view

Summary: Moves Maniphest over, and allows application to provide ad-hoc panels more easily.

Test Plan: {F1160591}

Reviewers: chad

Reviewed By: chad

Differential Revision: https://secure.phabricator.com/D15417
This commit is contained in:
epriestley 2016-03-06 10:16:00 -08:00
parent 11774ef290
commit eb1a0799ae
2 changed files with 45 additions and 46 deletions

View file

@ -73,8 +73,7 @@ final class ManiphestTaskDetailController extends ManiphestController {
$header = $this->buildHeaderView($task); $header = $this->buildHeaderView($task);
$details = $this->buildPropertyView($task, $field_list, $edges, $handles); $details = $this->buildPropertyView($task, $field_list, $edges, $handles);
$description = $this->buildDescriptionView($task, $engine); $description = $this->buildDescriptionView($task, $engine);
$actions = $this->buildActionView($task); $curtain = $this->buildCurtain($task);
$properties = $this->buildPropertyListView($task, $handles);
$title = pht('%s %s', $monogram, $task->getTitle()); $title = pht('%s %s', $monogram, $task->getTitle());
@ -87,14 +86,13 @@ final class ManiphestTaskDetailController extends ManiphestController {
$view = id(new PHUITwoColumnView()) $view = id(new PHUITwoColumnView())
->setHeader($header) ->setHeader($header)
->setCurtain($curtain)
->setMainColumn(array( ->setMainColumn(array(
$timeline, $timeline,
$comment_view, $comment_view,
)) ))
->addPropertySection(pht('DETAILS'), $details) ->addPropertySection(pht('DETAILS'), $details)
->addPropertySection(pht('DESCRIPTION'), $description) ->addPropertySection(pht('DESCRIPTION'), $description);
->setPropertyList($properties)
->setActionList($actions);
return $this->newPage() return $this->newPage()
->setTitle($title) ->setTitle($title)
@ -148,8 +146,8 @@ final class ManiphestTaskDetailController extends ManiphestController {
} }
private function buildActionView(ManiphestTask $task) { private function buildCurtain(ManiphestTask $task) {
$viewer = $this->getRequest()->getUser(); $viewer = $this->getViewer();
$id = $task->getID(); $id = $task->getID();
$phid = $task->getPHID(); $phid = $task->getPHID();
@ -159,11 +157,9 @@ final class ManiphestTaskDetailController extends ManiphestController {
$task, $task,
PhabricatorPolicyCapability::CAN_EDIT); PhabricatorPolicyCapability::CAN_EDIT);
$view = id(new PhabricatorActionListView()) $curtain = $this->newCurtainView($task);
->setUser($viewer)
->setObject($task);
$view->addAction( $curtain->addAction(
id(new PhabricatorActionView()) id(new PhabricatorActionView())
->setName(pht('Edit Task')) ->setName(pht('Edit Task'))
->setIcon('fa-pencil') ->setIcon('fa-pencil')
@ -171,7 +167,7 @@ final class ManiphestTaskDetailController extends ManiphestController {
->setDisabled(!$can_edit) ->setDisabled(!$can_edit)
->setWorkflow(!$can_edit)); ->setWorkflow(!$can_edit));
$view->addAction( $curtain->addAction(
id(new PhabricatorActionView()) id(new PhabricatorActionView())
->setName(pht('Merge Duplicates In')) ->setName(pht('Merge Duplicates In'))
->setHref("/search/attach/{$phid}/TASK/merge/") ->setHref("/search/attach/{$phid}/TASK/merge/")
@ -199,7 +195,7 @@ final class ManiphestTaskDetailController extends ManiphestController {
$edit_uri = $this->getApplicationURI($edit_uri); $edit_uri = $this->getApplicationURI($edit_uri);
} }
$view->addAction( $curtain->addAction(
id(new PhabricatorActionView()) id(new PhabricatorActionView())
->setName(pht('Create Subtask')) ->setName(pht('Create Subtask'))
->setHref($edit_uri) ->setHref($edit_uri)
@ -207,7 +203,7 @@ final class ManiphestTaskDetailController extends ManiphestController {
->setDisabled(!$can_create) ->setDisabled(!$can_create)
->setWorkflow(!$can_create)); ->setWorkflow(!$can_create));
$view->addAction( $curtain->addAction(
id(new PhabricatorActionView()) id(new PhabricatorActionView())
->setName(pht('Edit Blocking Tasks')) ->setName(pht('Edit Blocking Tasks'))
->setHref("/search/attach/{$phid}/TASK/blocks/") ->setHref("/search/attach/{$phid}/TASK/blocks/")
@ -216,7 +212,30 @@ final class ManiphestTaskDetailController extends ManiphestController {
->setDisabled(!$can_edit) ->setDisabled(!$can_edit)
->setWorkflow(true)); ->setWorkflow(true));
return $view;
$owner_phid = $task->getOwnerPHID();
if ($owner_phid) {
$assigned_to = $viewer
->renderHandle($owner_phid)
->setShowHovercard(true);
} else {
$assigned_to = phutil_tag('em', array(), pht('None'));
}
$curtain->newPanel()
->setHeaderText(pht('Assigned To'))
->appendChild($assigned_to);
$author_phid = $task->getAuthorPHID();
$author = $viewer
->renderHandle($author_phid)
->setShowHovercard(true);
$curtain->newPanel()
->setHeaderText(pht('Author'))
->appendChild($author);
return $curtain;
} }
private function buildPropertyView( private function buildPropertyView(
@ -307,37 +326,6 @@ final class ManiphestTaskDetailController extends ManiphestController {
return null; return null;
} }
private function buildPropertyListView(ManiphestTask $task, $handles) {
$viewer = $this->getRequest()->getUser();
$view = id(new PHUIPropertyListView())
->setUser($viewer)
->setObject($task);
$view->invokeWillRenderEvent();
$owner_phid = $task->getOwnerPHID();
if ($owner_phid) {
$assigned_to = $handles
->renderHandle($owner_phid)
->setShowHovercard(true);
} else {
$assigned_to = phutil_tag('em', array(), pht('None'));
}
$view->addProperty(pht('Assigned To'), $assigned_to);
$author_phid = $task->getAuthorPHID();
$author = $handles
->renderHandle($author_phid)
->setShowHovercard(true);
$date = phabricator_datetime($task->getDateCreated(), $viewer);
$view->addProperty(pht('Author'), $author);
return $view;
}
private function buildDescriptionView( private function buildDescriptionView(
ManiphestTask $task, ManiphestTask $task,
PhabricatorMarkupEngine $engine) { PhabricatorMarkupEngine $engine) {

View file

@ -15,6 +15,17 @@ final class PHUICurtainView extends AphrontTagView {
return $this; return $this;
} }
public function newPanel() {
$panel = new PHUICurtainPanelView();
$this->addPanel($panel);
// By default, application panels go at the bottom of the curtain, below
// extension panels.
$panel->setOrder(100000);
return $panel;
}
public function setActionList(PhabricatorActionListView $action_list) { public function setActionList(PhabricatorActionListView $action_list) {
$this->actionList = $action_list; $this->actionList = $action_list;
return $this; return $this;