Project revamp part 2: Edit

Summary:
Taking a pass at revamping the edit pages in Projects. Specifically:

 - Remove EditMainController
 - Move actions from EditMain to Profile
 - Move properties from EditMain to Profile
 - Move timeline from EditMain to Profile
 - Move Open Tasks from Profile to sidenavicon
 - Add custom icons and colors to timeline

Feel free to bang on this a bit and give feedback, feels generally correct to me.

Test Plan: Edit everything I could on various projects. Check links, timelines, actions.

Reviewers: btrahan, epriestley

Reviewed By: epriestley

Subscribers: Korvin, epriestley

Differential Revision: https://secure.phabricator.com/D11421
This commit is contained in:
Chad Little
2015-01-19 10:14:27 -08:00
parent 9a7ad972cd
commit 3bc54c2041
12 changed files with 128 additions and 266 deletions

View File

@@ -33,26 +33,12 @@ final class PhabricatorProjectProfileController
}
$picture = $project->getProfileImageURI();
require_celerity_resource('phabricator-profile-css');
$tasks = $this->renderTasksPage($project);
$content = phutil_tag_div('phabricator-project-layout', $tasks);
$phid = $project->getPHID();
$create_uri = '/maniphest/task/create/?projects='.$phid;
$icon_new = id(new PHUIIconView())
->setIconFont('fa-plus');
$button_add = id(new PHUIButtonView())
->setTag('a')
->setText(pht('New Task'))
->setHref($create_uri)
->setIcon($icon_new);
$header = id(new PHUIHeaderView())
->setHeader($project->getName())
->setUser($user)
->setPolicyObject($project)
->setImage($picture)
->addActionLink($button_add);
->setImage($picture);
if ($project->getStatus() == PhabricatorProjectStatus::STATUS_ACTIVE) {
$header->setStatus('fa-check', 'bluegrey', pht('Active'));
@@ -67,10 +53,15 @@ final class PhabricatorProjectProfileController
->setHeader($header)
->addPropertyList($properties);
$timeline = $this->buildTransactionTimeline(
$project,
new PhabricatorProjectTransactionQuery());
$timeline->setShouldTerminate(true);
$nav = $this->buildIconNavView($project);
$nav->selectFilter("profile/{$id}/");
$nav->appendChild($object_box);
$nav->appendChild($content);
$nav->appendChild($timeline);
return $this->buildApplicationPage(
array(
@@ -81,66 +72,6 @@ final class PhabricatorProjectProfileController
));
}
private function renderTasksPage(PhabricatorProject $project) {
$user = $this->getRequest()->getUser();
$limit = 50;
$query = id(new ManiphestTaskQuery())
->setViewer($user)
->withAnyProjects(array($project->getPHID()))
->withStatuses(ManiphestTaskStatus::getOpenStatusConstants())
->setOrderBy(ManiphestTaskQuery::ORDER_PRIORITY)
->needProjectPHIDs(true)
->setLimit(($limit + 1));
$tasks = $query->execute();
$count = count($tasks);
if ($count == ($limit + 1)) {
array_pop($tasks);
}
$phids = mpull($tasks, 'getOwnerPHID');
$phids = array_merge(
$phids,
array_mergev(mpull($tasks, 'getProjectPHIDs')));
$phids = array_filter($phids);
$handles = $this->loadViewerHandles($phids);
$task_list = new ManiphestTaskListView();
$task_list->setUser($user);
$task_list->setTasks($tasks);
$task_list->setHandles($handles);
$task_list->setNoDataString(pht('This project has no open tasks.'));
$phid = $project->getPHID();
$view_uri = urisprintf(
'/maniphest/?statuses=%s&allProjects=%s#R',
implode(',', ManiphestTaskStatus::getOpenStatusConstants()),
$phid);
$icon = id(new PHUIIconView())
->setIconFont('fa-search');
$button_view = id(new PHUIButtonView())
->setTag('a')
->setText(pht('View Query'))
->setHref($view_uri)
->setIcon($icon);
$header = id(new PHUIHeaderView())
->addActionLink($button_view);
if ($count > $limit) {
$header->setHeader(pht('Highest Priority (some)'));
} else {
$header->setHeader(pht('Highest Priority (all)'));
}
$content = id(new PHUIObjectBoxView())
->setHeader($header)
->appendChild($task_list);
return $content;
}
private function buildActionListView(PhabricatorProject $project) {
$request = $this->getRequest();
$viewer = $request->getUser();
@@ -159,10 +90,35 @@ final class PhabricatorProjectProfileController
$view->addAction(
id(new PhabricatorActionView())
->setName(pht('Edit Project'))
->setName(pht('Edit Details'))
->setIcon('fa-pencil')
->setHref($this->getApplicationURI("edit/{$id}/")));
->setHref($this->getApplicationURI("details/{$id}/")));
$view->addAction(
id(new PhabricatorActionView())
->setName(pht('Edit Picture'))
->setIcon('fa-picture-o')
->setHref($this->getApplicationURI("picture/{$id}/"))
->setDisabled(!$can_edit)
->setWorkflow(!$can_edit));
if ($project->isArchived()) {
$view->addAction(
id(new PhabricatorActionView())
->setName(pht('Activate Project'))
->setIcon('fa-check')
->setHref($this->getApplicationURI("archive/{$id}/"))
->setDisabled(!$can_edit)
->setWorkflow(true));
} else {
$view->addAction(
id(new PhabricatorActionView())
->setName(pht('Archive Project'))
->setIcon('fa-ban')
->setHref($this->getApplicationURI("archive/{$id}/"))
->setDisabled(!$can_edit)
->setWorkflow(true));
}
$action = null;
if (!$project->isUserMember($viewer->getPHID())) {
@@ -244,6 +200,20 @@ final class PhabricatorProjectProfileController
? $this->renderHandlesForPHIDs($project->getWatcherPHIDs(), ',')
: phutil_tag('em', array(), pht('None')));
$descriptions = PhabricatorPolicyQuery::renderPolicyDescriptions(
$viewer,
$project);
$this->loadHandles(array($project->getPHID()));
$view->addProperty(
pht('Looks Like'),
$this->getHandle($project->getPHID())->renderTag());
$view->addProperty(
pht('Joinable By'),
$descriptions[PhabricatorPolicyCapability::CAN_JOIN]);
$field_list = PhabricatorCustomField::getObjectFields(
$project,
PhabricatorCustomField::ROLE_VIEW);