mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-13 10:22:42 +01:00
64ed971039
Summary: Ref T9252. This is the same as D14157, just for Resources and their leases. Test Plan: Viewed a resource, saw only active leases, clicked "View All Leases", queried, clicked around, used crumbs. Reviewers: chad Reviewed By: chad Maniphest Tasks: T9252 Differential Revision: https://secure.phabricator.com/D14158
62 lines
1.3 KiB
PHP
62 lines
1.3 KiB
PHP
<?php
|
|
|
|
abstract class DrydockLeaseController
|
|
extends DrydockController {
|
|
|
|
private $resource;
|
|
|
|
public function setResource($resource) {
|
|
$this->resource = $resource;
|
|
return $this;
|
|
}
|
|
|
|
public function getResource() {
|
|
return $this->resource;
|
|
}
|
|
|
|
public function buildSideNavView() {
|
|
$nav = new AphrontSideNavFilterView();
|
|
$nav->setBaseURI(new PhutilURI($this->getApplicationURI()));
|
|
|
|
$engine = id(new DrydockLeaseSearchEngine())
|
|
->setViewer($this->getRequest()->getUser());
|
|
|
|
if ($this->getResource()) {
|
|
$engine->setResource($this->getResource());
|
|
}
|
|
|
|
$engine->addNavigationItems($nav->getMenu());
|
|
|
|
$nav->selectFilter(null);
|
|
|
|
return $nav;
|
|
}
|
|
|
|
protected function buildApplicationCrumbs() {
|
|
$crumbs = parent::buildApplicationCrumbs();
|
|
|
|
$resource = $this->getResource();
|
|
if ($resource) {
|
|
$id = $resource->getID();
|
|
|
|
$crumbs->addTextCrumb(
|
|
pht('Resources'),
|
|
$this->getApplicationURI('resource/'));
|
|
|
|
$crumbs->addTextCrumb(
|
|
$resource->getName(),
|
|
$this->getApplicationURI("resource/{$id}/"));
|
|
|
|
$crumbs->addTextCrumb(
|
|
pht('Leases'),
|
|
$this->getApplicationURI("resource/{$id}/leases/"));
|
|
|
|
} else {
|
|
$crumbs->addTextCrumb(
|
|
pht('Leases'),
|
|
$this->getApplicationURI('lease/'));
|
|
}
|
|
return $crumbs;
|
|
}
|
|
|
|
}
|