mirror of
https://we.phorge.it/source/phorge.git
synced 2025-01-30 16:38:21 +01:00
ecfb720713
Summary: Fixes T2778 Introduces `PhabricatorMacroQuery`, which should consolidate all queries regarding macros Adds `PolicyInterface` to `PhabricatorImageMacro`, as else the query would fail (we should consider adding it to the ApplicationTransaction instead, if that was ever planned) Adds `Active Macros` filter, making it the default Adds `My Macros` filter. You may ask why it overwrites `$authors`. Well, I did not want the page jump to the conclusion that it is a search result. It //is// one more or less, but the filter would jump to `seach` instead of `my`. If you want `My Macros` removed, tell me. It is useful only to heavy-macro-uploaders-and-users though. Five or six people in `http://secure.phabricator.(org|com)`, and an estimated dozen and a half at bigger installs. Test Plan: created multiple macros from multiple authors, disabled them at will. browsed around, verified that Macros only appeared in the right filters and that nothing else broke. Reviewers: epriestley, chad, btrahan CC: aran, Korvin Maniphest Tasks: T2778 Differential Revision: https://secure.phabricator.com/D5409
47 lines
1.2 KiB
PHP
47 lines
1.2 KiB
PHP
<?php
|
|
|
|
abstract class PhabricatorMacroController
|
|
extends PhabricatorController {
|
|
|
|
protected function buildSideNavView($for_app = false, $has_search = false) {
|
|
$nav = new AphrontSideNavFilterView();
|
|
$nav->setBaseURI(new PhutilURI($this->getApplicationURI()));
|
|
|
|
if ($for_app) {
|
|
$nav->addLabel(pht('Create'));
|
|
$nav->addFilter('',
|
|
pht('Create Macro'),
|
|
$this->getApplicationURI('/create/'));
|
|
}
|
|
|
|
$nav->addLabel(pht('Macros'));
|
|
$nav->addFilter('active', pht('Active Macros'));
|
|
$nav->addFilter('all', pht('All Macros'));
|
|
$nav->addFilter('my', pht('My Macros'));
|
|
if ($has_search) {
|
|
$nav->addFilter('search',
|
|
pht('Search'),
|
|
$this->getRequest()->getRequestURI());
|
|
}
|
|
|
|
|
|
return $nav;
|
|
}
|
|
|
|
public function buildApplicationMenu() {
|
|
return $this->buildSideNavView($for_app = true)->getMenu();
|
|
}
|
|
|
|
protected function buildApplicationCrumbs() {
|
|
$crumbs = parent::buildApplicationCrumbs();
|
|
|
|
$crumbs->addAction(
|
|
id(new PhabricatorMenuItemView())
|
|
->setName(pht('Create Macro'))
|
|
->setHref($this->getApplicationURI('/create/'))
|
|
->setIcon('create'));
|
|
|
|
return $crumbs;
|
|
}
|
|
|
|
}
|