Skip to content

Commit 91c08ca

Browse files
author
epriestley
committed
Add breadcrumbs and ApplicationSearch to Phriction
Summary: Fixes T3631. Also adds ApplicationSearch. Test Plan: Viewed "New", "Edit"; saw breadcrumbs. Viewed "index", saw application search. Reviewers: btrahan, chad Reviewed By: chad CC: aran Maniphest Tasks: T3631 Differential Revision: https://secure.phabricator.com/D6593
1 parent 091beee commit 91c08ca

File tree

6 files changed

+204
-231
lines changed

6 files changed

+204
-231
lines changed

src/__phutil_library_map__.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1863,6 +1863,7 @@
18631863
'PhrictionNewController' => 'applications/phriction/controller/PhrictionNewController.php',
18641864
'PhrictionPHIDTypeDocument' => 'applications/phriction/phid/PhrictionPHIDTypeDocument.php',
18651865
'PhrictionRemarkupRule' => 'applications/phriction/remarkup/PhrictionRemarkupRule.php',
1866+
'PhrictionSearchEngine' => 'applications/phriction/query/PhrictionSearchEngine.php',
18661867
'PhrictionSearchIndexer' => 'applications/phriction/search/PhrictionSearchIndexer.php',
18671868
'PonderAddAnswerView' => 'applications/ponder/view/PonderAddAnswerView.php',
18681869
'PonderAddCommentView' => 'applications/ponder/view/PonderAddCommentView.php',
@@ -3957,11 +3958,16 @@
39573958
'PhrictionDocumentTestCase' => 'PhabricatorTestCase',
39583959
'PhrictionEditController' => 'PhrictionController',
39593960
'PhrictionHistoryController' => 'PhrictionController',
3960-
'PhrictionListController' => 'PhrictionController',
3961+
'PhrictionListController' =>
3962+
array(
3963+
0 => 'PhrictionController',
3964+
1 => 'PhabricatorApplicationSearchResultsControllerInterface',
3965+
),
39613966
'PhrictionMoveController' => 'PhrictionController',
39623967
'PhrictionNewController' => 'PhrictionController',
39633968
'PhrictionPHIDTypeDocument' => 'PhabricatorPHIDType',
39643969
'PhrictionRemarkupRule' => 'PhutilRemarkupRule',
3970+
'PhrictionSearchEngine' => 'PhabricatorApplicationSearchEngine',
39653971
'PhrictionSearchIndexer' => 'PhabricatorSearchDocumentIndexer',
39663972
'PonderAddAnswerView' => 'AphrontView',
39673973
'PonderAddCommentView' => 'AphrontView',

src/applications/phriction/application/PhabricatorApplicationPhriction.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,7 @@ public function getRoutes() {
4242
'/w/(?P<slug>.+/)' => 'PhrictionDocumentController',
4343

4444
'/phriction/' => array(
45-
'' => 'PhrictionListController',
46-
'list/(?P<view>[^/]+)/' => 'PhrictionListController',
45+
'(?:query/(?P<queryKey>[^/]+)/)?' => 'PhrictionListController',
4746

4847
'history(?P<slug>/)' => 'PhrictionHistoryController',
4948
'history/(?P<slug>.+/)' => 'PhrictionHistoryController',

src/applications/phriction/controller/PhrictionController.php

Lines changed: 9 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -5,45 +5,28 @@
55
*/
66
abstract class PhrictionController extends PhabricatorController {
77

8-
public function buildStandardPageResponse($view, array $data) {
9-
10-
$page = $this->buildStandardPageView();
11-
12-
$page->setApplicationName(pht('Phriction'));
13-
$page->setBaseURI('/w/');
14-
$page->setTitle(idx($data, 'title'));
15-
$page->setGlyph("\xE2\x9A\xA1");
16-
17-
$page->appendChild($view);
18-
$page->setSearchDefaultScope(PhabricatorSearchScope::SCOPE_WIKI);
19-
20-
$response = new AphrontWebpageResponse();
21-
return $response->setContent($page->render());
22-
}
23-
24-
public function buildSideNavView($filter = null, $for_app = false) {
8+
public function buildSideNavView($for_app = false) {
259
$user = $this->getRequest()->getUser();
2610

2711
$nav = new AphrontSideNavFilterView();
28-
$nav->setBaseURI(new PhutilURI('/phriction/list/'));
12+
$nav->setBaseURI(new PhutilURI($this->getApplicationURI()));
2913

3014
if ($for_app) {
31-
$nav->addFilter('', pht('Root Document'), '/w/');
32-
$nav->addFilter('', pht('New Document'), '/phriction/new');
15+
$nav->addFilter('create', pht('New Document'));
16+
$nav->addFilter('/phriction/', pht('Index'));
3317
}
3418

35-
$nav->addLabel(pht('Filters'));
36-
$nav->addFilter('active', pht('Active Documents'));
37-
$nav->addFilter('all', pht('All Documents'));
38-
$nav->addFilter('updates', pht('Recently Updated'));
19+
id(new PhrictionSearchEngine())
20+
->setViewer($user)
21+
->addNavigationItems($nav->getMenu());
3922

40-
$nav->selectFilter($filter, 'active');
23+
$nav->selectFilter(null);
4124

4225
return $nav;
4326
}
4427

4528
public function buildApplicationMenu() {
46-
return $this->buildSideNavView(null, true)->getMenu();
29+
return $this->buildSideNavView(true)->getMenu();
4730
}
4831

4932
public function buildApplicationCrumbs() {

src/applications/phriction/controller/PhrictionEditController.php

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,11 +248,26 @@ public function processRequest() {
248248
'uri' => '/phriction/preview/?draftkey='.$draft_key,
249249
));
250250

251+
$crumbs = $this->buildApplicationCrumbs();
252+
if ($document->getID()) {
253+
$crumbs->addCrumb(
254+
id(new PhabricatorCrumbView())
255+
->setName($content->getTitle())
256+
->setHref(PhrictionDocument::getSlugURI($document->getSlug())));
257+
$crumbs->addCrumb(
258+
id(new PhabricatorCrumbView())
259+
->setName(pht('Edit')));
260+
} else {
261+
$crumbs->addCrumb(
262+
id(new PhabricatorCrumbView())
263+
->setName(pht('Create')));
264+
}
265+
251266
return $this->buildApplicationPage(
252267
array(
268+
$crumbs,
253269
$draft_note,
254270
$error_view,
255-
$header,
256271
$form,
257272
$preview_panel,
258273
),

0 commit comments

Comments
 (0)