1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2025-01-10 23:01:04 +01:00

On workboards, provide all of the supported "create task" forms in the dropdown

Summary:
Ref T12314. Ref T6064. Ref T11580. If an install defines several different task create forms (like "Create Plant" and "Create Animal"), allow any of them to be created directly onto a workboard column.

This is just a general consistency improvement that makes Custom Forms and Workboards work together a bit better. We might do something fancier eventually for T6064 (which wants fewer clicks) and/or T11580 (which wants per-workboard control over forms or defaults).

Test Plan:
  - Created several different types of tasks directly onto a workboard.
  - Faked just one create form, saw the UI unchanged (except that it respects any renaming).

{F3492928}

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T12314, T11580, T6064

Differential Revision: https://secure.phabricator.com/D17446
This commit is contained in:
epriestley 2017-03-01 17:13:36 -08:00
parent 7eab75410a
commit 6f7bb8c91a
5 changed files with 49 additions and 59 deletions

View file

@ -441,8 +441,8 @@ return array(
'rsrc/js/application/projects/WorkboardBoard.js' => '8935deef', 'rsrc/js/application/projects/WorkboardBoard.js' => '8935deef',
'rsrc/js/application/projects/WorkboardCard.js' => 'c587b80f', 'rsrc/js/application/projects/WorkboardCard.js' => 'c587b80f',
'rsrc/js/application/projects/WorkboardColumn.js' => '21df4ff5', 'rsrc/js/application/projects/WorkboardColumn.js' => '21df4ff5',
'rsrc/js/application/projects/WorkboardController.js' => '55baf5ed', 'rsrc/js/application/projects/WorkboardController.js' => '26167537',
'rsrc/js/application/projects/behavior-project-boards.js' => '93ae974f', 'rsrc/js/application/projects/behavior-project-boards.js' => '4250a34e',
'rsrc/js/application/projects/behavior-project-create.js' => '065227cc', 'rsrc/js/application/projects/behavior-project-create.js' => '065227cc',
'rsrc/js/application/projects/behavior-reorder-columns.js' => 'e1d25dfb', 'rsrc/js/application/projects/behavior-reorder-columns.js' => 'e1d25dfb',
'rsrc/js/application/releeph/releeph-preview-branch.js' => 'b2b4fbaf', 'rsrc/js/application/releeph/releeph-preview-branch.js' => 'b2b4fbaf',
@ -693,7 +693,7 @@ return array(
'javelin-behavior-phui-tab-group' => '0a0b10e9', 'javelin-behavior-phui-tab-group' => '0a0b10e9',
'javelin-behavior-policy-control' => 'd0c516d5', 'javelin-behavior-policy-control' => 'd0c516d5',
'javelin-behavior-policy-rule-editor' => '5e9f347c', 'javelin-behavior-policy-rule-editor' => '5e9f347c',
'javelin-behavior-project-boards' => '93ae974f', 'javelin-behavior-project-boards' => '4250a34e',
'javelin-behavior-project-create' => '065227cc', 'javelin-behavior-project-create' => '065227cc',
'javelin-behavior-quicksand-blacklist' => '7927a7d3', 'javelin-behavior-quicksand-blacklist' => '7927a7d3',
'javelin-behavior-read-only-warning' => 'ba158207', 'javelin-behavior-read-only-warning' => 'ba158207',
@ -767,7 +767,7 @@ return array(
'javelin-workboard-board' => '8935deef', 'javelin-workboard-board' => '8935deef',
'javelin-workboard-card' => 'c587b80f', 'javelin-workboard-card' => 'c587b80f',
'javelin-workboard-column' => '21df4ff5', 'javelin-workboard-column' => '21df4ff5',
'javelin-workboard-controller' => '55baf5ed', 'javelin-workboard-controller' => '26167537',
'javelin-workflow' => '1e911d0f', 'javelin-workflow' => '1e911d0f',
'maniphest-batch-editor' => 'b0f0b6d5', 'maniphest-batch-editor' => 'b0f0b6d5',
'maniphest-report-css' => '9b9580b7', 'maniphest-report-css' => '9b9580b7',
@ -1089,6 +1089,16 @@ return array(
'javelin-workflow', 'javelin-workflow',
'javelin-util', 'javelin-util',
), ),
26167537 => array(
'javelin-install',
'javelin-dom',
'javelin-util',
'javelin-vector',
'javelin-stratcom',
'javelin-workflow',
'phabricator-drag-and-drop-file-upload',
'javelin-workboard-board',
),
'2926fff2' => array( '2926fff2' => array(
'javelin-behavior', 'javelin-behavior',
'javelin-dom', 'javelin-dom',
@ -1174,6 +1184,15 @@ return array(
'javelin-dom', 'javelin-dom',
'javelin-request', 'javelin-request',
), ),
'4250a34e' => array(
'javelin-behavior',
'javelin-dom',
'javelin-util',
'javelin-vector',
'javelin-stratcom',
'javelin-workflow',
'javelin-workboard-controller',
),
'44959b73' => array( '44959b73' => array(
'javelin-util', 'javelin-util',
'javelin-uri', 'javelin-uri',
@ -1307,16 +1326,6 @@ return array(
'javelin-vector', 'javelin-vector',
'javelin-dom', 'javelin-dom',
), ),
'55baf5ed' => array(
'javelin-install',
'javelin-dom',
'javelin-util',
'javelin-vector',
'javelin-stratcom',
'javelin-workflow',
'phabricator-drag-and-drop-file-upload',
'javelin-workboard-board',
),
'58dea2fa' => array( '58dea2fa' => array(
'javelin-install', 'javelin-install',
'javelin-util', 'javelin-util',
@ -1629,15 +1638,6 @@ return array(
'javelin-stratcom', 'javelin-stratcom',
'javelin-dom', 'javelin-dom',
), ),
'93ae974f' => array(
'javelin-behavior',
'javelin-dom',
'javelin-util',
'javelin-vector',
'javelin-stratcom',
'javelin-workflow',
'javelin-workboard-controller',
),
'93d0c9e3' => array( '93d0c9e3' => array(
'javelin-behavior', 'javelin-behavior',
'javelin-stratcom', 'javelin-stratcom',

View file

@ -372,7 +372,6 @@ final class PhabricatorProjectBoardViewController
$behavior_config = array( $behavior_config = array(
'moveURI' => $this->getApplicationURI('move/'.$project->getID().'/'), 'moveURI' => $this->getApplicationURI('move/'.$project->getID().'/'),
'createURI' => $this->getCreateURI(),
'uploadURI' => '/file/dropupload/', 'uploadURI' => '/file/dropupload/',
'coverURI' => $this->getApplicationURI('cover/'), 'coverURI' => $this->getApplicationURI('cover/'),
'chunkThreshold' => PhabricatorFileStorageEngine::getChunkThreshold(), 'chunkThreshold' => PhabricatorFileStorageEngine::getChunkThreshold(),
@ -800,17 +799,30 @@ final class PhabricatorProjectBoardViewController
$default_phid = $column->getProjectPHID(); $default_phid = $column->getProjectPHID();
} }
$column_items[] = id(new PhabricatorActionView()) $specs = id(new ManiphestEditEngine())
->setIcon('fa-plus') ->setViewer($viewer)
->setName(pht('Create Task...')) ->newCreateActionSpecifications(array());
->setHref($this->getCreateURI())
->addSigil('column-add-task') foreach ($specs as $spec) {
->setMetadata( $column_items[] = id(new PhabricatorActionView())
array( ->setIcon($spec['icon'])
'columnPHID' => $column->getPHID(), ->setName($spec['name'])
'boardPHID' => $project->getPHID(), ->setHref($spec['uri'])
'projectPHID' => $default_phid, ->setDisabled($spec['disabled'])
)); ->addSigil('column-add-task')
->setMetadata(
array(
'createURI' => $spec['uri'],
'columnPHID' => $column->getPHID(),
'boardPHID' => $project->getPHID(),
'projectPHID' => $default_phid,
));
}
if (count($specs) > 1) {
$column_items[] = id(new PhabricatorActionView())
->setType(PhabricatorActionView::TYPE_DIVIDER);
}
$batch_edit_uri = $request->getRequestURI(); $batch_edit_uri = $request->getRequestURI();
$batch_edit_uri->setQueryParam('batch', $column->getID()); $batch_edit_uri->setQueryParam('batch', $column->getID());
@ -903,25 +915,6 @@ final class PhabricatorProjectBoardViewController
return $base; return $base;
} }
private function getCreateURI() {
$viewer = $this->getViewer();
// TODO: This should be cleaned up, but maybe we're going to make options
// for each column or board?
$edit_config = id(new ManiphestEditEngine())
->setViewer($viewer)
->loadDefaultEditConfiguration(new ManiphestTask());
if ($edit_config) {
$form_key = $edit_config->getIdentifier();
$create_uri = "/maniphest/task/edit/form/{$form_key}/";
} else {
$create_uri = '/maniphest/task/edit/';
}
return $create_uri;
}
private function buildInitializeContent(PhabricatorProject $project) { private function buildInitializeContent(PhabricatorProject $project) {
$request = $this->getRequest(); $request = $this->getRequest();
$viewer = $this->getViewer(); $viewer = $this->getViewer();

View file

@ -1483,7 +1483,7 @@ abstract class PhabricatorEditEngine
* Build a raw description of available "Create New Object" UI options so * Build a raw description of available "Create New Object" UI options so
* other methods can build menus or buttons. * other methods can build menus or buttons.
*/ */
private function newCreateActionSpecifications(array $parameters) { public function newCreateActionSpecifications(array $parameters) {
$viewer = $this->getViewer(); $viewer = $this->getViewer();
$can_create = $this->hasCreateCapability(); $can_create = $this->hasCreateCapability();

View file

@ -21,7 +21,6 @@ JX.install('WorkboardController', {
uploadURI: null, uploadURI: null,
coverURI: null, coverURI: null,
moveURI: null, moveURI: null,
createURI: null,
chunkThreshold: null chunkThreshold: null
}, },
@ -170,7 +169,7 @@ JX.install('WorkboardController', {
order: board.getOrder() order: board.getOrder()
}; };
new JX.Workflow(this.getCreateURI(), request_data) new JX.Workflow(column_data.createURI, request_data)
.setHandler(JX.bind(board, board.updateCard)) .setHandler(JX.bind(board, board.updateCard))
.start(); .start();
}, },

View file

@ -16,7 +16,6 @@ JX.behavior('project-boards', function(config, statics) {
statics.projectPHID = update_config.projectPHID; statics.projectPHID = update_config.projectPHID;
statics.order = update_config.order; statics.order = update_config.order;
statics.moveURI = update_config.moveURI; statics.moveURI = update_config.moveURI;
statics.createURI = update_config.createURI;
} }
function setup() { function setup() {
@ -71,7 +70,6 @@ JX.behavior('project-boards', function(config, statics) {
.setUploadURI(config.uploadURI) .setUploadURI(config.uploadURI)
.setCoverURI(config.coverURI) .setCoverURI(config.coverURI)
.setMoveURI(config.moveURI) .setMoveURI(config.moveURI)
.setCreateURI(config.createURI)
.setChunkThreshold(config.chunkThreshold) .setChunkThreshold(config.chunkThreshold)
.start(); .start();
} }