mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-23 14:00:56 +01:00
Fix task hovercards showing a "Not Editable" state
Summary: Ref T13269. These cards really have three states: - Editable: shows a pencil icon edit button. - You Do Not Have Permission To Edit This: shows a "no editing" icon in red. - Hovecard: shouldn't show anything. However, the "hovercard" and "no permission" states are currently the same state, so when I made the "no permission" state more obvious that made the hovercard go all weird. Make these states explicitly separate states. Test Plan: Looked at a... - Editable card on workboard: edit state. - No permission card on workboard: no permission state. - Any hovercard: "not editable, this is a hovercard" state. Reviewers: amckinley Reviewed By: amckinley Maniphest Tasks: T13269 Differential Revision: https://secure.phabricator.com/D20330
This commit is contained in:
parent
b328af0a1b
commit
4485482fd4
3 changed files with 31 additions and 19 deletions
|
@ -47,8 +47,7 @@ final class ManiphestHovercardEngineExtension
|
|||
|
||||
$card = id(new ProjectBoardTaskCard())
|
||||
->setViewer($viewer)
|
||||
->setTask($task)
|
||||
->setCanEdit(false);
|
||||
->setTask($task);
|
||||
|
||||
$owner_phid = $task->getOwnerPHID();
|
||||
if ($owner_phid) {
|
||||
|
|
|
@ -56,6 +56,7 @@ final class PhabricatorBoardRenderingEngine extends Phobject {
|
|||
$card = id(new ProjectBoardTaskCard())
|
||||
->setViewer($viewer)
|
||||
->setTask($object)
|
||||
->setShowEditControls(true)
|
||||
->setCanEdit($this->getCanEdit($phid));
|
||||
|
||||
$owner_phid = $object->getOwnerPHID();
|
||||
|
|
|
@ -6,6 +6,7 @@ final class ProjectBoardTaskCard extends Phobject {
|
|||
private $projectHandles;
|
||||
private $task;
|
||||
private $owner;
|
||||
private $showEditControls;
|
||||
private $canEdit;
|
||||
private $coverImageFile;
|
||||
private $hideArchivedProjects;
|
||||
|
@ -70,6 +71,15 @@ final class ProjectBoardTaskCard extends Phobject {
|
|||
return $this->canEdit;
|
||||
}
|
||||
|
||||
public function setShowEditControls($show_edit_controls) {
|
||||
$this->showEditControls = $show_edit_controls;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getShowEditControls() {
|
||||
return $this->showEditControls;
|
||||
}
|
||||
|
||||
public function getItem() {
|
||||
$task = $this->getTask();
|
||||
$owner = $this->getOwner();
|
||||
|
@ -89,24 +99,26 @@ final class ProjectBoardTaskCard extends Phobject {
|
|||
->setDisabled($task->isClosed())
|
||||
->setBarColor($bar_color);
|
||||
|
||||
if ($can_edit) {
|
||||
$card
|
||||
->addSigil('draggable-card')
|
||||
->addClass('draggable-card');
|
||||
$edit_icon = 'fa-pencil';
|
||||
} else {
|
||||
$card
|
||||
->addClass('not-editable')
|
||||
->addClass('undraggable-card');
|
||||
$edit_icon = 'fa-lock red';
|
||||
}
|
||||
if ($this->getShowEditControls()) {
|
||||
if ($can_edit) {
|
||||
$card
|
||||
->addSigil('draggable-card')
|
||||
->addClass('draggable-card');
|
||||
$edit_icon = 'fa-pencil';
|
||||
} else {
|
||||
$card
|
||||
->addClass('not-editable')
|
||||
->addClass('undraggable-card');
|
||||
$edit_icon = 'fa-lock red';
|
||||
}
|
||||
|
||||
$card->addAction(
|
||||
id(new PHUIListItemView())
|
||||
->setName(pht('Edit'))
|
||||
->setIcon($edit_icon)
|
||||
->addSigil('edit-project-card')
|
||||
->setHref('/maniphest/task/edit/'.$task->getID().'/'));
|
||||
$card->addAction(
|
||||
id(new PHUIListItemView())
|
||||
->setName(pht('Edit'))
|
||||
->setIcon($edit_icon)
|
||||
->addSigil('edit-project-card')
|
||||
->setHref('/maniphest/task/edit/'.$task->getID().'/'));
|
||||
}
|
||||
|
||||
if ($owner) {
|
||||
$card->addHandleIcon($owner, $owner->getName());
|
||||
|
|
Loading…
Reference in a new issue