Page MenuHomePhabricator

D7933.id17953.diff
No OneTemporary

D7933.id17953.diff

Index: src/applications/project/controller/PhabricatorProjectBoardController.php
===================================================================
--- src/applications/project/controller/PhabricatorProjectBoardController.php
+++ src/applications/project/controller/PhabricatorProjectBoardController.php
@@ -30,27 +30,6 @@
->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 @@
->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 @@
foreach ($columns as $column) {
$panel = id(new PHUIWorkpanelView())
- ->setHeader($column->getName());
+ ->setHeader($column->getName())
+ ->setEditURI('edit/'.$column->getID().'/');
$cards = id(new PHUIObjectItemListView())
->setUser($viewer)
Index: src/applications/project/controller/PhabricatorProjectBoardEditController.php
===================================================================
--- src/applications/project/controller/PhabricatorProjectBoardEditController.php
+++ src/applications/project/controller/PhabricatorProjectBoardEditController.php
@@ -32,8 +32,18 @@
$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 @@
$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();
Index: src/view/phui/PHUIWorkpanelView.php
===================================================================
--- src/view/phui/PHUIWorkpanelView.php
+++ src/view/phui/PHUIWorkpanelView.php
@@ -4,7 +4,7 @@
private $cards = array();
private $header;
- private $headerAction;
+ private $editURI;
private $footerAction;
public function setCards(PHUIObjectItemListView $cards) {
@@ -17,9 +17,8 @@
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 @@
$header_edit = id(new PHUIIconView())
->setSpriteSheet(PHUIIconView::SPRITE_ACTIONS)
->setSpriteIcon('settings-grey')
- ->setHref('#');
+ ->setHref($this->editURI);
$header = id(new PhabricatorActionHeaderView())
->setHeaderTitle($this->header)

File Metadata

Mime Type
text/plain
Expires
Sun, Dec 22, 2:42 AM (17 h, 44 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6916610
Default Alt Text
D7933.id17953.diff (4 KB)

Event Timeline