Add very basic UI for creating milestones and subprojects
Summary:
Ref T10010. This has a lot of UI/UX problems but I think it:
- technically allows subproject creation;
- technically allows milestone creation;
- doesn't let users unwittingly destroy their installs (probably).
Test Plan:
- Created milestones.
- Created subprojects.
- Created and edited normal projects.
- Observed some reasonable interactions (e.g., you can't create milestones for a milestone or edit a superproject's members).
- Observed plenty of silly/confusing interactions that need additional work.
{F1046657}
{F1046658}
{F1046655}
{F1046656}
{F1046654}
Reviewers: chad
Reviewed By: chad
Maniphest Tasks: T10010
Differential Revision: https://secure.phabricator.com/D14904
This commit is contained in:
@@ -18,6 +18,63 @@ final class PhabricatorProjectSubprojectsController
|
||||
$project = $this->getProject();
|
||||
$id = $project->getID();
|
||||
|
||||
$can_edit = PhabricatorPolicyFilter::hasCapability(
|
||||
$viewer,
|
||||
$project,
|
||||
PhabricatorPolicyCapability::CAN_EDIT);
|
||||
|
||||
$has_support = $project->supportsSubprojects();
|
||||
|
||||
if ($has_support) {
|
||||
$subprojects = id(new PhabricatorProjectQuery())
|
||||
->setViewer($viewer)
|
||||
->withParentProjectPHIDs(array($project->getPHID()))
|
||||
->needImages(true)
|
||||
->withIsMilestone(false)
|
||||
->execute();
|
||||
} else {
|
||||
$subprojects = array();
|
||||
}
|
||||
|
||||
$can_create = $can_edit && $has_support;
|
||||
|
||||
if ($project->getHasSubprojects()) {
|
||||
$button_text = pht('Create Subproject');
|
||||
} else {
|
||||
$button_text = pht('Add Subprojects');
|
||||
}
|
||||
|
||||
$header = id(new PHUIHeaderView())
|
||||
->setHeader(pht('Subprojects'))
|
||||
->addActionLink(
|
||||
id(new PHUIButtonView())
|
||||
->setTag('a')
|
||||
->setHref("/project/edit/?parent={$id}")
|
||||
->setIconFont('fa-plus')
|
||||
->setDisabled(!$can_create)
|
||||
->setWorkflow(!$can_create)
|
||||
->setText($button_text));
|
||||
|
||||
$box = id(new PHUIObjectBoxView())
|
||||
->setHeader($header);
|
||||
|
||||
if (!$has_support) {
|
||||
$no_support = pht(
|
||||
'This project is a milestone. Milestones can not have subprojects.');
|
||||
|
||||
$info_view = id(new PHUIInfoView())
|
||||
->setErrors(array($no_support))
|
||||
->setSeverity(PHUIInfoView::SEVERITY_WARNING);
|
||||
|
||||
$box->setInfoView($info_view);
|
||||
}
|
||||
|
||||
$box->setObjectList(
|
||||
id(new PhabricatorProjectListView())
|
||||
->setUser($viewer)
|
||||
->setProjects($subprojects)
|
||||
->renderList());
|
||||
|
||||
$nav = $this->buildIconNavView($project);
|
||||
$nav->selectFilter("subprojects/{$id}/");
|
||||
|
||||
@@ -27,7 +84,8 @@ final class PhabricatorProjectSubprojectsController
|
||||
return $this->newPage()
|
||||
->setNavigation($nav)
|
||||
->setCrumbs($crumbs)
|
||||
->setTitle(array($project->getName(), pht('Subprojects')));
|
||||
->setTitle(array($project->getName(), pht('Subprojects')))
|
||||
->appendChild($box);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user