mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-24 06:20:56 +01:00
'Create Document' pre-fills with current slug
Summary: Fixes T2667 The 'Create Document' link up in the application crumbs now prefills with the slug of the current document - if available, that is Test Plan: verified that nothing crashed, that the correct slug was pre-filled, and that pages could be created Reviewers: alexshtuk, epriestley CC: aran, Korvin Maniphest Tasks: T2667 Differential Revision: https://secure.phabricator.com/D5273
This commit is contained in:
parent
90d0e8a322
commit
b42b1f6817
3 changed files with 17 additions and 3 deletions
|
@ -52,7 +52,7 @@ abstract class PhrictionController extends PhabricatorController {
|
|||
$crumbs->addAction(
|
||||
id(new PhabricatorMenuItemView())
|
||||
->setName(pht('Create Document'))
|
||||
->setHref('/phriction/new/')
|
||||
->setHref('/phriction/new/?slug='.$this->getDocumentSlug())
|
||||
->setWorkflow(true)
|
||||
->setIcon('create'));
|
||||
|
||||
|
@ -98,4 +98,8 @@ abstract class PhrictionController extends PhabricatorController {
|
|||
return $breadcrumbs;
|
||||
}
|
||||
|
||||
protected function getDocumentSlug() {
|
||||
return '';
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -403,4 +403,8 @@ final class PhrictionDocumentController
|
|||
return $item;
|
||||
}
|
||||
|
||||
protected function getDocumentSlug() {
|
||||
return $this->slug;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -9,22 +9,28 @@ final class PhrictionNewController extends PhrictionController {
|
|||
|
||||
$request = $this->getRequest();
|
||||
$user = $request->getUser();
|
||||
$slug = PhabricatorSlug::normalize($request->getStr('slug'));
|
||||
|
||||
if ($request->isFormPost()) {
|
||||
$slug = PhabricatorSlug::normalize($request->getStr('slug'));
|
||||
$uri = '/phriction/edit/?slug='.$slug;
|
||||
return id(new AphrontRedirectResponse())
|
||||
->setURI($uri);
|
||||
}
|
||||
|
||||
if ($slug == '/') {
|
||||
$slug = '';
|
||||
}
|
||||
|
||||
$view = id(new AphrontFormLayoutView())
|
||||
->appendChild(id(new AphrontFormTextControl())
|
||||
->setLabel('/w/')
|
||||
->setValue($slug)
|
||||
->setName('slug'));
|
||||
|
||||
$dialog = id(new AphrontDialogView())
|
||||
->setUser($user)
|
||||
->setTitle(pht('New Document'))
|
||||
->setSubmitURI('/phriction/new/')
|
||||
->appendChild(phutil_tag('p',
|
||||
array(),
|
||||
pht('Create a new document at')))
|
||||
|
|
Loading…
Reference in a new issue