mirror of
https://we.phorge.it/source/phorge.git
synced 2025-01-22 04:31:13 +01:00
Update Milestone/Subproject page
Summary: Cleans up the UI, moves details over to curtain, adds some fallback no data strings. Test Plan: Review with and without subprojects, milestones. Reviewers: epriestley Reviewed By: epriestley Subscribers: Korvin Differential Revision: https://secure.phabricator.com/D17907
This commit is contained in:
parent
bf753c8b5a
commit
29cfcc82ef
2 changed files with 76 additions and 99 deletions
|
@ -26,6 +26,9 @@ final class PhabricatorProjectSubprojectsController
|
|||
$allows_subprojects = $project->supportsSubprojects();
|
||||
$allows_milestones = $project->supportsMilestones();
|
||||
|
||||
$subproject_list = null;
|
||||
$milestone_list = null;
|
||||
|
||||
if ($allows_subprojects) {
|
||||
$subprojects = id(new PhabricatorProjectQuery())
|
||||
->setViewer($viewer)
|
||||
|
@ -33,6 +36,16 @@ final class PhabricatorProjectSubprojectsController
|
|||
->needImages(true)
|
||||
->withIsMilestone(false)
|
||||
->execute();
|
||||
|
||||
$subproject_list = id(new PHUIObjectBoxView())
|
||||
->setHeaderText(pht('%s Subprojects', $project->getName()))
|
||||
->setBackground(PHUIObjectBoxView::BLUE_PROPERTY)
|
||||
->setObjectList(
|
||||
id(new PhabricatorProjectListView())
|
||||
->setUser($viewer)
|
||||
->setProjects($subprojects)
|
||||
->setNoDataString(pht('This project has no subprojects.'))
|
||||
->renderList());
|
||||
} else {
|
||||
$subprojects = array();
|
||||
}
|
||||
|
@ -45,52 +58,25 @@ final class PhabricatorProjectSubprojectsController
|
|||
->withIsMilestone(true)
|
||||
->setOrderVector(array('milestoneNumber', 'id'))
|
||||
->execute();
|
||||
} else {
|
||||
$milestones = array();
|
||||
}
|
||||
|
||||
if ($milestones) {
|
||||
$milestone_list = id(new PHUIObjectBoxView())
|
||||
->setHeaderText(pht('Milestones'))
|
||||
->setHeaderText(pht('%s Milestones', $project->getName()))
|
||||
->setBackground(PHUIObjectBoxView::BLUE_PROPERTY)
|
||||
->setObjectList(
|
||||
id(new PhabricatorProjectListView())
|
||||
->setUser($viewer)
|
||||
->setProjects($milestones)
|
||||
->setNoDataString(pht('This project has no milestones.'))
|
||||
->renderList());
|
||||
} else {
|
||||
$milestone_list = null;
|
||||
$milestones = array();
|
||||
}
|
||||
|
||||
if ($subprojects) {
|
||||
$subproject_list = id(new PHUIObjectBoxView())
|
||||
->setHeaderText(pht('Subprojects'))
|
||||
->setBackground(PHUIObjectBoxView::BLUE_PROPERTY)
|
||||
->setObjectList(
|
||||
id(new PhabricatorProjectListView())
|
||||
->setUser($viewer)
|
||||
->setProjects($subprojects)
|
||||
->renderList());
|
||||
} else {
|
||||
$subproject_list = null;
|
||||
}
|
||||
|
||||
$property_list = $this->buildPropertyList(
|
||||
$project,
|
||||
$milestones,
|
||||
$subprojects);
|
||||
|
||||
$curtain = $this->buildCurtainView(
|
||||
$project,
|
||||
$milestones,
|
||||
$subprojects);
|
||||
|
||||
|
||||
$details = id(new PHUIObjectBoxView())
|
||||
->setHeaderText(pht('Details'))
|
||||
->setBackground(PHUIObjectBoxView::BLUE_PROPERTY)
|
||||
->addPropertyList($property_list);
|
||||
|
||||
$nav = $this->getProfileMenu();
|
||||
$nav->selectFilter(PhabricatorProject::ITEM_SUBPROJECTS);
|
||||
|
||||
|
@ -102,11 +88,24 @@ final class PhabricatorProjectSubprojectsController
|
|||
->setHeader(pht('Subprojects and Milestones'))
|
||||
->setHeaderIcon('fa-sitemap');
|
||||
|
||||
require_celerity_resource('project-view-css');
|
||||
|
||||
// This page isn't reachable via UI, but make it pretty anyways.
|
||||
$info_view = null;
|
||||
if (!$milestone_list && !$subproject_list) {
|
||||
$info_view = id(new PHUIInfoView())
|
||||
->setSeverity(PHUIInfoView::SEVERITY_NOTICE)
|
||||
->appendChild(pht('Milestone projects do not support subprojects '.
|
||||
'or milestones.'));
|
||||
}
|
||||
|
||||
$view = id(new PHUITwoColumnView())
|
||||
->setHeader($header)
|
||||
->setCurtain($curtain)
|
||||
->addClass('project-view-home')
|
||||
->addClass('project-view-people-home')
|
||||
->setMainColumn(array(
|
||||
$details,
|
||||
$info_view,
|
||||
$milestone_list,
|
||||
$subproject_list,
|
||||
));
|
||||
|
@ -118,73 +117,6 @@ final class PhabricatorProjectSubprojectsController
|
|||
->appendChild($view);
|
||||
}
|
||||
|
||||
private function buildPropertyList(
|
||||
PhabricatorProject $project,
|
||||
array $milestones,
|
||||
array $subprojects) {
|
||||
$viewer = $this->getViewer();
|
||||
|
||||
$view = id(new PHUIPropertyListView())
|
||||
->setUser($viewer);
|
||||
|
||||
$view->addProperty(
|
||||
pht('Prototype'),
|
||||
$this->renderStatus(
|
||||
'fa-exclamation-triangle red',
|
||||
pht('Warning'),
|
||||
pht('Subprojects and milestones are only partially implemented.')));
|
||||
|
||||
if (!$project->supportsMilestones()) {
|
||||
$milestone_status = $this->renderStatus(
|
||||
'fa-times grey',
|
||||
pht('Already Milestone'),
|
||||
pht(
|
||||
'This project is already a milestone, and milestones may not '.
|
||||
'have their own milestones.'));
|
||||
} else {
|
||||
if (!$milestones) {
|
||||
$milestone_status = $this->renderStatus(
|
||||
'fa-check grey',
|
||||
pht('None Created'),
|
||||
pht(
|
||||
'You can create milestones for this project.'));
|
||||
} else {
|
||||
$milestone_status = $this->renderStatus(
|
||||
'fa-check green',
|
||||
pht('Has Milestones'),
|
||||
pht('This project has milestones.'));
|
||||
}
|
||||
}
|
||||
|
||||
$view->addProperty(pht('Milestones'), $milestone_status);
|
||||
|
||||
if (!$project->supportsSubprojects()) {
|
||||
$subproject_status = $this->renderStatus(
|
||||
'fa-times grey',
|
||||
pht('Milestone'),
|
||||
pht(
|
||||
'This project is a milestone, and milestones may not have '.
|
||||
'subprojects.'));
|
||||
} else {
|
||||
if (!$subprojects) {
|
||||
$subproject_status = $this->renderStatus(
|
||||
'fa-check grey',
|
||||
pht('None Created'),
|
||||
pht('You can create subprojects for this project.'));
|
||||
} else {
|
||||
$subproject_status = $this->renderStatus(
|
||||
'fa-check green',
|
||||
pht('Has Subprojects'),
|
||||
pht(
|
||||
'This project has subprojects.'));
|
||||
}
|
||||
}
|
||||
|
||||
$view->addProperty(pht('Subprojects'), $subproject_status);
|
||||
|
||||
return $view;
|
||||
}
|
||||
|
||||
private function buildCurtainView(
|
||||
PhabricatorProject $project,
|
||||
array $milestones,
|
||||
|
@ -244,6 +176,39 @@ final class PhabricatorProjectSubprojectsController
|
|||
->setDisabled($subproject_disabled)
|
||||
->setWorkflow($subproject_workflow));
|
||||
|
||||
|
||||
if (!$project->supportsMilestones()) {
|
||||
$note = pht(
|
||||
'This project is already a milestone, and milestones may not '.
|
||||
'have their own milestones.');
|
||||
} else {
|
||||
if (!$milestones) {
|
||||
$note = pht('You can create milestones for this project.');
|
||||
} else {
|
||||
$note = pht('This project has milestones.');
|
||||
}
|
||||
}
|
||||
|
||||
$curtain->newPanel()
|
||||
->setHeaderText(pht('Milestones'))
|
||||
->appendChild($note);
|
||||
|
||||
if (!$project->supportsSubprojects()) {
|
||||
$note = pht(
|
||||
'This project is a milestone, and milestones may not have '.
|
||||
'subprojects.');
|
||||
} else {
|
||||
if (!$subprojects) {
|
||||
$note = pht('You can create subprojects for this project.');
|
||||
} else {
|
||||
$note = pht('This project has subprojects.');
|
||||
}
|
||||
}
|
||||
|
||||
$curtain->newPanel()
|
||||
->setHeaderText(pht('Subprojects'))
|
||||
->appendChild($note);
|
||||
|
||||
return $curtain;
|
||||
}
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@ final class PhabricatorProjectListView extends AphrontView {
|
|||
private $projects;
|
||||
private $showMember;
|
||||
private $showWatching;
|
||||
private $noDataString;
|
||||
|
||||
public function setProjects(array $projects) {
|
||||
$this->projects = $projects;
|
||||
|
@ -25,6 +26,11 @@ final class PhabricatorProjectListView extends AphrontView {
|
|||
return $this;
|
||||
}
|
||||
|
||||
public function setNoDataString($text) {
|
||||
$this->noDataString = $text;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function renderList() {
|
||||
$viewer = $this->getUser();
|
||||
$viewer_phid = $viewer->getPHID();
|
||||
|
@ -32,8 +38,14 @@ final class PhabricatorProjectListView extends AphrontView {
|
|||
|
||||
$handles = $viewer->loadHandles(mpull($projects, 'getPHID'));
|
||||
|
||||
$no_data = pht('No projects found.');
|
||||
if ($this->noDataString) {
|
||||
$no_data = $this->noDataString;
|
||||
}
|
||||
|
||||
$list = id(new PHUIObjectItemListView())
|
||||
->setUser($viewer);
|
||||
->setUser($viewer)
|
||||
->setNoDataString($no_data);
|
||||
|
||||
foreach ($projects as $key => $project) {
|
||||
$id = $project->getID();
|
||||
|
|
Loading…
Reference in a new issue