Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15432888
D7938.id17973.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
4 KB
Referenced Files
None
Subscribers
None
D7938.id17973.diff
View Options
Index: src/applications/project/controller/PhabricatorProjectBoardController.php
===================================================================
--- src/applications/project/controller/PhabricatorProjectBoardController.php
+++ src/applications/project/controller/PhabricatorProjectBoardController.php
@@ -30,7 +30,21 @@
->withProjectPHIDs(array($project->getPHID()))
->execute();
- msort($columns, 'getSequence');
+ $columns = mpull($columns, null, 'getSequence');
+
+ // If there's no default column, create one now.
+ if (empty($columns[0])) {
+ $unguarded = AphrontWriteGuard::beginScopedUnguardedWrites();
+ $column = PhabricatorProjectColumn::initializeNewColumn($viewer)
+ ->setSequence(0)
+ ->setProjectPHID($project->getPHID())
+ ->save();
+ $column->attachProject($project);
+ $columns[0] = $column;
+ unset($unguarded);
+ }
+
+ ksort($columns);
$tasks = id(new ManiphestTaskQuery())
->setViewer($viewer)
@@ -40,15 +54,11 @@
->execute();
$tasks = mpull($tasks, null, 'getPHID');
- // TODO: This is so made up.
$task_map = array();
+ $default_phid = $columns[0]->getPHID();
+
foreach ($tasks as $task) {
- if ($columns) {
- $random_column = $columns[array_rand($columns)]->getPHID();
- } else {
- $random_column = 0;
- }
- $task_map[$random_column][] = $task->getPHID();
+ $task_map[$default_phid][] = $task->getPHID();
}
$board = id(new PHUIWorkboardView())
@@ -57,7 +67,8 @@
foreach ($columns as $column) {
$panel = id(new PHUIWorkpanelView())
- ->setHeader($column->getName())
+ ->setHeader($column->getDisplayName())
+ ->setHeaderColor($column->getHeaderColor())
->setEditURI('edit/'.$column->getID().'/');
$cards = id(new PHUIObjectItemListView())
@@ -114,7 +125,7 @@
$board_box,
),
array(
- 'title' => pht('Board'),
+ 'title' => pht('%s Board', $project->getName()),
'device' => true,
));
}
Index: src/applications/project/controller/PhabricatorProjectBoardEditController.php
===================================================================
--- src/applications/project/controller/PhabricatorProjectBoardEditController.php
+++ src/applications/project/controller/PhabricatorProjectBoardEditController.php
@@ -45,7 +45,7 @@
return new Aphront404Response();
}
} else {
- $column = new PhabricatorProjectColumn();
+ $column = PhabricatorProjectColumn::initializeNewColumn($viewer);
}
$errors = array();
Index: src/applications/project/storage/PhabricatorProjectColumn.php
===================================================================
--- src/applications/project/storage/PhabricatorProjectColumn.php
+++ src/applications/project/storage/PhabricatorProjectColumn.php
@@ -10,6 +10,11 @@
private $project = self::ATTACHABLE;
+ public static function initializeNewColumn(PhabricatorUser $user) {
+ return id(new PhabricatorProjectColumn())
+ ->setName('');
+ }
+
public function getConfiguration() {
return array(
self::CONFIG_AUX_PHID => true,
@@ -30,6 +35,24 @@
return $this->assertAttached($this->project);
}
+ public function isDefaultColumn() {
+ return ($this->getSequence() == 0);
+ }
+
+ public function getDisplayName() {
+ if ($this->isDefaultColumn()) {
+ return pht('Backlog');
+ }
+ return $this->getName();
+ }
+
+ public function getHeaderColor() {
+ if ($this->isDefaultColumn()) {
+ return PhabricatorActionHeaderView::HEADER_DARK_GREY;
+ }
+ return PhabricatorActionHeaderView::HEADER_GREY;
+ }
+
/* -( PhabricatorPolicyInterface )----------------------------------------- */
Index: src/view/phui/PHUIWorkpanelView.php
===================================================================
--- src/view/phui/PHUIWorkpanelView.php
+++ src/view/phui/PHUIWorkpanelView.php
@@ -6,6 +6,7 @@
private $header;
private $editURI;
private $footerAction;
+ private $headerColor = PhabricatorActionHeaderView::HEADER_GREY;
public function setCards(PHUIObjectItemListView $cards) {
$this->cards[] = $cards;
@@ -27,6 +28,11 @@
return $this;
}
+ public function setHeaderColor($header_color) {
+ $this->headerColor = $header_color;
+ return $this;
+ }
+
public function render() {
require_celerity_resource('phui-workpanel-view-css');
@@ -48,7 +54,7 @@
$header = id(new PhabricatorActionHeaderView())
->setHeaderTitle($this->header)
- ->setHeaderColor(PhabricatorActionHeaderView::HEADER_GREY)
+ ->setHeaderColor($this->headerColor)
->addAction($header_edit);
$body = phutil_tag(
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Mar 25, 8:08 PM (1 w, 3 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7223631
Default Alt Text
D7938.id17973.diff (4 KB)
Attached To
Mode
D7938: Generate a default "Backlog" column for boards and put all tasks into it
Attached
Detach File
Event Timeline
Log In to Comment