mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-19 12:00:55 +01:00
Add a very basic EditPro controller for Differential
Summary: Ref T11114. This doesn't really support anything yet, but technically works if you manually go to `/editpro/`. Test Plan: {F2117302} Reviewers: chad Reviewed By: chad Maniphest Tasks: T11114 Differential Revision: https://secure.phabricator.com/D17043
This commit is contained in:
parent
77fa1ea738
commit
eda64b8549
5 changed files with 90 additions and 0 deletions
|
@ -518,6 +518,8 @@ phutil_register_library_map(array(
|
|||
'DifferentialRevisionDependedOnByRevisionEdgeType' => 'applications/differential/edge/DifferentialRevisionDependedOnByRevisionEdgeType.php',
|
||||
'DifferentialRevisionDependsOnRevisionEdgeType' => 'applications/differential/edge/DifferentialRevisionDependsOnRevisionEdgeType.php',
|
||||
'DifferentialRevisionEditController' => 'applications/differential/controller/DifferentialRevisionEditController.php',
|
||||
'DifferentialRevisionEditEngine' => 'applications/differential/editor/DifferentialRevisionEditEngine.php',
|
||||
'DifferentialRevisionEditProController' => 'applications/differential/controller/DifferentialRevisionEditProController.php',
|
||||
'DifferentialRevisionFulltextEngine' => 'applications/differential/search/DifferentialRevisionFulltextEngine.php',
|
||||
'DifferentialRevisionGraph' => 'infrastructure/graph/DifferentialRevisionGraph.php',
|
||||
'DifferentialRevisionHasChildRelationship' => 'applications/differential/relationships/DifferentialRevisionHasChildRelationship.php',
|
||||
|
@ -5164,6 +5166,8 @@ phutil_register_library_map(array(
|
|||
'DifferentialRevisionDependedOnByRevisionEdgeType' => 'PhabricatorEdgeType',
|
||||
'DifferentialRevisionDependsOnRevisionEdgeType' => 'PhabricatorEdgeType',
|
||||
'DifferentialRevisionEditController' => 'DifferentialController',
|
||||
'DifferentialRevisionEditEngine' => 'PhabricatorEditEngine',
|
||||
'DifferentialRevisionEditProController' => 'DifferentialController',
|
||||
'DifferentialRevisionFulltextEngine' => 'PhabricatorFulltextEngine',
|
||||
'DifferentialRevisionGraph' => 'PhabricatorObjectGraph',
|
||||
'DifferentialRevisionHasChildRelationship' => 'DifferentialRevisionRelationship',
|
||||
|
|
|
@ -67,6 +67,8 @@ final class PhabricatorDifferentialApplication extends PhabricatorApplication {
|
|||
'revision/' => array(
|
||||
'edit/(?:(?P<id>[1-9]\d*)/)?'
|
||||
=> 'DifferentialRevisionEditController',
|
||||
$this->getEditRoutePattern('editpro/')
|
||||
=> 'DifferentialRevisionEditProController',
|
||||
'land/(?:(?P<id>[1-9]\d*))/(?P<strategy>[^/]+)/'
|
||||
=> 'DifferentialRevisionLandController',
|
||||
'closedetails/(?P<phid>[^/]+)/'
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
<?php
|
||||
|
||||
final class DifferentialRevisionEditProController
|
||||
extends DifferentialController {
|
||||
|
||||
public function handleRequest(AphrontRequest $request) {
|
||||
return id(new DifferentialRevisionEditEngine())
|
||||
->setController($this)
|
||||
->buildResponse();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,66 @@
|
|||
<?php
|
||||
|
||||
final class DifferentialRevisionEditEngine
|
||||
extends PhabricatorEditEngine {
|
||||
|
||||
const ENGINECONST = 'differential.revision';
|
||||
|
||||
public function getEngineName() {
|
||||
return pht('Revisions');
|
||||
}
|
||||
|
||||
public function getSummaryHeader() {
|
||||
return pht('Configure Revision Forms');
|
||||
}
|
||||
|
||||
public function getSummaryText() {
|
||||
return pht(
|
||||
'Configure creation and editing revision forms in Differential.');
|
||||
}
|
||||
|
||||
public function getEngineApplicationClass() {
|
||||
return 'PhabricatorDifferentialApplication';
|
||||
}
|
||||
|
||||
protected function supportsEditEngineConfiguration() {
|
||||
return false;
|
||||
}
|
||||
|
||||
protected function newEditableObject() {
|
||||
$viewer = $this->getViewer();
|
||||
return DifferentialRevision::initializeNewRevision($viewer);
|
||||
}
|
||||
|
||||
protected function newObjectQuery() {
|
||||
return new DifferentialRevisionQuery();
|
||||
}
|
||||
|
||||
protected function getObjectCreateTitleText($object) {
|
||||
return pht('Create New Revision');
|
||||
}
|
||||
|
||||
protected function getObjectEditTitleText($object) {
|
||||
return pht('Edit Revision: %s', $object->getTitle());
|
||||
}
|
||||
|
||||
protected function getObjectEditShortText($object) {
|
||||
return $object->getMonogram();
|
||||
}
|
||||
|
||||
protected function getObjectCreateShortText() {
|
||||
return pht('Create Revision');
|
||||
}
|
||||
|
||||
protected function getObjectName() {
|
||||
return pht('Revision');
|
||||
}
|
||||
|
||||
protected function getObjectViewURI($object) {
|
||||
return $object->getURI();
|
||||
}
|
||||
|
||||
protected function buildCustomEditFields($object) {
|
||||
return array();
|
||||
}
|
||||
|
||||
}
|
|
@ -27,6 +27,12 @@ final class PhabricatorCustomFieldEditEngineExtension
|
|||
PhabricatorEditEngine $engine,
|
||||
PhabricatorApplicationTransactionInterface $object) {
|
||||
|
||||
// TODO: Remove this hack once Differential modernizes more fully. Today,
|
||||
// its custom fields are too custom to interact cleanly with EditEngine.
|
||||
if ($object instanceof DifferentialRevision) {
|
||||
return array();
|
||||
}
|
||||
|
||||
$viewer = $this->getViewer();
|
||||
|
||||
$field_list = PhabricatorCustomField::getObjectFields(
|
||||
|
|
Loading…
Reference in a new issue