diff --git a/src/applications/phriction/controller/PhrictionController.php b/src/applications/phriction/controller/PhrictionController.php index c242c4f64f..26dccaea9c 100644 --- a/src/applications/phriction/controller/PhrictionController.php +++ b/src/applications/phriction/controller/PhrictionController.php @@ -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 ''; + } + } diff --git a/src/applications/phriction/controller/PhrictionDocumentController.php b/src/applications/phriction/controller/PhrictionDocumentController.php index c28e736d4f..1dae32eddd 100644 --- a/src/applications/phriction/controller/PhrictionDocumentController.php +++ b/src/applications/phriction/controller/PhrictionDocumentController.php @@ -403,4 +403,8 @@ final class PhrictionDocumentController return $item; } + protected function getDocumentSlug() { + return $this->slug; + } + } diff --git a/src/applications/phriction/controller/PhrictionNewController.php b/src/applications/phriction/controller/PhrictionNewController.php index 02519dbae7..934b41375b 100644 --- a/src/applications/phriction/controller/PhrictionNewController.php +++ b/src/applications/phriction/controller/PhrictionNewController.php @@ -9,25 +9,31 @@ 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'))) + pht('Create a new document at'))) ->appendChild($view) ->addSubmitButton(pht('Create')) ->addCancelButton('/w/');