2013-03-30 17:51:35 +01:00
|
|
|
<?php
|
|
|
|
|
2014-01-13 21:23:39 +01:00
|
|
|
final class PHUIWorkpanelView extends AphrontTagView {
|
2013-03-30 17:51:35 +01:00
|
|
|
|
|
|
|
private $cards = array();
|
|
|
|
private $header;
|
2014-11-04 20:11:15 +01:00
|
|
|
private $subheader = null;
|
2013-03-30 17:51:35 +01:00
|
|
|
private $footerAction;
|
2014-06-24 18:39:32 +02:00
|
|
|
private $headerColor = PHUIActionHeaderView::HEADER_GREY;
|
2014-08-08 19:35:51 +02:00
|
|
|
private $headerActions = array();
|
2014-08-15 18:28:08 +02:00
|
|
|
private $headerTag;
|
Allow columns to have a point limit
Summary:
Fixes T5885. This implements optional soft point limits for workboard columns, per traditional Kanban.
- Allow columns to have a point limit set.
- When a column has a point limit, show it in the header.
- If a column has too many points in it, show the column and point count in red.
@chad, this could probably use some design tweaks. In particular:
- I changed the color of "hidden" columns to avoid confusion with "overfull" columns. We might be able to find a better color.
- UI hints for overfull columns might need adjustment.
(After T4427, we'll let you sum some custom field instead of total number of tasks, which is why this is called "points" rather than "number of tasks".)
Test Plan:
{F190914}
Note that:
- "Pre-planning" has a limit, so it shows "4/12".
- "Planning" has a limit and is overfull, so it shows "5 / 4".
- Other columns do not have limits.
- "Post-planning" is a hidden column. This might be too muted now.
Transactions:
{F190915}
Error messages / edit screen:
{F190916}
Reviewers: btrahan, chad
Reviewed By: btrahan
Subscribers: chad, epriestley
Maniphest Tasks: T5885
Differential Revision: https://secure.phabricator.com/D10276
2014-08-15 20:16:08 +02:00
|
|
|
private $headerIcon;
|
|
|
|
|
|
|
|
public function setHeaderIcon(PHUIIconView $header_icon) {
|
|
|
|
$this->headerIcon = $header_icon;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getHeaderIcon() {
|
|
|
|
return $this->headerIcon;
|
|
|
|
}
|
2014-03-06 03:40:28 +01:00
|
|
|
|
2013-09-09 23:14:34 +02:00
|
|
|
public function setCards(PHUIObjectItemListView $cards) {
|
2013-03-30 17:51:35 +01:00
|
|
|
$this->cards[] = $cards;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function setHeader($header) {
|
|
|
|
$this->header = $header;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
2014-11-04 20:11:15 +01:00
|
|
|
public function setSubheader($subheader) {
|
|
|
|
$this->subheader = $subheader;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
2013-06-05 17:41:43 +02:00
|
|
|
public function setFooterAction(PHUIListItemView $footer_action) {
|
2013-03-30 17:51:35 +01:00
|
|
|
$this->footerAction = $footer_action;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
2014-01-13 06:40:02 +01:00
|
|
|
public function setHeaderColor($header_color) {
|
|
|
|
$this->headerColor = $header_color;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
2014-08-08 19:35:51 +02:00
|
|
|
public function addHeaderAction(PHUIIconView $action) {
|
|
|
|
$this->headerActions[] = $action;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
2014-08-15 18:28:08 +02:00
|
|
|
public function setHeaderTag(PHUITagView $tag) {
|
|
|
|
$this->headerTag = $tag;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
2014-01-13 21:23:39 +01:00
|
|
|
public function getTagAttributes() {
|
|
|
|
return array(
|
|
|
|
'class' => 'phui-workpanel-view',
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getTagContent() {
|
2013-09-06 23:06:12 +02:00
|
|
|
require_celerity_resource('phui-workpanel-view-css');
|
2013-03-30 17:51:35 +01:00
|
|
|
|
2014-06-26 05:55:10 +02:00
|
|
|
$classes = array();
|
|
|
|
$classes[] = 'phui-workpanel-view-inner';
|
2013-03-30 17:51:35 +01:00
|
|
|
$footer = '';
|
|
|
|
if ($this->footerAction) {
|
2013-03-30 22:46:02 +01:00
|
|
|
$footer_tag = $this->footerAction;
|
|
|
|
$footer = phutil_tag(
|
2013-06-05 17:41:43 +02:00
|
|
|
'ul',
|
2013-03-30 17:51:35 +01:00
|
|
|
array(
|
2014-10-07 15:01:04 +02:00
|
|
|
'class' => 'phui-workpanel-footer-action mst ps',
|
2013-03-30 17:51:35 +01:00
|
|
|
),
|
2013-03-30 22:46:02 +01:00
|
|
|
$footer_tag);
|
2013-03-30 17:51:35 +01:00
|
|
|
}
|
|
|
|
|
2014-06-24 18:39:32 +02:00
|
|
|
$header = id(new PHUIActionHeaderView())
|
2013-04-05 16:40:27 +02:00
|
|
|
->setHeaderTitle($this->header)
|
2014-11-04 20:11:15 +01:00
|
|
|
->setHeaderSubtitle($this->subheader)
|
2014-02-27 18:39:59 +01:00
|
|
|
->setHeaderColor($this->headerColor);
|
2014-08-08 19:35:51 +02:00
|
|
|
|
Allow columns to have a point limit
Summary:
Fixes T5885. This implements optional soft point limits for workboard columns, per traditional Kanban.
- Allow columns to have a point limit set.
- When a column has a point limit, show it in the header.
- If a column has too many points in it, show the column and point count in red.
@chad, this could probably use some design tweaks. In particular:
- I changed the color of "hidden" columns to avoid confusion with "overfull" columns. We might be able to find a better color.
- UI hints for overfull columns might need adjustment.
(After T4427, we'll let you sum some custom field instead of total number of tasks, which is why this is called "points" rather than "number of tasks".)
Test Plan:
{F190914}
Note that:
- "Pre-planning" has a limit, so it shows "4/12".
- "Planning" has a limit and is overfull, so it shows "5 / 4".
- Other columns do not have limits.
- "Post-planning" is a hidden column. This might be too muted now.
Transactions:
{F190915}
Error messages / edit screen:
{F190916}
Reviewers: btrahan, chad
Reviewed By: btrahan
Subscribers: chad, epriestley
Maniphest Tasks: T5885
Differential Revision: https://secure.phabricator.com/D10276
2014-08-15 20:16:08 +02:00
|
|
|
if ($this->headerIcon) {
|
|
|
|
$header->setHeaderIcon($this->headerIcon);
|
|
|
|
}
|
|
|
|
|
2014-08-15 18:28:08 +02:00
|
|
|
if ($this->headerTag) {
|
|
|
|
$header->setTag($this->headerTag);
|
|
|
|
}
|
|
|
|
|
2014-08-08 19:35:51 +02:00
|
|
|
foreach ($this->headerActions as $action) {
|
|
|
|
$header->addAction($action);
|
2014-03-06 03:40:28 +01:00
|
|
|
}
|
2013-03-30 17:51:35 +01:00
|
|
|
|
2014-06-26 05:55:10 +02:00
|
|
|
$classes[] = 'phui-workpanel-'.$this->headerColor;
|
|
|
|
|
2013-03-30 17:51:35 +01:00
|
|
|
$body = phutil_tag(
|
|
|
|
'div',
|
|
|
|
array(
|
2014-10-07 15:01:04 +02:00
|
|
|
'class' => 'phui-workpanel-body',
|
2013-03-30 17:51:35 +01:00
|
|
|
),
|
|
|
|
$this->cards);
|
|
|
|
|
|
|
|
$view = phutil_tag(
|
|
|
|
'div',
|
|
|
|
array(
|
2014-06-26 05:55:10 +02:00
|
|
|
'class' => implode(' ', $classes),
|
2013-03-30 17:51:35 +01:00
|
|
|
),
|
|
|
|
array(
|
|
|
|
$header,
|
|
|
|
$body,
|
|
|
|
$footer,
|
|
|
|
));
|
|
|
|
|
2014-01-13 21:23:39 +01:00
|
|
|
return $view;
|
2013-03-30 17:51:35 +01:00
|
|
|
}
|
|
|
|
}
|