mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-31 18:01:00 +01:00
Merge some of the project editing options into an edit UI
Summary: Ref T4426. This moves "Edit Details", "Edit Picture", and "Archive" to a separate "Edit" interface. "History" becomes part of this UI. Test Plan: {F114417} {F114418} Reviewers: btrahan, chad Reviewed By: chad CC: aran Maniphest Tasks: T4426 Differential Revision: https://secure.phabricator.com/D8248
This commit is contained in:
parent
ac09a1a245
commit
51acc22962
8 changed files with 185 additions and 123 deletions
|
@ -1844,8 +1844,10 @@ phutil_register_library_map(array(
|
||||||
'PhabricatorProjectCustomFieldStringIndex' => 'applications/project/storage/PhabricatorProjectCustomFieldStringIndex.php',
|
'PhabricatorProjectCustomFieldStringIndex' => 'applications/project/storage/PhabricatorProjectCustomFieldStringIndex.php',
|
||||||
'PhabricatorProjectDAO' => 'applications/project/storage/PhabricatorProjectDAO.php',
|
'PhabricatorProjectDAO' => 'applications/project/storage/PhabricatorProjectDAO.php',
|
||||||
'PhabricatorProjectDescriptionField' => 'applications/project/customfield/PhabricatorProjectDescriptionField.php',
|
'PhabricatorProjectDescriptionField' => 'applications/project/customfield/PhabricatorProjectDescriptionField.php',
|
||||||
|
'PhabricatorProjectEditDetailsController' => 'applications/project/controller/PhabricatorProjectEditDetailsController.php',
|
||||||
|
'PhabricatorProjectEditMainController' => 'applications/project/controller/PhabricatorProjectEditMainController.php',
|
||||||
|
'PhabricatorProjectEditPictureController' => 'applications/project/controller/PhabricatorProjectEditPictureController.php',
|
||||||
'PhabricatorProjectEditorTestCase' => 'applications/project/editor/__tests__/PhabricatorProjectEditorTestCase.php',
|
'PhabricatorProjectEditorTestCase' => 'applications/project/editor/__tests__/PhabricatorProjectEditorTestCase.php',
|
||||||
'PhabricatorProjectHistoryController' => 'applications/project/controller/PhabricatorProjectHistoryController.php',
|
|
||||||
'PhabricatorProjectListController' => 'applications/project/controller/PhabricatorProjectListController.php',
|
'PhabricatorProjectListController' => 'applications/project/controller/PhabricatorProjectListController.php',
|
||||||
'PhabricatorProjectMembersEditController' => 'applications/project/controller/PhabricatorProjectMembersEditController.php',
|
'PhabricatorProjectMembersEditController' => 'applications/project/controller/PhabricatorProjectMembersEditController.php',
|
||||||
'PhabricatorProjectMoveController' => 'applications/project/controller/PhabricatorProjectMoveController.php',
|
'PhabricatorProjectMoveController' => 'applications/project/controller/PhabricatorProjectMoveController.php',
|
||||||
|
@ -1853,8 +1855,6 @@ phutil_register_library_map(array(
|
||||||
'PhabricatorProjectPHIDTypeColumn' => 'applications/project/phid/PhabricatorProjectPHIDTypeColumn.php',
|
'PhabricatorProjectPHIDTypeColumn' => 'applications/project/phid/PhabricatorProjectPHIDTypeColumn.php',
|
||||||
'PhabricatorProjectPHIDTypeProject' => 'applications/project/phid/PhabricatorProjectPHIDTypeProject.php',
|
'PhabricatorProjectPHIDTypeProject' => 'applications/project/phid/PhabricatorProjectPHIDTypeProject.php',
|
||||||
'PhabricatorProjectProfileController' => 'applications/project/controller/PhabricatorProjectProfileController.php',
|
'PhabricatorProjectProfileController' => 'applications/project/controller/PhabricatorProjectProfileController.php',
|
||||||
'PhabricatorProjectProfileEditController' => 'applications/project/controller/PhabricatorProjectProfileEditController.php',
|
|
||||||
'PhabricatorProjectProfilePictureController' => 'applications/project/controller/PhabricatorProjectProfilePictureController.php',
|
|
||||||
'PhabricatorProjectQuery' => 'applications/project/query/PhabricatorProjectQuery.php',
|
'PhabricatorProjectQuery' => 'applications/project/query/PhabricatorProjectQuery.php',
|
||||||
'PhabricatorProjectSearchEngine' => 'applications/project/query/PhabricatorProjectSearchEngine.php',
|
'PhabricatorProjectSearchEngine' => 'applications/project/query/PhabricatorProjectSearchEngine.php',
|
||||||
'PhabricatorProjectSearchIndexer' => 'applications/project/search/PhabricatorProjectSearchIndexer.php',
|
'PhabricatorProjectSearchIndexer' => 'applications/project/search/PhabricatorProjectSearchIndexer.php',
|
||||||
|
@ -4591,8 +4591,10 @@ phutil_register_library_map(array(
|
||||||
'PhabricatorProjectCustomFieldStringIndex' => 'PhabricatorCustomFieldStringIndexStorage',
|
'PhabricatorProjectCustomFieldStringIndex' => 'PhabricatorCustomFieldStringIndexStorage',
|
||||||
'PhabricatorProjectDAO' => 'PhabricatorLiskDAO',
|
'PhabricatorProjectDAO' => 'PhabricatorLiskDAO',
|
||||||
'PhabricatorProjectDescriptionField' => 'PhabricatorProjectStandardCustomField',
|
'PhabricatorProjectDescriptionField' => 'PhabricatorProjectStandardCustomField',
|
||||||
|
'PhabricatorProjectEditDetailsController' => 'PhabricatorProjectController',
|
||||||
|
'PhabricatorProjectEditMainController' => 'PhabricatorProjectController',
|
||||||
|
'PhabricatorProjectEditPictureController' => 'PhabricatorProjectController',
|
||||||
'PhabricatorProjectEditorTestCase' => 'PhabricatorTestCase',
|
'PhabricatorProjectEditorTestCase' => 'PhabricatorTestCase',
|
||||||
'PhabricatorProjectHistoryController' => 'PhabricatorProjectController',
|
|
||||||
'PhabricatorProjectListController' =>
|
'PhabricatorProjectListController' =>
|
||||||
array(
|
array(
|
||||||
0 => 'PhabricatorProjectController',
|
0 => 'PhabricatorProjectController',
|
||||||
|
@ -4604,8 +4606,6 @@ phutil_register_library_map(array(
|
||||||
'PhabricatorProjectPHIDTypeColumn' => 'PhabricatorPHIDType',
|
'PhabricatorProjectPHIDTypeColumn' => 'PhabricatorPHIDType',
|
||||||
'PhabricatorProjectPHIDTypeProject' => 'PhabricatorPHIDType',
|
'PhabricatorProjectPHIDTypeProject' => 'PhabricatorPHIDType',
|
||||||
'PhabricatorProjectProfileController' => 'PhabricatorProjectController',
|
'PhabricatorProjectProfileController' => 'PhabricatorProjectController',
|
||||||
'PhabricatorProjectProfileEditController' => 'PhabricatorProjectController',
|
|
||||||
'PhabricatorProjectProfilePictureController' => 'PhabricatorProjectController',
|
|
||||||
'PhabricatorProjectQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
|
'PhabricatorProjectQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
|
||||||
'PhabricatorProjectSearchEngine' => 'PhabricatorApplicationSearchEngine',
|
'PhabricatorProjectSearchEngine' => 'PhabricatorApplicationSearchEngine',
|
||||||
'PhabricatorProjectSearchIndexer' => 'PhabricatorSearchDocumentIndexer',
|
'PhabricatorProjectSearchIndexer' => 'PhabricatorSearchDocumentIndexer',
|
||||||
|
|
|
@ -37,15 +37,17 @@ final class PhabricatorApplicationProject extends PhabricatorApplication {
|
||||||
'/project/' => array(
|
'/project/' => array(
|
||||||
'(?:query/(?P<queryKey>[^/]+)/)?' => 'PhabricatorProjectListController',
|
'(?:query/(?P<queryKey>[^/]+)/)?' => 'PhabricatorProjectListController',
|
||||||
'filter/(?P<filter>[^/]+)/' => 'PhabricatorProjectListController',
|
'filter/(?P<filter>[^/]+)/' => 'PhabricatorProjectListController',
|
||||||
'edit/(?P<id>[1-9]\d*)/' => 'PhabricatorProjectProfileEditController',
|
'edit/(?P<id>[1-9]\d*)/' => 'PhabricatorProjectEditMainController',
|
||||||
|
'details/(?P<id>[1-9]\d*)/'
|
||||||
|
=> 'PhabricatorProjectEditDetailsController',
|
||||||
'archive/(?P<id>[1-9]\d*)/' =>
|
'archive/(?P<id>[1-9]\d*)/' =>
|
||||||
'PhabricatorProjectArchiveController',
|
'PhabricatorProjectArchiveController',
|
||||||
'members/(?P<id>[1-9]\d*)/'
|
'members/(?P<id>[1-9]\d*)/'
|
||||||
=> 'PhabricatorProjectMembersEditController',
|
=> 'PhabricatorProjectMembersEditController',
|
||||||
'view/(?P<id>[1-9]\d*)/(?:(?P<page>\w+)/)?'
|
'view/(?P<id>[1-9]\d*)/'
|
||||||
=> 'PhabricatorProjectProfileController',
|
=> 'PhabricatorProjectProfileController',
|
||||||
'picture/(?P<id>[1-9]\d*)/' =>
|
'picture/(?P<id>[1-9]\d*)/' =>
|
||||||
'PhabricatorProjectProfilePictureController',
|
'PhabricatorProjectEditPictureController',
|
||||||
'create/' => 'PhabricatorProjectCreateController',
|
'create/' => 'PhabricatorProjectCreateController',
|
||||||
'board/(?P<id>[1-9]\d*)/' => 'PhabricatorProjectBoardController',
|
'board/(?P<id>[1-9]\d*)/' => 'PhabricatorProjectBoardController',
|
||||||
'move/(?P<id>[1-9]\d*)/' => 'PhabricatorProjectMoveController',
|
'move/(?P<id>[1-9]\d*)/' => 'PhabricatorProjectMoveController',
|
||||||
|
|
|
@ -26,7 +26,7 @@ final class PhabricatorProjectArchiveController
|
||||||
return new Aphront404Response();
|
return new Aphront404Response();
|
||||||
}
|
}
|
||||||
|
|
||||||
$view_uri = $this->getApplicationURI('view/'.$project->getID().'/');
|
$edit_uri = $this->getApplicationURI('edit/'.$project->getID().'/');
|
||||||
|
|
||||||
if ($request->isFormPost()) {
|
if ($request->isFormPost()) {
|
||||||
if ($project->isArchived()) {
|
if ($project->isArchived()) {
|
||||||
|
@ -48,7 +48,7 @@ final class PhabricatorProjectArchiveController
|
||||||
->setContinueOnMissingFields(true)
|
->setContinueOnMissingFields(true)
|
||||||
->applyTransactions($project, $xactions);
|
->applyTransactions($project, $xactions);
|
||||||
|
|
||||||
return id(new AphrontRedirectResponse())->setURI($view_uri);
|
return id(new AphrontRedirectResponse())->setURI($edit_uri);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($project->isArchived()) {
|
if ($project->isArchived()) {
|
||||||
|
@ -65,7 +65,7 @@ final class PhabricatorProjectArchiveController
|
||||||
->setUser($viewer)
|
->setUser($viewer)
|
||||||
->setTitle($title)
|
->setTitle($title)
|
||||||
->appendChild($body)
|
->appendChild($body)
|
||||||
->addCancelButton($view_uri)
|
->addCancelButton($edit_uri)
|
||||||
->addSubmitButton($button);
|
->addSubmitButton($button);
|
||||||
|
|
||||||
return id(new AphrontDialogResponse())->setDialog($dialog);
|
return id(new AphrontDialogResponse())->setDialog($dialog);
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
final class PhabricatorProjectProfileEditController
|
final class PhabricatorProjectEditDetailsController
|
||||||
extends PhabricatorProjectController {
|
extends PhabricatorProjectController {
|
||||||
|
|
||||||
private $id;
|
private $id;
|
||||||
|
@ -34,6 +34,7 @@ final class PhabricatorProjectProfileEditController
|
||||||
->readFieldsFromStorage($project);
|
->readFieldsFromStorage($project);
|
||||||
|
|
||||||
$view_uri = $this->getApplicationURI('view/'.$project->getID().'/');
|
$view_uri = $this->getApplicationURI('view/'.$project->getID().'/');
|
||||||
|
$edit_uri = $this->getApplicationURI('edit/'.$project->getID().'/');
|
||||||
|
|
||||||
$e_name = true;
|
$e_name = true;
|
||||||
$e_edit = null;
|
$e_edit = null;
|
||||||
|
@ -81,7 +82,7 @@ final class PhabricatorProjectProfileEditController
|
||||||
try {
|
try {
|
||||||
$editor->applyTransactions($project, $xactions);
|
$editor->applyTransactions($project, $xactions);
|
||||||
|
|
||||||
return id(new AphrontRedirectResponse())->setURI($view_uri);
|
return id(new AphrontRedirectResponse())->setURI($edit_uri);
|
||||||
} catch (PhabricatorApplicationTransactionValidationException $ex) {
|
} catch (PhabricatorApplicationTransactionValidationException $ex) {
|
||||||
$validation_exception = $ex;
|
$validation_exception = $ex;
|
||||||
|
|
||||||
|
@ -119,7 +120,6 @@ final class PhabricatorProjectProfileEditController
|
||||||
id(new AphrontFormPolicyControl())
|
id(new AphrontFormPolicyControl())
|
||||||
->setUser($viewer)
|
->setUser($viewer)
|
||||||
->setName('can_view')
|
->setName('can_view')
|
||||||
->setCaption(pht('Members can always view a project.'))
|
|
||||||
->setPolicyObject($project)
|
->setPolicyObject($project)
|
||||||
->setPolicies($policies)
|
->setPolicies($policies)
|
||||||
->setCapability(PhabricatorPolicyCapability::CAN_VIEW))
|
->setCapability(PhabricatorPolicyCapability::CAN_VIEW))
|
||||||
|
@ -142,7 +142,7 @@ final class PhabricatorProjectProfileEditController
|
||||||
->setCapability(PhabricatorPolicyCapability::CAN_JOIN))
|
->setCapability(PhabricatorPolicyCapability::CAN_JOIN))
|
||||||
->appendChild(
|
->appendChild(
|
||||||
id(new AphrontFormSubmitControl())
|
id(new AphrontFormSubmitControl())
|
||||||
->addCancelButton($view_uri)
|
->addCancelButton($edit_uri)
|
||||||
->setValue(pht('Save')));
|
->setValue(pht('Save')));
|
||||||
|
|
||||||
$form_box = id(new PHUIObjectBoxView())
|
$form_box = id(new PHUIObjectBoxView())
|
||||||
|
@ -152,7 +152,8 @@ final class PhabricatorProjectProfileEditController
|
||||||
|
|
||||||
$crumbs = $this->buildApplicationCrumbs($this->buildSideNavView())
|
$crumbs = $this->buildApplicationCrumbs($this->buildSideNavView())
|
||||||
->addTextCrumb($project->getName(), $view_uri)
|
->addTextCrumb($project->getName(), $view_uri)
|
||||||
->addTextCrumb(pht('Edit Project'), $this->getApplicationURI());
|
->addTextCrumb(pht('Edit'), $edit_uri)
|
||||||
|
->addTextCrumb(pht('Details'));
|
||||||
|
|
||||||
return $this->buildApplicationPage(
|
return $this->buildApplicationPage(
|
||||||
array(
|
array(
|
|
@ -0,0 +1,155 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
final class PhabricatorProjectEditMainController
|
||||||
|
extends PhabricatorProjectController {
|
||||||
|
|
||||||
|
private $id;
|
||||||
|
|
||||||
|
public function willProcessRequest(array $data) {
|
||||||
|
$this->id = idx($data, 'id');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function processRequest() {
|
||||||
|
$request = $this->getRequest();
|
||||||
|
$viewer = $request->getUser();
|
||||||
|
|
||||||
|
$project = id(new PhabricatorProjectQuery())
|
||||||
|
->setViewer($viewer)
|
||||||
|
->withIDs(array($this->id))
|
||||||
|
->needImages(true)
|
||||||
|
->executeOne();
|
||||||
|
if (!$project) {
|
||||||
|
return new Aphront404Response();
|
||||||
|
}
|
||||||
|
|
||||||
|
$header = id(new PHUIHeaderView())
|
||||||
|
->setHeader(pht('Edit %s', $project->getName()))
|
||||||
|
->setUser($viewer)
|
||||||
|
->setPolicyObject($project)
|
||||||
|
->setImage($project->getProfileImageURI());
|
||||||
|
|
||||||
|
if ($project->getStatus() == PhabricatorProjectStatus::STATUS_ACTIVE) {
|
||||||
|
$header->setStatus('oh-ok', '', pht('Active'));
|
||||||
|
} else {
|
||||||
|
$header->setStatus('policy-noone', '', pht('Archived'));
|
||||||
|
}
|
||||||
|
|
||||||
|
$actions = $this->buildActionListView($project);
|
||||||
|
$properties = $this->buildPropertyListView($project, $actions);
|
||||||
|
|
||||||
|
$crumbs = $this->buildApplicationCrumbs();
|
||||||
|
$crumbs->addTextCrumb(
|
||||||
|
$project->getName(),
|
||||||
|
$this->getApplicationURI('view/'.$project->getID().'/'));
|
||||||
|
$crumbs->addTextCrumb(pht('Edit'));
|
||||||
|
|
||||||
|
$object_box = id(new PHUIObjectBoxView())
|
||||||
|
->setHeader($header)
|
||||||
|
->addPropertyList($properties);
|
||||||
|
|
||||||
|
$xactions = id(new PhabricatorProjectTransactionQuery())
|
||||||
|
->setViewer($viewer)
|
||||||
|
->withObjectPHIDs(array($project->getPHID()))
|
||||||
|
->execute();
|
||||||
|
|
||||||
|
$timeline = id(new PhabricatorApplicationTransactionView())
|
||||||
|
->setUser($viewer)
|
||||||
|
->setObjectPHID($project->getPHID())
|
||||||
|
->setTransactions($xactions);
|
||||||
|
|
||||||
|
return $this->buildApplicationPage(
|
||||||
|
array(
|
||||||
|
$crumbs,
|
||||||
|
$object_box,
|
||||||
|
$timeline,
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'title' => $project->getName(),
|
||||||
|
'device' => true,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
private function buildActionListView(PhabricatorProject $project) {
|
||||||
|
$request = $this->getRequest();
|
||||||
|
$viewer = $request->getUser();
|
||||||
|
|
||||||
|
$id = $project->getID();
|
||||||
|
|
||||||
|
$view = id(new PhabricatorActionListView())
|
||||||
|
->setUser($viewer)
|
||||||
|
->setObjectURI($request->getRequestURI());
|
||||||
|
|
||||||
|
$can_edit = PhabricatorPolicyFilter::hasCapability(
|
||||||
|
$viewer,
|
||||||
|
$project,
|
||||||
|
PhabricatorPolicyCapability::CAN_EDIT);
|
||||||
|
|
||||||
|
$view->addAction(
|
||||||
|
id(new PhabricatorActionView())
|
||||||
|
->setName(pht('Edit Details'))
|
||||||
|
->setIcon('edit')
|
||||||
|
->setHref($this->getApplicationURI("details/{$id}/"))
|
||||||
|
->setDisabled(!$can_edit)
|
||||||
|
->setWorkflow(!$can_edit));
|
||||||
|
|
||||||
|
$view->addAction(
|
||||||
|
id(new PhabricatorActionView())
|
||||||
|
->setName(pht('Edit Picture'))
|
||||||
|
->setIcon('image')
|
||||||
|
->setHref($this->getApplicationURI("picture/{$id}/"))
|
||||||
|
->setDisabled(!$can_edit)
|
||||||
|
->setWorkflow(!$can_edit));
|
||||||
|
|
||||||
|
if ($project->isArchived()) {
|
||||||
|
$view->addAction(
|
||||||
|
id(new PhabricatorActionView())
|
||||||
|
->setName(pht('Unarchive Project'))
|
||||||
|
->setIcon('enable')
|
||||||
|
->setHref($this->getApplicationURI("archive/{$id}/"))
|
||||||
|
->setDisabled(!$can_edit)
|
||||||
|
->setWorkflow(true));
|
||||||
|
} else {
|
||||||
|
$view->addAction(
|
||||||
|
id(new PhabricatorActionView())
|
||||||
|
->setName(pht('Archive Project'))
|
||||||
|
->setIcon('disable')
|
||||||
|
->setHref($this->getApplicationURI("archive/{$id}/"))
|
||||||
|
->setDisabled(!$can_edit)
|
||||||
|
->setWorkflow(true));
|
||||||
|
}
|
||||||
|
|
||||||
|
return $view;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function buildPropertyListView(
|
||||||
|
PhabricatorProject $project,
|
||||||
|
PhabricatorActionListView $actions) {
|
||||||
|
$request = $this->getRequest();
|
||||||
|
$viewer = $request->getUser();
|
||||||
|
|
||||||
|
$view = id(new PHUIPropertyListView())
|
||||||
|
->setUser($viewer)
|
||||||
|
->setObject($project)
|
||||||
|
->setActionList($actions);
|
||||||
|
|
||||||
|
$descriptions = PhabricatorPolicyQuery::renderPolicyDescriptions(
|
||||||
|
$viewer,
|
||||||
|
$project);
|
||||||
|
|
||||||
|
$view->addProperty(
|
||||||
|
pht('Visible To'),
|
||||||
|
$descriptions[PhabricatorPolicyCapability::CAN_VIEW]);
|
||||||
|
|
||||||
|
$view->addProperty(
|
||||||
|
pht('Editable By'),
|
||||||
|
$descriptions[PhabricatorPolicyCapability::CAN_EDIT]);
|
||||||
|
|
||||||
|
$view->addProperty(
|
||||||
|
pht('Joinable By'),
|
||||||
|
$descriptions[PhabricatorPolicyCapability::CAN_JOIN]);
|
||||||
|
|
||||||
|
return $view;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -1,6 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
final class PhabricatorProjectProfilePictureController
|
final class PhabricatorProjectEditPictureController
|
||||||
extends PhabricatorProjectController {
|
extends PhabricatorProjectController {
|
||||||
|
|
||||||
private $id;
|
private $id;
|
||||||
|
@ -26,7 +26,8 @@ final class PhabricatorProjectProfilePictureController
|
||||||
return new Aphront404Response();
|
return new Aphront404Response();
|
||||||
}
|
}
|
||||||
|
|
||||||
$project_uri = $this->getApplicationURI('view/'.$project->getID().'/');
|
$edit_uri = $this->getApplicationURI('edit/'.$project->getID().'/');
|
||||||
|
$view_uri = $this->getApplicationURI('view/'.$project->getID().'/');
|
||||||
|
|
||||||
$supported_formats = PhabricatorFile::getTransformableImageFormats();
|
$supported_formats = PhabricatorFile::getTransformableImageFormats();
|
||||||
$e_file = true;
|
$e_file = true;
|
||||||
|
@ -93,14 +94,15 @@ final class PhabricatorProjectProfilePictureController
|
||||||
|
|
||||||
$editor->applyTransactions($project, $xactions);
|
$editor->applyTransactions($project, $xactions);
|
||||||
|
|
||||||
return id(new AphrontRedirectResponse())->setURI($project_uri);
|
return id(new AphrontRedirectResponse())->setURI($edit_uri);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$title = pht('Edit Project Picture');
|
$title = pht('Edit Project Picture');
|
||||||
$crumbs = $this->buildApplicationCrumbs();
|
$crumbs = $this->buildApplicationCrumbs();
|
||||||
$crumbs->addTextCrumb($project->getName(), $project_uri);
|
$crumbs->addTextCrumb($project->getName(), $view_uri);
|
||||||
$crumbs->addTextCrumb($title);
|
$crumbs->addTextCrumb(pht('Edit'), $edit_uri);
|
||||||
|
$crumbs->addTextCrumb(pht('Picture'));
|
||||||
|
|
||||||
$form = id(new PHUIFormLayoutView())
|
$form = id(new PHUIFormLayoutView())
|
||||||
->setUser($viewer);
|
->setUser($viewer);
|
||||||
|
@ -244,7 +246,7 @@ final class PhabricatorProjectProfilePictureController
|
||||||
pht('Supported formats: %s', implode(', ', $supported_formats))))
|
pht('Supported formats: %s', implode(', ', $supported_formats))))
|
||||||
->appendChild(
|
->appendChild(
|
||||||
id(new AphrontFormSubmitControl())
|
id(new AphrontFormSubmitControl())
|
||||||
->addCancelButton($project_uri)
|
->addCancelButton($edit_uri)
|
||||||
->setValue(pht('Upload Picture')));
|
->setValue(pht('Upload Picture')));
|
||||||
|
|
||||||
$form_box = id(new PHUIObjectBoxView())
|
$form_box = id(new PHUIObjectBoxView())
|
|
@ -1,57 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
final class PhabricatorProjectHistoryController
|
|
||||||
extends PhabricatorProjectController {
|
|
||||||
|
|
||||||
private $id;
|
|
||||||
|
|
||||||
public function shouldAllowPublic() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function willProcessRequest(array $data) {
|
|
||||||
$this->id = $data['id'];
|
|
||||||
}
|
|
||||||
|
|
||||||
public function processRequest() {
|
|
||||||
$request = $this->getRequest();
|
|
||||||
$viewer = $request->getUser();
|
|
||||||
|
|
||||||
$id = $this->id;
|
|
||||||
|
|
||||||
$project = id(new PhabricatorProjectQuery())
|
|
||||||
->setViewer($viewer)
|
|
||||||
->withIDs(array($id))
|
|
||||||
->executeOne();
|
|
||||||
if (!$project) {
|
|
||||||
return new Aphront404Response();
|
|
||||||
}
|
|
||||||
|
|
||||||
$xactions = id(new PhabricatorProjectTransactionQuery())
|
|
||||||
->setViewer($viewer)
|
|
||||||
->withObjectPHIDs(array($project->getPHID()))
|
|
||||||
->execute();
|
|
||||||
|
|
||||||
$timeline = id(new PhabricatorApplicationTransactionView())
|
|
||||||
->setUser($viewer)
|
|
||||||
->setObjectPHID($project->getPHID())
|
|
||||||
->setTransactions($xactions);
|
|
||||||
|
|
||||||
$crumbs = $this->buildApplicationCrumbs()
|
|
||||||
->addTextCrumb(
|
|
||||||
$project->getName(),
|
|
||||||
$this->getApplicationURI("view/{$id}/"))
|
|
||||||
->addTextCrumb(pht('History'));
|
|
||||||
|
|
||||||
return $this->buildApplicationPage(
|
|
||||||
array(
|
|
||||||
$crumbs,
|
|
||||||
$timeline,
|
|
||||||
),
|
|
||||||
array(
|
|
||||||
'title' => $project->getName(),
|
|
||||||
'device' => true,
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -4,7 +4,6 @@ final class PhabricatorProjectProfileController
|
||||||
extends PhabricatorProjectController {
|
extends PhabricatorProjectController {
|
||||||
|
|
||||||
private $id;
|
private $id;
|
||||||
private $page;
|
|
||||||
|
|
||||||
public function shouldAllowPublic() {
|
public function shouldAllowPublic() {
|
||||||
return true;
|
return true;
|
||||||
|
@ -12,7 +11,6 @@ final class PhabricatorProjectProfileController
|
||||||
|
|
||||||
public function willProcessRequest(array $data) {
|
public function willProcessRequest(array $data) {
|
||||||
$this->id = idx($data, 'id');
|
$this->id = idx($data, 'id');
|
||||||
$this->page = idx($data, 'page');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function processRequest() {
|
public function processRequest() {
|
||||||
|
@ -200,45 +198,16 @@ final class PhabricatorProjectProfileController
|
||||||
id(new PhabricatorActionView())
|
id(new PhabricatorActionView())
|
||||||
->setName(pht('Edit Project'))
|
->setName(pht('Edit Project'))
|
||||||
->setIcon('edit')
|
->setIcon('edit')
|
||||||
->setHref($this->getApplicationURI("edit/{$id}/"))
|
->setHref($this->getApplicationURI("edit/{$id}/")));
|
||||||
->setDisabled(!$can_edit)
|
|
||||||
->setWorkflow(!$can_edit));
|
|
||||||
|
|
||||||
if ($project->isArchived()) {
|
|
||||||
$view->addAction(
|
|
||||||
id(new PhabricatorActionView())
|
|
||||||
->setName(pht('Unarchive Project'))
|
|
||||||
->setIcon('enable')
|
|
||||||
->setHref($this->getApplicationURI("archive/{$id}/"))
|
|
||||||
->setDisabled(!$can_edit)
|
|
||||||
->setWorkflow(true));
|
|
||||||
} else {
|
|
||||||
$view->addAction(
|
|
||||||
id(new PhabricatorActionView())
|
|
||||||
->setName(pht('Archive Project'))
|
|
||||||
->setIcon('disable')
|
|
||||||
->setHref($this->getApplicationURI("archive/{$id}/"))
|
|
||||||
->setDisabled(!$can_edit)
|
|
||||||
->setWorkflow(true));
|
|
||||||
}
|
|
||||||
|
|
||||||
$view->addAction(
|
$view->addAction(
|
||||||
id(new PhabricatorActionView())
|
id(new PhabricatorActionView())
|
||||||
->setName(pht('Edit Members'))
|
->setName(pht('Edit Members'))
|
||||||
->setIcon('edit')
|
->setIcon('user')
|
||||||
->setHref($this->getApplicationURI("members/{$id}/"))
|
->setHref($this->getApplicationURI("members/{$id}/"))
|
||||||
->setDisabled(!$can_edit)
|
->setDisabled(!$can_edit)
|
||||||
->setWorkflow(!$can_edit));
|
->setWorkflow(!$can_edit));
|
||||||
|
|
||||||
$view->addAction(
|
|
||||||
id(new PhabricatorActionView())
|
|
||||||
->setName(pht('Edit Picture'))
|
|
||||||
->setIcon('image')
|
|
||||||
->setHref($this->getApplicationURI("picture/{$id}/"))
|
|
||||||
->setDisabled(!$can_edit)
|
|
||||||
->setWorkflow(!$can_edit));
|
|
||||||
|
|
||||||
|
|
||||||
$action = null;
|
$action = null;
|
||||||
if (!$project->isUserMember($viewer->getPHID())) {
|
if (!$project->isUserMember($viewer->getPHID())) {
|
||||||
$can_join = PhabricatorPolicyFilter::hasCapability(
|
$can_join = PhabricatorPolicyFilter::hasCapability(
|
||||||
|
@ -262,12 +231,6 @@ final class PhabricatorProjectProfileController
|
||||||
}
|
}
|
||||||
$view->addAction($action);
|
$view->addAction($action);
|
||||||
|
|
||||||
$view->addAction(
|
|
||||||
id(new PhabricatorActionView())
|
|
||||||
->setName(pht('View History'))
|
|
||||||
->setHref($this->getApplicationURI("history/{$id}/"))
|
|
||||||
->setIcon('transcript'));
|
|
||||||
|
|
||||||
return $view;
|
return $view;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -284,10 +247,6 @@ final class PhabricatorProjectProfileController
|
||||||
->setObject($project)
|
->setObject($project)
|
||||||
->setActionList($actions);
|
->setActionList($actions);
|
||||||
|
|
||||||
$view->addProperty(
|
|
||||||
pht('Created'),
|
|
||||||
phabricator_datetime($project->getDateCreated(), $viewer));
|
|
||||||
|
|
||||||
$view->addProperty(
|
$view->addProperty(
|
||||||
pht('Members'),
|
pht('Members'),
|
||||||
$project->getMemberPHIDs()
|
$project->getMemberPHIDs()
|
||||||
|
|
Loading…
Reference in a new issue