mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-15 11:22:40 +01:00
c453e98c40
Summary: Removes many tables and uses PropertyLists and ObjectItemList when possible. Adds cleaner CSS, makes mobile editing more possible. Test Plan: Test new UI on desktop and mobile. Verify all functionality still exists. Reviewers: btrahan, epriestley Reviewed By: epriestley Subscribers: epriestley, Korvin Maniphest Tasks: T4272 Differential Revision: https://secure.phabricator.com/D8860
78 lines
2.1 KiB
PHP
78 lines
2.1 KiB
PHP
<?php
|
|
|
|
final class HeraldRuleListController extends HeraldController
|
|
implements PhabricatorApplicationSearchResultsControllerInterface {
|
|
|
|
private $queryKey;
|
|
|
|
public function shouldAllowPublic() {
|
|
return true;
|
|
}
|
|
|
|
public function willProcessRequest(array $data) {
|
|
$this->queryKey = idx($data, 'queryKey');
|
|
}
|
|
|
|
public function processRequest() {
|
|
$request = $this->getRequest();
|
|
$controller = id(new PhabricatorApplicationSearchController($request))
|
|
->setQueryKey($this->queryKey)
|
|
->setSearchEngine(new HeraldRuleSearchEngine())
|
|
->setNavigation($this->buildSideNavView());
|
|
|
|
return $this->delegateToController($controller);
|
|
}
|
|
|
|
public function renderResultsList(
|
|
array $rules,
|
|
PhabricatorSavedQuery $query) {
|
|
assert_instances_of($rules, 'HeraldRule');
|
|
|
|
$viewer = $this->getRequest()->getUser();
|
|
|
|
$phids = mpull($rules, 'getAuthorPHID');
|
|
$this->loadHandles($phids);
|
|
|
|
$content_type_map = HeraldAdapter::getEnabledAdapterMap($viewer);
|
|
|
|
$list = id(new PHUIObjectItemListView())
|
|
->setUser($viewer)
|
|
->setCards(true);
|
|
foreach ($rules as $rule) {
|
|
$id = $rule->getID();
|
|
|
|
$item = id(new PHUIObjectItemView())
|
|
->setObjectName("H{$id}")
|
|
->setHeader($rule->getName())
|
|
->setHref($this->getApplicationURI("rule/{$id}/"));
|
|
|
|
if ($rule->isPersonalRule()) {
|
|
$item->addByline(
|
|
pht(
|
|
'Authored by %s',
|
|
$this->getHandle($rule->getAuthorPHID())->renderLink()));
|
|
} else {
|
|
$item->addIcon('world', pht('Global Rule'));
|
|
}
|
|
|
|
if ($rule->getIsDisabled()) {
|
|
$item->setDisabled(true);
|
|
$item->addIcon('disable-grey', pht('Disabled'));
|
|
}
|
|
|
|
$item->addAction(
|
|
id(new PHUIListItemView())
|
|
->setHref($this->getApplicationURI("history/{$id}/"))
|
|
->setIcon('transcript')
|
|
->setName(pht('Edit Log')));
|
|
|
|
$content_type_name = idx($content_type_map, $rule->getContentType());
|
|
$item->addAttribute(pht('Affects: %s', $content_type_name));
|
|
|
|
$list->addItem($item);
|
|
}
|
|
|
|
return $list;
|
|
}
|
|
|
|
}
|