Differential D15092 Diff 36447 src/applications/project/controller/PhabricatorProjectBoardViewController.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/project/controller/PhabricatorProjectBoardViewController.php
Show First 20 Lines • Show All 755 Lines • ▼ Show 20 Lines | private function buildInitializeContent(PhabricatorProject $project) { | ||||
$type = $request->getStr('initialize-type'); | $type = $request->getStr('initialize-type'); | ||||
$id = $project->getID(); | $id = $project->getID(); | ||||
$profile_uri = $this->getApplicationURI("profile/{$id}/"); | $profile_uri = $this->getApplicationURI("profile/{$id}/"); | ||||
$board_uri = $this->getApplicationURI("board/{$id}/"); | $board_uri = $this->getApplicationURI("board/{$id}/"); | ||||
$import_uri = $this->getApplicationURI("board/{$id}/import/"); | $import_uri = $this->getApplicationURI("board/{$id}/import/"); | ||||
switch ($type) { | $set_default = $request->getBool('default'); | ||||
case 'backlog-only': | if ($set_default) { | ||||
$this | |||||
->getProfilePanelEngine() | |||||
->adjustDefault(PhabricatorProject::PANEL_WORKBOARD); | |||||
} | |||||
if ($request->isFormPost()) { | |||||
if ($type == 'backlog-only') { | |||||
$column = PhabricatorProjectColumn::initializeNewColumn($viewer) | $column = PhabricatorProjectColumn::initializeNewColumn($viewer) | ||||
->setSequence(0) | ->setSequence(0) | ||||
->setProperty('isDefault', true) | ->setProperty('isDefault', true) | ||||
->setProjectPHID($project->getPHID()) | ->setProjectPHID($project->getPHID()) | ||||
->save(); | ->save(); | ||||
$project->setHasWorkboard(1)->save(); | $project->setHasWorkboard(1)->save(); | ||||
return id(new AphrontRedirectResponse()) | return id(new AphrontRedirectResponse()) | ||||
->setURI($board_uri); | ->setURI($board_uri); | ||||
case 'import': | } else { | ||||
return id(new AphrontRedirectResponse()) | return id(new AphrontRedirectResponse()) | ||||
->setURI($import_uri); | ->setURI($import_uri); | ||||
} | } | ||||
} | |||||
$new_selector = id(new AphrontFormRadioButtonControl()) | $new_selector = id(new AphrontFormRadioButtonControl()) | ||||
->setLabel(pht('Columns')) | |||||
->setName('initialize-type') | ->setName('initialize-type') | ||||
->setValue('backlog-only') | ->setValue('backlog-only') | ||||
->addButton( | ->addButton( | ||||
'backlog-only', | 'backlog-only', | ||||
pht('New Empty Board'), | pht('New Empty Board'), | ||||
pht('Create a new board with just a backlog column.')) | pht('Create a new board with just a backlog column.')) | ||||
->addButton( | ->addButton( | ||||
'import', | 'import', | ||||
pht('Import Columns'), | pht('Import Columns'), | ||||
pht('Import board columns from another project.')); | pht('Import board columns from another project.')); | ||||
$default_checkbox = id(new AphrontFormCheckboxControl()) | |||||
->setLabel(pht('Make Default')) | |||||
->addCheckbox( | |||||
'default', | |||||
1, | |||||
pht('Make the workboard the default view for this project.'), | |||||
true); | |||||
$form = id(new AphrontFormView()) | $form = id(new AphrontFormView()) | ||||
->setUser($viewer) | ->setUser($viewer) | ||||
->appendRemarkupInstructions( | ->appendRemarkupInstructions( | ||||
pht('The workboard for this project has not been created yet.')) | pht('The workboard for this project has not been created yet.')) | ||||
->appendControl($new_selector) | ->appendControl($new_selector) | ||||
->appendControl($default_checkbox) | |||||
->appendControl( | ->appendControl( | ||||
id(new AphrontFormSubmitControl()) | id(new AphrontFormSubmitControl()) | ||||
->addCancelButton($profile_uri) | ->addCancelButton($profile_uri) | ||||
->setValue(pht('Create Workboard'))); | ->setValue(pht('Create Workboard'))); | ||||
$box = id(new PHUIObjectBoxView()) | $box = id(new PHUIObjectBoxView()) | ||||
->setHeaderText(pht('Create Workboard')) | ->setHeaderText(pht('Create Workboard')) | ||||
->setForm($form); | ->setForm($form); | ||||
Show All 22 Lines |