Rewrite workboards to have way more bugs

Summary:
Ref T4900. Briefly:

  - Much more layout and rendering is now done in Javascript.
  - This should otherwise be identical to the behavior at HEAD, except that:
    - editing a task and removing the current board from it no longer removes the task; and
    - points still don't work.

However, this can now plausibly support realtime workboard updates and other complex state-based behaviors like points calculations in a future change.

Test Plan:
  - Changed card covers.
  - Moved cards.
  - Sorted board by priority and natural.
  - Added new cards.
  - Edited cards in place.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T4900

Differential Revision: https://secure.phabricator.com/D15234
This commit is contained in:
epriestley
2016-02-10 05:59:46 -08:00
parent 01084bfe22
commit 0bf3519045
15 changed files with 936 additions and 542 deletions

View File

@@ -150,51 +150,18 @@ abstract class PhabricatorProjectController extends PhabricatorController {
protected function newCardResponse($board_phid, $object_phid) {
$viewer = $this->getViewer();
$project = id(new PhabricatorProjectQuery())
->setViewer($viewer)
->withPHIDs(array($board_phid))
->executeOne();
if (!$project) {
return new Aphront404Response();
$request = $this->getRequest();
$visible_phids = $request->getStrList('visiblePHIDs');
if (!$visible_phids) {
$visible_phids = array();
}
// Reload the object so it reflects edits which have been applied.
$object = id(new ManiphestTaskQuery())
return id(new PhabricatorBoardResponseEngine())
->setViewer($viewer)
->withPHIDs(array($object_phid))
->needProjectPHIDs(true)
->executeOne();
if (!$object) {
return new Aphront404Response();
}
$except_phids = array($board_phid);
if ($project->getHasSubprojects() || $project->getHasMilestones()) {
$descendants = id(new PhabricatorProjectQuery())
->setViewer($viewer)
->withAncestorProjectPHIDs($except_phids)
->execute();
foreach ($descendants as $descendant) {
$except_phids[] = $descendant->getPHID();
}
}
$rendering_engine = id(new PhabricatorBoardRenderingEngine())
->setViewer($viewer)
->setObjects(array($object))
->setExcludedProjectPHIDs($except_phids);
$card = $rendering_engine->renderCard($object->getPHID());
$item = $card->getItem();
$item->addClass('phui-workcard');
return id(new AphrontAjaxResponse())
->setContent(
array(
'objectPHID' => $object->getPHID(),
'cardHTML' => $item,
));
->setBoardPHID($board_phid)
->setObjectPHID($object_phid)
->setVisiblePHIDs($visible_phids)
->buildResponse();
}
}