mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-22 06:42:42 +01:00
Improve workboard "Owner" grouping, add "Author" grouping and "Title" sort
Summary: Depends on D20277. Ref T10333. - Put profile icons on "Group by Owner". - Add a similar "Group by Author". Probably not terribly useful, but cheap to implement now. - Add "Sort by Title". Very likely not terribly useful, but cheap to implement and sort of flexible? Test Plan: {F6265396} Reviewers: amckinley Reviewed By: amckinley Maniphest Tasks: T10333 Differential Revision: https://secure.phabricator.com/D20278
This commit is contained in:
parent
8d74492875
commit
a6e17fb702
10 changed files with 223 additions and 13 deletions
|
@ -178,7 +178,7 @@ return array(
|
|||
'rsrc/css/phui/workboards/phui-workboard-color.css' => 'e86de308',
|
||||
'rsrc/css/phui/workboards/phui-workboard.css' => '74fc9d98',
|
||||
'rsrc/css/phui/workboards/phui-workcard.css' => '9e9eb0df',
|
||||
'rsrc/css/phui/workboards/phui-workpanel.css' => 'bc16cf33',
|
||||
'rsrc/css/phui/workboards/phui-workpanel.css' => 'c5b408ad',
|
||||
'rsrc/css/sprite-login.css' => '18b368a6',
|
||||
'rsrc/css/sprite-tokens.css' => 'f1896dc5',
|
||||
'rsrc/css/syntax/syntax-default.css' => '055fc231',
|
||||
|
@ -860,7 +860,7 @@ return array(
|
|||
'phui-workboard-color-css' => 'e86de308',
|
||||
'phui-workboard-view-css' => '74fc9d98',
|
||||
'phui-workcard-view-css' => '9e9eb0df',
|
||||
'phui-workpanel-view-css' => 'bc16cf33',
|
||||
'phui-workpanel-view-css' => 'c5b408ad',
|
||||
'phuix-action-list-view' => 'c68f183f',
|
||||
'phuix-action-view' => 'aaa08f3b',
|
||||
'phuix-autocomplete' => '8f139ef0',
|
||||
|
@ -1906,9 +1906,6 @@ return array(
|
|||
'javelin-uri',
|
||||
'phabricator-notification',
|
||||
),
|
||||
'bc16cf33' => array(
|
||||
'phui-workcard-view-css',
|
||||
),
|
||||
'bdce4d78' => array(
|
||||
'javelin-install',
|
||||
'javelin-util',
|
||||
|
@ -1939,6 +1936,9 @@ return array(
|
|||
'phabricator-phtize',
|
||||
'javelin-dom',
|
||||
),
|
||||
'c5b408ad' => array(
|
||||
'phui-workcard-view-css',
|
||||
),
|
||||
'c687e867' => array(
|
||||
'javelin-behavior',
|
||||
'javelin-dom',
|
||||
|
|
|
@ -4050,6 +4050,7 @@ phutil_register_library_map(array(
|
|||
'PhabricatorProjectColorTransaction' => 'applications/project/xaction/PhabricatorProjectColorTransaction.php',
|
||||
'PhabricatorProjectColorsConfigType' => 'applications/project/config/PhabricatorProjectColorsConfigType.php',
|
||||
'PhabricatorProjectColumn' => 'applications/project/storage/PhabricatorProjectColumn.php',
|
||||
'PhabricatorProjectColumnAuthorOrder' => 'applications/project/order/PhabricatorProjectColumnAuthorOrder.php',
|
||||
'PhabricatorProjectColumnCreatedOrder' => 'applications/project/order/PhabricatorProjectColumnCreatedOrder.php',
|
||||
'PhabricatorProjectColumnDetailController' => 'applications/project/controller/PhabricatorProjectColumnDetailController.php',
|
||||
'PhabricatorProjectColumnEditController' => 'applications/project/controller/PhabricatorProjectColumnEditController.php',
|
||||
|
@ -4066,6 +4067,7 @@ phutil_register_library_map(array(
|
|||
'PhabricatorProjectColumnQuery' => 'applications/project/query/PhabricatorProjectColumnQuery.php',
|
||||
'PhabricatorProjectColumnSearchEngine' => 'applications/project/query/PhabricatorProjectColumnSearchEngine.php',
|
||||
'PhabricatorProjectColumnStatusOrder' => 'applications/project/order/PhabricatorProjectColumnStatusOrder.php',
|
||||
'PhabricatorProjectColumnTitleOrder' => 'applications/project/order/PhabricatorProjectColumnTitleOrder.php',
|
||||
'PhabricatorProjectColumnTransaction' => 'applications/project/storage/PhabricatorProjectColumnTransaction.php',
|
||||
'PhabricatorProjectColumnTransactionEditor' => 'applications/project/editor/PhabricatorProjectColumnTransactionEditor.php',
|
||||
'PhabricatorProjectColumnTransactionQuery' => 'applications/project/query/PhabricatorProjectColumnTransactionQuery.php',
|
||||
|
@ -10138,6 +10140,7 @@ phutil_register_library_map(array(
|
|||
'PhabricatorExtendedPolicyInterface',
|
||||
'PhabricatorConduitResultInterface',
|
||||
),
|
||||
'PhabricatorProjectColumnAuthorOrder' => 'PhabricatorProjectColumnOrder',
|
||||
'PhabricatorProjectColumnCreatedOrder' => 'PhabricatorProjectColumnOrder',
|
||||
'PhabricatorProjectColumnDetailController' => 'PhabricatorProjectBoardController',
|
||||
'PhabricatorProjectColumnEditController' => 'PhabricatorProjectBoardController',
|
||||
|
@ -10157,6 +10160,7 @@ phutil_register_library_map(array(
|
|||
'PhabricatorProjectColumnQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
|
||||
'PhabricatorProjectColumnSearchEngine' => 'PhabricatorApplicationSearchEngine',
|
||||
'PhabricatorProjectColumnStatusOrder' => 'PhabricatorProjectColumnOrder',
|
||||
'PhabricatorProjectColumnTitleOrder' => 'PhabricatorProjectColumnOrder',
|
||||
'PhabricatorProjectColumnTransaction' => 'PhabricatorApplicationTransaction',
|
||||
'PhabricatorProjectColumnTransactionEditor' => 'PhabricatorApplicationTransactionEditor',
|
||||
'PhabricatorProjectColumnTransactionQuery' => 'PhabricatorApplicationTransactionQuery',
|
||||
|
|
|
@ -0,0 +1,139 @@
|
|||
<?php
|
||||
|
||||
final class PhabricatorProjectColumnAuthorOrder
|
||||
extends PhabricatorProjectColumnOrder {
|
||||
|
||||
const ORDERKEY = 'author';
|
||||
|
||||
public function getDisplayName() {
|
||||
return pht('Group by Author');
|
||||
}
|
||||
|
||||
protected function newMenuIconIcon() {
|
||||
return 'fa-user-plus';
|
||||
}
|
||||
|
||||
public function getHasHeaders() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public function getCanReorder() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public function getMenuOrder() {
|
||||
return 3000;
|
||||
}
|
||||
|
||||
protected function newHeaderKeyForObject($object) {
|
||||
return $this->newHeaderKeyForAuthorPHID($object->getAuthorPHID());
|
||||
}
|
||||
|
||||
private function newHeaderKeyForAuthorPHID($author_phid) {
|
||||
return sprintf('author(%s)', $author_phid);
|
||||
}
|
||||
|
||||
protected function newSortVectorsForObjects(array $objects) {
|
||||
$author_phids = mpull($objects, null, 'getAuthorPHID');
|
||||
$author_phids = array_keys($author_phids);
|
||||
$author_phids = array_filter($author_phids);
|
||||
|
||||
if ($author_phids) {
|
||||
$author_users = id(new PhabricatorPeopleQuery())
|
||||
->setViewer($this->getViewer())
|
||||
->withPHIDs($author_phids)
|
||||
->execute();
|
||||
$author_users = mpull($author_users, null, 'getPHID');
|
||||
} else {
|
||||
$author_users = array();
|
||||
}
|
||||
|
||||
$vectors = array();
|
||||
foreach ($objects as $vector_key => $object) {
|
||||
$author_phid = $object->getAuthorPHID();
|
||||
$author = idx($author_users, $author_phid);
|
||||
if ($author) {
|
||||
$vector = $this->newSortVectorForAuthor($author);
|
||||
} else {
|
||||
$vector = $this->newSortVectorForAuthorPHID($author_phid);
|
||||
}
|
||||
|
||||
$vectors[$vector_key] = $vector;
|
||||
}
|
||||
|
||||
return $vectors;
|
||||
}
|
||||
|
||||
private function newSortVectorForAuthor(PhabricatorUser $user) {
|
||||
return array(
|
||||
1,
|
||||
$user->getUsername(),
|
||||
);
|
||||
}
|
||||
|
||||
private function newSortVectorForAuthorPHID($author_phid) {
|
||||
return array(
|
||||
2,
|
||||
$author_phid,
|
||||
);
|
||||
}
|
||||
|
||||
protected function newHeadersForObjects(array $objects) {
|
||||
$author_phids = mpull($objects, null, 'getAuthorPHID');
|
||||
$author_phids = array_keys($author_phids);
|
||||
$author_phids = array_filter($author_phids);
|
||||
|
||||
if ($author_phids) {
|
||||
$author_users = id(new PhabricatorPeopleQuery())
|
||||
->setViewer($this->getViewer())
|
||||
->withPHIDs($author_phids)
|
||||
->needProfileImage(true)
|
||||
->execute();
|
||||
$author_users = mpull($author_users, null, 'getPHID');
|
||||
} else {
|
||||
$author_users = array();
|
||||
}
|
||||
|
||||
$headers = array();
|
||||
foreach ($author_phids as $author_phid) {
|
||||
$header_key = $this->newHeaderKeyForAuthorPHID($author_phid);
|
||||
|
||||
$author = idx($author_users, $author_phid);
|
||||
if ($author) {
|
||||
$sort_vector = $this->newSortVectorForAuthor($author);
|
||||
$author_name = $author->getUsername();
|
||||
$author_image = $author->getProfileImageURI();
|
||||
} else {
|
||||
$sort_vector = $this->newSortVectorForAuthorPHID($author_phid);
|
||||
$author_name = pht('Unknown User ("%s")', $author_phid);
|
||||
$author_image = null;
|
||||
}
|
||||
|
||||
$author_icon = 'fa-user';
|
||||
$author_color = 'bluegrey';
|
||||
|
||||
$icon_view = id(new PHUIIconView());
|
||||
|
||||
if ($author_image) {
|
||||
$icon_view->setImage($author_image);
|
||||
} else {
|
||||
$icon_view->setIcon($author_icon, $author_color);
|
||||
}
|
||||
|
||||
$header = $this->newHeader()
|
||||
->setHeaderKey($header_key)
|
||||
->setSortVector($sort_vector)
|
||||
->setName($author_name)
|
||||
->setIcon($icon_view)
|
||||
->setEditProperties(
|
||||
array(
|
||||
'value' => $author_phid,
|
||||
));
|
||||
|
||||
$headers[] = $header;
|
||||
}
|
||||
|
||||
return $headers;
|
||||
}
|
||||
|
||||
}
|
|
@ -22,7 +22,7 @@ final class PhabricatorProjectColumnCreatedOrder
|
|||
}
|
||||
|
||||
public function getMenuOrder() {
|
||||
return 3000;
|
||||
return 5000;
|
||||
}
|
||||
|
||||
protected function newSortVectorForObject($object) {
|
||||
|
|
|
@ -85,7 +85,12 @@ final class PhabricatorProjectColumnHeader
|
|||
),
|
||||
array(
|
||||
$icon_view,
|
||||
$name,
|
||||
phutil_tag(
|
||||
'span',
|
||||
array(
|
||||
'class' => 'workboard-group-header-name',
|
||||
),
|
||||
$name),
|
||||
));
|
||||
|
||||
return $template;
|
||||
|
|
|
@ -108,6 +108,7 @@ final class PhabricatorProjectColumnOwnerOrder
|
|||
$owner_users = id(new PhabricatorPeopleQuery())
|
||||
->setViewer($this->getViewer())
|
||||
->withPHIDs($owner_phids)
|
||||
->needProfileImage(true)
|
||||
->execute();
|
||||
$owner_users = mpull($owner_users, null, 'getPHID');
|
||||
} else {
|
||||
|
@ -120,6 +121,7 @@ final class PhabricatorProjectColumnOwnerOrder
|
|||
foreach ($owner_phids as $owner_phid) {
|
||||
$header_key = $this->newHeaderKeyForOwnerPHID($owner_phid);
|
||||
|
||||
$owner_image = null;
|
||||
if ($owner_phid === null) {
|
||||
$owner = null;
|
||||
$sort_vector = $this->newSortVectorForUnowned();
|
||||
|
@ -129,6 +131,7 @@ final class PhabricatorProjectColumnOwnerOrder
|
|||
if ($owner) {
|
||||
$sort_vector = $this->newSortVectorForOwner($owner);
|
||||
$owner_name = $owner->getUsername();
|
||||
$owner_image = $owner->getProfileImageURI();
|
||||
} else {
|
||||
$sort_vector = $this->newSortVectorForOwnerPHID($owner_phid);
|
||||
$owner_name = pht('Unknown User ("%s")', $owner_phid);
|
||||
|
@ -138,8 +141,13 @@ final class PhabricatorProjectColumnOwnerOrder
|
|||
$owner_icon = 'fa-user';
|
||||
$owner_color = 'bluegrey';
|
||||
|
||||
$icon_view = id(new PHUIIconView())
|
||||
->setIcon($owner_icon, $owner_color);
|
||||
$icon_view = id(new PHUIIconView());
|
||||
|
||||
if ($owner_image) {
|
||||
$icon_view->setImage($owner_image);
|
||||
} else {
|
||||
$icon_view->setIcon($owner_icon, $owner_color);
|
||||
}
|
||||
|
||||
$header = $this->newHeader()
|
||||
->setHeaderKey($header_key)
|
||||
|
|
|
@ -26,7 +26,7 @@ final class PhabricatorProjectColumnPointsOrder
|
|||
}
|
||||
|
||||
public function getMenuOrder() {
|
||||
return 4000;
|
||||
return 6000;
|
||||
}
|
||||
|
||||
protected function newSortVectorForObject($object) {
|
||||
|
|
|
@ -22,7 +22,7 @@ final class PhabricatorProjectColumnStatusOrder
|
|||
}
|
||||
|
||||
public function getMenuOrder() {
|
||||
return 3000;
|
||||
return 4000;
|
||||
}
|
||||
|
||||
protected function newHeaderKeyForObject($object) {
|
||||
|
|
|
@ -0,0 +1,34 @@
|
|||
<?php
|
||||
|
||||
final class PhabricatorProjectColumnTitleOrder
|
||||
extends PhabricatorProjectColumnOrder {
|
||||
|
||||
const ORDERKEY = 'title';
|
||||
|
||||
public function getDisplayName() {
|
||||
return pht('Sort by Title');
|
||||
}
|
||||
|
||||
protected function newMenuIconIcon() {
|
||||
return 'fa-sort-alpha-asc';
|
||||
}
|
||||
|
||||
public function getHasHeaders() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public function getCanReorder() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public function getMenuOrder() {
|
||||
return 7000;
|
||||
}
|
||||
|
||||
protected function newSortVectorForObject($object) {
|
||||
return array(
|
||||
$object->getTitle(),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
|
@ -148,13 +148,33 @@
|
|||
|
||||
.workboard-group-header {
|
||||
background: rgba({$alphablue}, 0.10);
|
||||
padding: 4px 8px;
|
||||
padding: 6px 8px;
|
||||
margin: 0 0 8px -8px;
|
||||
border-bottom: 1px solid {$lightgreyborder};
|
||||
font-weight: bold;
|
||||
color: {$darkgreytext};
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.workboard-group-header .phui-icon-view {
|
||||
margin-right: 8px;
|
||||
position: absolute;
|
||||
display: inline-block;
|
||||
width: 24px;
|
||||
padding: 5px 0 0 0;
|
||||
height: 19px;
|
||||
background-size: 100%;
|
||||
border-radius: 3px;
|
||||
background-repeat: no-repeat;
|
||||
text-align: center;
|
||||
background-color: {$lightgreybackground};
|
||||
border: 1px solid {$lightgreybackground};
|
||||
}
|
||||
|
||||
.workboard-group-header .workboard-group-header-name {
|
||||
display: block;
|
||||
position: relative;
|
||||
height: 24px;
|
||||
line-height: 24px;
|
||||
margin-left: 36px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue