@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Create a "New Document" button in phriction

Summary: gives user a dialogue and they can fill out what comes after /w/

Test Plan: made some new wiki docs. played with garbage data and edit scenarios as well as vanilla create -- good ish

Reviewers: epriestley, chad

Reviewed By: epriestley

CC: aran, Korvin

Maniphest Tasks: T1360

Differential Revision: https://secure.phabricator.com/D3946

+55 -6
+2
src/__phutil_library_map__.php
··· 1217 1217 'PhrictionEditController' => 'applications/phriction/controller/PhrictionEditController.php', 1218 1218 'PhrictionHistoryController' => 'applications/phriction/controller/PhrictionHistoryController.php', 1219 1219 'PhrictionListController' => 'applications/phriction/controller/PhrictionListController.php', 1220 + 'PhrictionNewController' => 'applications/phriction/controller/PhrictionNewController.php', 1220 1221 'PonderAddAnswerView' => 'applications/ponder/view/PonderAddAnswerView.php', 1221 1222 'PonderAddCommentView' => 'applications/ponder/view/PonderAddCommentView.php', 1222 1223 'PonderAnswer' => 'applications/ponder/storage/PonderAnswer.php', ··· 2395 2396 'PhrictionEditController' => 'PhrictionController', 2396 2397 'PhrictionHistoryController' => 'PhrictionController', 2397 2398 'PhrictionListController' => 'PhrictionController', 2399 + 'PhrictionNewController' => 'PhrictionController', 2398 2400 'PonderAddAnswerView' => 'AphrontView', 2399 2401 'PonderAddCommentView' => 'AphrontView', 2400 2402 'PonderAnswer' =>
+1
src/applications/phriction/application/PhabricatorApplicationPhriction.php
··· 38 38 39 39 'edit/(?:(?P<id>[1-9]\d*)/)?' => 'PhrictionEditController', 40 40 'delete/(?P<id>[1-9]\d*)/' => 'PhrictionDeleteController', 41 + 'new/' => 'PhrictionNewController', 41 42 42 43 'preview/' => 'PhrictionDocumentPreviewController', 43 44 'diff/(?P<id>[1-9]\d*)/' => 'PhrictionDiffController',
+14 -6
src/applications/phriction/controller/PhrictionDocumentController.php
··· 159 159 '<div class="phriction-content">'. 160 160 $byline. 161 161 $core_content. 162 - '</div>'; 162 + '</div>'; 163 163 164 + $create_button = javelin_render_tag( 165 + 'a', 166 + array( 167 + 'href' => '/phriction/new/', 168 + 'class' => 'button green', 169 + 'sigil' => 'workflow', 170 + ), 171 + pht('New Document')); 164 172 $edit_button = phutil_render_tag( 165 173 'a', 166 174 array( 167 - 'href' => '/phriction/edit/'.$document->getID().'/', 175 + 'href' => '/phriction/edit/'.$document->getID().'/', 168 176 'class' => 'button', 169 177 ), 170 - 'Edit Document'); 178 + pht('Edit Document')); 171 179 $history_button = phutil_render_tag( 172 180 'a', 173 181 array( 174 - 'href' => PhrictionDocument::getSlugURI($slug, 'history'), 182 + 'href' => PhrictionDocument::getSlugURI($slug, 'history'), 175 183 'class' => 'button grey', 176 184 ), 177 - 'View History'); 185 + pht('View History')); 178 186 // these float right so history_button which is right most goes first 179 - $buttons = $history_button.$edit_button; 187 + $buttons = $history_button.$edit_button.$create_button; 180 188 } 181 189 182 190 if ($version_note) {
+38
src/applications/phriction/controller/PhrictionNewController.php
··· 1 + <?php 2 + 3 + /** 4 + * @group phriction 5 + */ 6 + final class PhrictionNewController extends PhrictionController { 7 + 8 + public function processRequest() { 9 + 10 + $request = $this->getRequest(); 11 + $user = $request->getUser(); 12 + 13 + if ($request->isFormPost()) { 14 + $slug = PhabricatorSlug::normalize($request->getStr('slug')); 15 + $uri = '/phriction/edit/?slug='.$slug; 16 + return id(new AphrontRedirectResponse()) 17 + ->setURI($uri); 18 + } 19 + 20 + $view = id(new AphrontFormLayoutView()) 21 + ->appendChild(id(new AphrontFormTextControl()) 22 + ->setLabel('/w/') 23 + ->setName('slug')); 24 + 25 + $dialog = id(new AphrontDialogView()) 26 + ->setUser($user) 27 + ->setTitle(pht('New Document')) 28 + ->appendChild(phutil_render_tag('p', 29 + array(), 30 + pht('Create a new document at'))) 31 + ->appendChild($view) 32 + ->addSubmitButton(pht('Create')) 33 + ->addCancelButton($request->getRequestURI()); 34 + 35 + return id(new AphrontDialogResponse())->setDialog($dialog); 36 + } 37 + 38 + }