mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-30 01:10:58 +01:00
Workboard - Make the edit icons on the columns actually work
Summary: Made the edit path of the Edit controller work (before only create worked), also added in the link for the cog icon to actually land you on the edit page for the correct column. Some cleanup too. *cough* Test Plan: Click on gear Look at fancy title you are about to edit Change it Enjoy changed title Reviewers: epriestley, #blessed_reviewers Reviewed By: epriestley CC: Korvin, epriestley, aran Differential Revision: https://secure.phabricator.com/D7933
This commit is contained in:
parent
240ec9a870
commit
10ea1dd749
3 changed files with 41 additions and 34 deletions
|
@ -30,27 +30,6 @@ final class PhabricatorProjectBoardController
|
|||
->withProjectPHIDs(array($project->getPHID()))
|
||||
->execute();
|
||||
|
||||
// TODO: Completely making this part up.
|
||||
$columns[] = id(new PhabricatorProjectColumn())
|
||||
->setName('Backlog')
|
||||
->setPHID(0)
|
||||
->setSequence(0);
|
||||
|
||||
$columns[] = id(new PhabricatorProjectColumn())
|
||||
->setName('Assigned')
|
||||
->setPHID(1)
|
||||
->setSequence(1);
|
||||
|
||||
$columns[] = id(new PhabricatorProjectColumn())
|
||||
->setName('In Progress')
|
||||
->setPHID(2)
|
||||
->setSequence(2);
|
||||
|
||||
$columns[] = id(new PhabricatorProjectColumn())
|
||||
->setName('Completed')
|
||||
->setPHID(3)
|
||||
->setSequence(3);
|
||||
|
||||
msort($columns, 'getSequence');
|
||||
|
||||
$tasks = id(new ManiphestTaskQuery())
|
||||
|
@ -61,10 +40,15 @@ final class PhabricatorProjectBoardController
|
|||
->execute();
|
||||
$tasks = mpull($tasks, null, 'getPHID');
|
||||
|
||||
// TODO: This is also made up.
|
||||
// TODO: This is so made up.
|
||||
$task_map = array();
|
||||
foreach ($tasks as $task) {
|
||||
$task_map[mt_rand(0, 3)][] = $task->getPHID();
|
||||
if ($columns) {
|
||||
$random_column = $columns[array_rand($columns)]->getPHID();
|
||||
} else {
|
||||
$random_column = 0;
|
||||
}
|
||||
$task_map[$random_column][] = $task->getPHID();
|
||||
}
|
||||
|
||||
$board = id(new PHUIWorkboardView())
|
||||
|
@ -73,7 +57,8 @@ final class PhabricatorProjectBoardController
|
|||
|
||||
foreach ($columns as $column) {
|
||||
$panel = id(new PHUIWorkpanelView())
|
||||
->setHeader($column->getName());
|
||||
->setHeader($column->getName())
|
||||
->setEditURI('edit/'.$column->getID().'/');
|
||||
|
||||
$cards = id(new PHUIObjectItemListView())
|
||||
->setUser($viewer)
|
||||
|
|
|
@ -32,8 +32,18 @@ final class PhabricatorProjectBoardEditController
|
|||
$is_new = ($this->id ? false : true);
|
||||
|
||||
if (!$is_new) {
|
||||
// TODO: LATER!
|
||||
throw new Exception("When I'm ready!");
|
||||
$column = id(new PhabricatorProjectColumnQuery())
|
||||
->setViewer($viewer)
|
||||
->withIDs(array($this->id))
|
||||
->requireCapabilities(
|
||||
array(
|
||||
PhabricatorPolicyCapability::CAN_VIEW,
|
||||
PhabricatorPolicyCapability::CAN_EDIT,
|
||||
))
|
||||
->executeOne();
|
||||
if (!$column) {
|
||||
return new Aphront404Response();
|
||||
}
|
||||
} else {
|
||||
$column = new PhabricatorProjectColumn();
|
||||
}
|
||||
|
@ -54,9 +64,22 @@ final class PhabricatorProjectBoardEditController
|
|||
$e_name = null;
|
||||
}
|
||||
|
||||
$column->setProjectPHID($project->getPHID());
|
||||
$column->attachProject($project);
|
||||
$column->setSequence(0);
|
||||
if ($is_new) {
|
||||
$column->setProjectPHID($project->getPHID());
|
||||
$column->attachProject($project);
|
||||
|
||||
$columns = id(new PhabricatorProjectColumnQuery())
|
||||
->setViewer($viewer)
|
||||
->withProjectPHIDs(array($project->getPHID()))
|
||||
->execute();
|
||||
|
||||
$new_sequence = 1;
|
||||
if ($columns) {
|
||||
$values = mpull($columns, 'getSequence');
|
||||
$new_sequence = max($values) + 1;
|
||||
}
|
||||
$column->setSequence($new_sequence);
|
||||
}
|
||||
|
||||
if (!$errors) {
|
||||
$column->save();
|
||||
|
|
|
@ -4,7 +4,7 @@ final class PHUIWorkpanelView extends AphrontView {
|
|||
|
||||
private $cards = array();
|
||||
private $header;
|
||||
private $headerAction;
|
||||
private $editURI;
|
||||
private $footerAction;
|
||||
|
||||
public function setCards(PHUIObjectItemListView $cards) {
|
||||
|
@ -17,9 +17,8 @@ final class PHUIWorkpanelView extends AphrontView {
|
|||
return $this;
|
||||
}
|
||||
|
||||
public function setHeaderAction($header_action) {
|
||||
// TODO: This doesn't do anything?
|
||||
$this->headerAction = $header_action;
|
||||
public function setEditURI($edit_uri) {
|
||||
$this->editURI = $edit_uri;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
@ -45,7 +44,7 @@ final class PHUIWorkpanelView extends AphrontView {
|
|||
$header_edit = id(new PHUIIconView())
|
||||
->setSpriteSheet(PHUIIconView::SPRITE_ACTIONS)
|
||||
->setSpriteIcon('settings-grey')
|
||||
->setHref('#');
|
||||
->setHref($this->editURI);
|
||||
|
||||
$header = id(new PhabricatorActionHeaderView())
|
||||
->setHeaderTitle($this->header)
|
||||
|
|
Loading…
Reference in a new issue