mirror of
https://we.phorge.it/source/phorge.git
synced 2025-01-01 18:30:59 +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()))
|
->withProjectPHIDs(array($project->getPHID()))
|
||||||
->execute();
|
->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');
|
msort($columns, 'getSequence');
|
||||||
|
|
||||||
$tasks = id(new ManiphestTaskQuery())
|
$tasks = id(new ManiphestTaskQuery())
|
||||||
|
@ -61,10 +40,15 @@ final class PhabricatorProjectBoardController
|
||||||
->execute();
|
->execute();
|
||||||
$tasks = mpull($tasks, null, 'getPHID');
|
$tasks = mpull($tasks, null, 'getPHID');
|
||||||
|
|
||||||
// TODO: This is also made up.
|
// TODO: This is so made up.
|
||||||
$task_map = array();
|
$task_map = array();
|
||||||
foreach ($tasks as $task) {
|
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())
|
$board = id(new PHUIWorkboardView())
|
||||||
|
@ -73,7 +57,8 @@ final class PhabricatorProjectBoardController
|
||||||
|
|
||||||
foreach ($columns as $column) {
|
foreach ($columns as $column) {
|
||||||
$panel = id(new PHUIWorkpanelView())
|
$panel = id(new PHUIWorkpanelView())
|
||||||
->setHeader($column->getName());
|
->setHeader($column->getName())
|
||||||
|
->setEditURI('edit/'.$column->getID().'/');
|
||||||
|
|
||||||
$cards = id(new PHUIObjectItemListView())
|
$cards = id(new PHUIObjectItemListView())
|
||||||
->setUser($viewer)
|
->setUser($viewer)
|
||||||
|
|
|
@ -32,8 +32,18 @@ final class PhabricatorProjectBoardEditController
|
||||||
$is_new = ($this->id ? false : true);
|
$is_new = ($this->id ? false : true);
|
||||||
|
|
||||||
if (!$is_new) {
|
if (!$is_new) {
|
||||||
// TODO: LATER!
|
$column = id(new PhabricatorProjectColumnQuery())
|
||||||
throw new Exception("When I'm ready!");
|
->setViewer($viewer)
|
||||||
|
->withIDs(array($this->id))
|
||||||
|
->requireCapabilities(
|
||||||
|
array(
|
||||||
|
PhabricatorPolicyCapability::CAN_VIEW,
|
||||||
|
PhabricatorPolicyCapability::CAN_EDIT,
|
||||||
|
))
|
||||||
|
->executeOne();
|
||||||
|
if (!$column) {
|
||||||
|
return new Aphront404Response();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
$column = new PhabricatorProjectColumn();
|
$column = new PhabricatorProjectColumn();
|
||||||
}
|
}
|
||||||
|
@ -54,9 +64,22 @@ final class PhabricatorProjectBoardEditController
|
||||||
$e_name = null;
|
$e_name = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
$column->setProjectPHID($project->getPHID());
|
if ($is_new) {
|
||||||
$column->attachProject($project);
|
$column->setProjectPHID($project->getPHID());
|
||||||
$column->setSequence(0);
|
$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) {
|
if (!$errors) {
|
||||||
$column->save();
|
$column->save();
|
||||||
|
|
|
@ -4,7 +4,7 @@ final class PHUIWorkpanelView extends AphrontView {
|
||||||
|
|
||||||
private $cards = array();
|
private $cards = array();
|
||||||
private $header;
|
private $header;
|
||||||
private $headerAction;
|
private $editURI;
|
||||||
private $footerAction;
|
private $footerAction;
|
||||||
|
|
||||||
public function setCards(PHUIObjectItemListView $cards) {
|
public function setCards(PHUIObjectItemListView $cards) {
|
||||||
|
@ -17,9 +17,8 @@ final class PHUIWorkpanelView extends AphrontView {
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setHeaderAction($header_action) {
|
public function setEditURI($edit_uri) {
|
||||||
// TODO: This doesn't do anything?
|
$this->editURI = $edit_uri;
|
||||||
$this->headerAction = $header_action;
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,7 +44,7 @@ final class PHUIWorkpanelView extends AphrontView {
|
||||||
$header_edit = id(new PHUIIconView())
|
$header_edit = id(new PHUIIconView())
|
||||||
->setSpriteSheet(PHUIIconView::SPRITE_ACTIONS)
|
->setSpriteSheet(PHUIIconView::SPRITE_ACTIONS)
|
||||||
->setSpriteIcon('settings-grey')
|
->setSpriteIcon('settings-grey')
|
||||||
->setHref('#');
|
->setHref($this->editURI);
|
||||||
|
|
||||||
$header = id(new PhabricatorActionHeaderView())
|
$header = id(new PhabricatorActionHeaderView())
|
||||||
->setHeaderTitle($this->header)
|
->setHeaderTitle($this->header)
|
||||||
|
|
Loading…
Reference in a new issue