Fix create links when no repositories exist
Summary: Fixes T10925. Sends users to /new/ instead of /create/ Test Plan: Visit page, see links, clicky clicky. Reviewers: epriestley, thoughtpolice Reviewed By: thoughtpolice Subscribers: thoughtpolice, Korvin Maniphest Tasks: T10925 Differential Revision: https://secure.phabricator.com/D15849
This commit is contained in:
@@ -1,79 +0,0 @@
|
||||
<?php
|
||||
|
||||
final class DiffusionRepositoryNewController extends DiffusionController {
|
||||
|
||||
public function handleRequest(AphrontRequest $request) {
|
||||
$viewer = $this->getViewer();
|
||||
|
||||
$this->requireApplicationCapability(
|
||||
DiffusionCreateRepositoriesCapability::CAPABILITY);
|
||||
|
||||
if ($request->isFormPost()) {
|
||||
if ($request->getStr('type')) {
|
||||
switch ($request->getStr('type')) {
|
||||
case 'create':
|
||||
$uri = $this->getApplicationURI('create/');
|
||||
break;
|
||||
case 'import':
|
||||
default:
|
||||
$uri = $this->getApplicationURI('import/');
|
||||
break;
|
||||
}
|
||||
|
||||
return id(new AphrontRedirectResponse())->setURI($uri);
|
||||
}
|
||||
}
|
||||
|
||||
$doc_href = PhabricatorEnv::getDoclink(
|
||||
'Diffusion User Guide: Repository Hosting');
|
||||
|
||||
$doc_link = phutil_tag(
|
||||
'a',
|
||||
array(
|
||||
'href' => $doc_href,
|
||||
'target' => '_blank',
|
||||
),
|
||||
pht('Diffusion User Guide: Repository Hosting'));
|
||||
|
||||
$form = id(new AphrontFormView())
|
||||
->setUser($viewer)
|
||||
->appendChild(
|
||||
id(new AphrontFormRadioButtonControl())
|
||||
->setName('type')
|
||||
->addButton(
|
||||
'create',
|
||||
pht('Create a New Hosted Repository'),
|
||||
array(
|
||||
pht(
|
||||
'Create a new, empty repository which Phabricator will host. '.
|
||||
'For instructions on configuring repository hosting, see %s.',
|
||||
$doc_link),
|
||||
))
|
||||
->addButton(
|
||||
'import',
|
||||
pht('Import an Existing External Repository'),
|
||||
pht(
|
||||
"Import a repository hosted somewhere else, like GitHub, ".
|
||||
"Bitbucket, or your organization's existing servers. ".
|
||||
"Phabricator will read changes from the repository but will ".
|
||||
"not host or manage it. The authoritative master version of ".
|
||||
"the repository will stay where it is now.")))
|
||||
->appendChild(
|
||||
id(new AphrontFormSubmitControl())
|
||||
->setValue(pht('Continue'))
|
||||
->addCancelButton($this->getApplicationURI()));
|
||||
|
||||
$crumbs = $this->buildApplicationCrumbs();
|
||||
$crumbs->addTextCrumb(pht('New Repository'));
|
||||
|
||||
$form_box = id(new PHUIObjectBoxView())
|
||||
->setHeaderText(pht('Create or Import Repository'))
|
||||
->setForm($form);
|
||||
|
||||
return $this->newPage()
|
||||
->setTitle(pht('New Repository'))
|
||||
->setCrumbs($crumbs)
|
||||
->appendChild($form_box);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user