1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2025-01-10 14:51:06 +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/WorkboardCard.js' => 'c587b80f',
'rsrc/js/application/projects/WorkboardColumn.js' => '21df4ff5',
'rsrc/js/application/projects/WorkboardController.js' => '55baf5ed',
'rsrc/js/application/projects/behavior-project-boards.js' => '93ae974f',
'rsrc/js/application/projects/WorkboardController.js' => '26167537',
'rsrc/js/application/projects/behavior-project-boards.js' => '4250a34e',
'rsrc/js/application/projects/behavior-project-create.js' => '065227cc',
'rsrc/js/application/projects/behavior-reorder-columns.js' => 'e1d25dfb',
'rsrc/js/application/releeph/releeph-preview-branch.js' => 'b2b4fbaf',
@ -693,7 +693,7 @@ return array(
'javelin-behavior-phui-tab-group' => '0a0b10e9',
'javelin-behavior-policy-control' => 'd0c516d5',
'javelin-behavior-policy-rule-editor' => '5e9f347c',
'javelin-behavior-project-boards' => '93ae974f',
'javelin-behavior-project-boards' => '4250a34e',
'javelin-behavior-project-create' => '065227cc',
'javelin-behavior-quicksand-blacklist' => '7927a7d3',
'javelin-behavior-read-only-warning' => 'ba158207',
@ -767,7 +767,7 @@ return array(
'javelin-workboard-board' => '8935deef',
'javelin-workboard-card' => 'c587b80f',
'javelin-workboard-column' => '21df4ff5',
'javelin-workboard-controller' => '55baf5ed',
'javelin-workboard-controller' => '26167537',
'javelin-workflow' => '1e911d0f',
'maniphest-batch-editor' => 'b0f0b6d5',
'maniphest-report-css' => '9b9580b7',
@ -1089,6 +1089,16 @@ return array(
'javelin-workflow',
'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(
'javelin-behavior',
'javelin-dom',
@ -1174,6 +1184,15 @@ return array(
'javelin-dom',
'javelin-request',
),
'4250a34e' => array(
'javelin-behavior',
'javelin-dom',
'javelin-util',
'javelin-vector',
'javelin-stratcom',
'javelin-workflow',
'javelin-workboard-controller',
),
'44959b73' => array(
'javelin-util',
'javelin-uri',
@ -1307,16 +1326,6 @@ return array(
'javelin-vector',
'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(
'javelin-install',
'javelin-util',
@ -1629,15 +1638,6 @@ return array(
'javelin-stratcom',
'javelin-dom',
),
'93ae974f' => array(
'javelin-behavior',
'javelin-dom',
'javelin-util',
'javelin-vector',
'javelin-stratcom',
'javelin-workflow',
'javelin-workboard-controller',
),
'93d0c9e3' => array(
'javelin-behavior',
'javelin-stratcom',

View file

@ -372,7 +372,6 @@ final class PhabricatorProjectBoardViewController
$behavior_config = array(
'moveURI' => $this->getApplicationURI('move/'.$project->getID().'/'),
'createURI' => $this->getCreateURI(),
'uploadURI' => '/file/dropupload/',
'coverURI' => $this->getApplicationURI('cover/'),
'chunkThreshold' => PhabricatorFileStorageEngine::getChunkThreshold(),
@ -800,17 +799,30 @@ final class PhabricatorProjectBoardViewController
$default_phid = $column->getProjectPHID();
}
$column_items[] = id(new PhabricatorActionView())
->setIcon('fa-plus')
->setName(pht('Create Task...'))
->setHref($this->getCreateURI())
->addSigil('column-add-task')
->setMetadata(
array(
'columnPHID' => $column->getPHID(),
'boardPHID' => $project->getPHID(),
'projectPHID' => $default_phid,
));
$specs = id(new ManiphestEditEngine())
->setViewer($viewer)
->newCreateActionSpecifications(array());
foreach ($specs as $spec) {
$column_items[] = id(new PhabricatorActionView())
->setIcon($spec['icon'])
->setName($spec['name'])
->setHref($spec['uri'])
->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->setQueryParam('batch', $column->getID());
@ -903,25 +915,6 @@ final class PhabricatorProjectBoardViewController
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) {
$request = $this->getRequest();
$viewer = $this->getViewer();

View file

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

View file

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

View file

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