1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-25 00:02:41 +01:00
phorge-phorge/src/applications/project/view/ProjectBoardTaskCard.php
epriestley f0147fd8ad Allow workboards to be filtered with ApplicationSearch
Summary:
Ref T4673.

IMPORTANT: I had to break one thing (see TODO) to get this working. Not sure how you want to deal with that. I might be able to put the element //inside// the workboard, or I could write some JS. But I figured I'd get feedback first.

General areas for improvement:

  - It would be nice to give you some feedback that you have a filter applied.
  - It would be nice to let you save and quickly select common filters.
  - These would probably both be covered by a dropdown menu instead of a button, but that's more JS than I want to sign up for right now.
  - Managing custom filters is also a significant amount of extra UI to build.
  - Also, maybe these filters should be sticky per-board? Or across all boards? Or have a "make this my default view"? I tend to dislike implicit stickiness.

Test Plan:
Before:

{F157543}

Apply Filter:

{F157544}

Filtered:

{F157545}

Reviewers: chad, btrahan

Reviewed By: btrahan

Subscribers: qgil, swisspol, epriestley

Maniphest Tasks: T4673

Differential Revision: https://secure.phabricator.com/D9211
2014-05-20 11:42:05 -07:00

76 lines
1.7 KiB
PHP

<?php
final class ProjectBoardTaskCard {
private $viewer;
private $task;
private $owner;
private $canEdit;
public function setViewer(PhabricatorUser $viewer) {
$this->viewer = $viewer;
return $this;
}
public function getViewer() {
return $this->viewer;
}
public function setTask(ManiphestTask $task) {
$this->task = $task;
return $this;
}
public function getTask() {
return $this->task;
}
public function setOwner(PhabricatorObjectHandle $owner = null) {
$this->owner = $owner;
return $this;
}
public function getOwner() {
return $this->owner;
}
public function setCanEdit($can_edit) {
$this->canEdit = $can_edit;
return $this;
}
public function getCanEdit() {
return $this->canEdit;
}
public function getItem() {
$task = $this->getTask();
$owner = $this->getOwner();
$can_edit = $this->getCanEdit();
$color_map = ManiphestTaskPriority::getColorMap();
$bar_color = idx($color_map, $task->getPriority(), 'grey');
$card = id(new PHUIObjectItemView())
->setObjectName('T'.$task->getID())
->setHeader($task->getTitle())
->setGrippable($can_edit)
->setHref('/T'.$task->getID())
->addSigil('project-card')
->setDisabled($task->isClosed())
->setMetadata(
array(
'objectPHID' => $task->getPHID(),
))
->addAction(
id(new PHUIListItemView())
->setName(pht('Edit'))
->setIcon('fa-pencil')
->addSigil('edit-project-card')
->setHref('/maniphest/task/edit/'.$task->getID().'/'))
->setBarColor($bar_color);
if ($owner) {
$card->addAttribute($owner->renderLink());
}
return $card;
}
}