1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-29 00:40:57 +01:00

Show projects on Maniphest tasks

Summary:
  - Remove the "Priority" column, since this is indicated by the color swatch, to save space.
  - Reduce the "Updated" column from datetime to date only, since time isn't incredibly useful, to save space.
  - Show the first two projects a task is associated with, and "..." if there are more.
  - Show "None" (for "no owner") in a lighter color.

Test Plan: Looked at tasks on homepage and in Maniphest.

Reviewers: btrahan, 20after4

Reviewed By: btrahan

CC: aran, edward

Maniphest Tasks: T967

Differential Revision: https://secure.phabricator.com/D2065
This commit is contained in:
epriestley 2012-04-02 10:27:31 -07:00
parent c7b0daadb8
commit 49a0b3fab0
10 changed files with 172 additions and 22 deletions

View file

@ -1436,7 +1436,7 @@ celerity_register_resource_map(array(
),
'maniphest-task-summary-css' =>
array(
'uri' => '/res/9d8a5516/rsrc/css/application/maniphest/task-summary.css',
'uri' => '/res/ddb926e4/rsrc/css/application/maniphest/task-summary.css',
'type' => 'css',
'requires' =>
array(
@ -1720,6 +1720,15 @@ celerity_register_resource_map(array(
),
'disk' => '/rsrc/css/application/profile/profile-header-view.css',
),
'phabricator-project-tag-css' =>
array(
'uri' => '/res/c0a3c26b/rsrc/css/application/projects/project-tag.css',
'type' => 'css',
'requires' =>
array(
),
'disk' => '/rsrc/css/application/projects/project-tag.css',
),
'phabricator-remarkup-css' =>
array(
'uri' => '/res/43702d3c/rsrc/css/core/remarkup.css',
@ -2124,7 +2133,7 @@ celerity_register_resource_map(array(
'uri' => '/res/pkg/4fbae2af/javelin.pkg.js',
'type' => 'js',
),
'7cc1c9a3' =>
'8315b569' =>
array(
'name' => 'maniphest.pkg.css',
'symbols' =>
@ -2134,7 +2143,7 @@ celerity_register_resource_map(array(
2 => 'maniphest-task-detail-css',
3 => 'aphront-attached-file-view-css',
),
'uri' => '/res/pkg/7cc1c9a3/maniphest.pkg.css',
'uri' => '/res/pkg/8315b569/maniphest.pkg.css',
'type' => 'css',
),
'86fc0b0c' =>
@ -2169,7 +2178,7 @@ celerity_register_resource_map(array(
),
'reverse' =>
array(
'aphront-attached-file-view-css' => '7cc1c9a3',
'aphront-attached-file-view-css' => '8315b569',
'aphront-crumbs-view-css' => '61493db4',
'aphront-dialog-view-css' => '61493db4',
'aphront-form-view-css' => '61493db4',
@ -2235,9 +2244,9 @@ celerity_register_resource_map(array(
'javelin-util' => '4fbae2af',
'javelin-vector' => '4fbae2af',
'javelin-workflow' => '21d01ed8',
'maniphest-task-detail-css' => '7cc1c9a3',
'maniphest-task-summary-css' => '7cc1c9a3',
'maniphest-transaction-detail-css' => '7cc1c9a3',
'maniphest-task-detail-css' => '8315b569',
'maniphest-task-summary-css' => '8315b569',
'maniphest-transaction-detail-css' => '8315b569',
'phabricator-app-buttons-css' => '61493db4',
'phabricator-content-source-view-css' => '18be02e0',
'phabricator-core-buttons-css' => '61493db4',

View file

@ -455,6 +455,7 @@ phutil_register_library_map(array(
'ManiphestTaskOwner' => 'applications/maniphest/constants/owner',
'ManiphestTaskPriority' => 'applications/maniphest/constants/priority',
'ManiphestTaskProject' => 'applications/maniphest/storage/taskproject',
'ManiphestTaskProjectsView' => 'applications/maniphest/view/taskprojects',
'ManiphestTaskQuery' => 'applications/maniphest/query',
'ManiphestTaskStatus' => 'applications/maniphest/constants/status',
'ManiphestTaskSubscriber' => 'applications/maniphest/storage/subscriber',
@ -1311,6 +1312,7 @@ phutil_register_library_map(array(
'ManiphestTaskOwner' => 'ManiphestConstants',
'ManiphestTaskPriority' => 'ManiphestConstants',
'ManiphestTaskProject' => 'ManiphestDAO',
'ManiphestTaskProjectsView' => 'ManiphestView',
'ManiphestTaskStatus' => 'ManiphestConstants',
'ManiphestTaskSubscriber' => 'ManiphestDAO',
'ManiphestTaskSummaryView' => 'ManiphestView',

View file

@ -372,7 +372,10 @@ final class PhabricatorDirectoryMainController
private function buildTaskListView(array $tasks) {
$user = $this->getRequest()->getUser();
$phids = array_filter(mpull($tasks, 'getOwnerPHID'));
$phids = array_merge(
array_filter(mpull($tasks, 'getOwnerPHID')),
array_mergev(mpull($tasks, 'getProjectPHIDs')));
$handles = id(new PhabricatorObjectHandleData($phids))->loadHandles();
$view = new ManiphestTaskListView();

View file

@ -412,7 +412,8 @@ final class ManiphestTaskListController extends ManiphestController {
$xproject_phids,
$owner_phids,
$author_phids,
$project_group_phids);
$project_group_phids,
array_mergev(mpull($data, 'getProjectPHIDs')));
$handles = id(new PhabricatorObjectHandleData($handle_phids))
->loadHandles();

View file

@ -0,0 +1,73 @@
<?php
/*
* Copyright 2012 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* @group maniphest
*/
final class ManiphestTaskProjectsView extends ManiphestView {
private $handles;
public function setHandles(array $handles) {
$this->handles = $handles;
return $this;
}
public function render() {
require_celerity_resource('phabricator-project-tag-css');
$show = array_slice($this->handles, 0, 2);
$tags = array();
foreach ($show as $handle) {
$tags[] = phutil_render_tag(
'a',
array(
'href' => $handle->getURI(),
'class' => 'phabricator-project-tag',
),
phutil_escape_html($handle->getName()));
}
if (count($this->handles) > 2) {
require_celerity_resource('aphront-tooltip-css');
Javelin::initBehavior('phabricator-tooltips');
$all = array();
foreach ($this->handles as $handle) {
$all[] = $handle->getName();
}
$tags[] = javelin_render_tag(
'span',
array(
'class' => 'phabricator-project-tag',
'sigil' => 'has-tooltip',
'meta' => array(
'tip' => phutil_escape_html(implode(', ', $all)),
'size' => 200,
),
),
"\xE2\x80\xA6");
}
return implode("\n", $tags);
}
}

View file

@ -0,0 +1,17 @@
<?php
/**
* This file is automatically generated. Lint this module to rebuild it.
* @generated
*/
phutil_require_module('phabricator', 'applications/maniphest/view/base');
phutil_require_module('phabricator', 'infrastructure/celerity/api');
phutil_require_module('phabricator', 'infrastructure/javelin/api');
phutil_require_module('phabricator', 'infrastructure/javelin/markup');
phutil_require_module('phutil', 'markup');
phutil_require_source('ManiphestTaskProjectsView.php');

View file

@ -85,6 +85,12 @@ final class ManiphestTaskSummaryView extends ManiphestView {
'</td>';
}
$projects_view = new ManiphestTaskProjectsView();
$projects_view->setHandles(
array_select_keys(
$this->handles,
$task->getProjectPHIDs()));
return javelin_render_tag(
'table',
array(
@ -114,11 +120,11 @@ final class ManiphestTaskSummaryView extends ManiphestView {
),
phutil_escape_html($task->getTitle())).
'</td>'.
'<td class="maniphest-task-priority">'.
ManiphestTaskPriority::getTaskPriorityName($task->getPriority()).
'<td class="maniphest-task-projects">'.
$projects_view->render().
'</td>'.
'<td class="maniphest-task-updated">'.
phabricator_datetime($task->getDateModified(), $this->user).
phabricator_date($task->getDateModified(), $this->user).
'</td>'.
'</tr>');
}

View file

@ -9,6 +9,7 @@
phutil_require_module('phabricator', 'applications/maniphest/constants/priority');
phutil_require_module('phabricator', 'applications/maniphest/constants/status');
phutil_require_module('phabricator', 'applications/maniphest/view/base');
phutil_require_module('phabricator', 'applications/maniphest/view/taskprojects');
phutil_require_module('phabricator', 'infrastructure/celerity/api');
phutil_require_module('phabricator', 'infrastructure/javelin/markup');
phutil_require_module('phabricator', 'view/utils');

View file

@ -7,13 +7,13 @@
margin: 4px 0;
border-collapse: collapse;
font-size: 13px;
font-size: 12px;
color: #222222;
}
.maniphest-task-summary td {
padding: 4px 6px;
background: #f6f6f6;
padding: 5px 3px;
background: #f9f9f9;
white-space: nowrap;
border-style: solid;
@ -22,6 +22,10 @@
border-width: 1px 0;
}
.maniphest-task-summary td em {
color: #888888;
}
.maniphest-batch-selected td {
background: #f6ff88;
}
@ -35,7 +39,8 @@
}
.maniphest-task-summary td.maniphest-task-batch {
width: 30px;
padding-right: 0px;
width: 16px;
text-align: center;
}
@ -44,14 +49,19 @@
cursor: pointer;
}
.maniphest-task-summary td.maniphest-task-batch input {
margin: 0;
}
.maniphest-task-summary td.maniphest-task-number {
font-weight: bold;
color: #444444;
width: 60px;
width: 70px;
text-align: right;
}
.maniphest-task-summary td.maniphest-task-status {
width: 80px;
width: 60px;
text-align: center;
}
@ -65,13 +75,16 @@
white-space: normal;
}
.maniphest-task-summary td.maniphest-task-priority {
width: 100px;
.maniphest-task-summary td.maniphest-task-projects {
width: 180px;
text-align: right;
white-space: normal;
}
.maniphest-task-summary td.maniphest-task-updated {
text-align: left;
width: 180px;
text-align: right;
width: 85px;
padding-right: 8px;
border-right-width: 1px;
border-right-style: solid;
border-right-color: #787878;

View file

@ -0,0 +1,25 @@
/**
* @provides phabricator-project-tag-css
*/
.phabricator-project-tag,
.phabricator-project-tag:link,
.phabricator-project-tag:visited {
font-weight: normal;
border: 1px solid #bfcfef;
padding: 1px 4px 2px;
background: #f9f9ff;
color: #667799;
text-decoration: none;
font-size: 11px;
display: inline;
cursor: pointer;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
}
.phabricator-project-tag:hover {
background: #dfdfef;
}