Move repository actions (notify, autoclose) to new UI
Summary: Ref T2231. Brings "Notify/Publish" and "Autoclose" to the new UI. Test Plan: See screenshots. Reviewers: btrahan, chad Reviewed By: btrahan CC: aran Maniphest Tasks: T2231 Differential Revision: https://secure.phabricator.com/D7402
This commit is contained in:
@@ -68,6 +68,10 @@ final class DiffusionRepositoryEditController extends DiffusionController {
|
||||
$this->buildSubversionActions($repository));
|
||||
}
|
||||
|
||||
$actions_properties = $this->buildActionsProperties(
|
||||
$repository,
|
||||
$this->buildActionsActions($repository));
|
||||
|
||||
$xactions = id(new PhabricatorRepositoryTransactionQuery())
|
||||
->setViewer($user)
|
||||
->withObjectPHIDs(array($repository->getPHID()))
|
||||
@@ -104,6 +108,8 @@ final class DiffusionRepositoryEditController extends DiffusionController {
|
||||
$obj_box->addPropertyList($subversion_properties);
|
||||
}
|
||||
|
||||
$obj_box->addPropertyList($actions_properties);
|
||||
|
||||
return $this->buildApplicationPage(
|
||||
array(
|
||||
$crumbs,
|
||||
@@ -389,4 +395,54 @@ final class DiffusionRepositoryEditController extends DiffusionController {
|
||||
return $view;
|
||||
}
|
||||
|
||||
private function buildActionsActions(PhabricatorRepository $repository) {
|
||||
$viewer = $this->getRequest()->getUser();
|
||||
|
||||
$view = id(new PhabricatorActionListView())
|
||||
->setObjectURI($this->getRequest()->getRequestURI())
|
||||
->setUser($viewer);
|
||||
|
||||
$can_edit = PhabricatorPolicyFilter::hasCapability(
|
||||
$viewer,
|
||||
$repository,
|
||||
PhabricatorPolicyCapability::CAN_EDIT);
|
||||
|
||||
$edit = id(new PhabricatorActionView())
|
||||
->setIcon('edit')
|
||||
->setName(pht('Edit Actions'))
|
||||
->setHref(
|
||||
$this->getRepositoryControllerURI($repository, 'edit/actions/'))
|
||||
->setWorkflow(!$can_edit)
|
||||
->setDisabled(!$can_edit);
|
||||
$view->addAction($edit);
|
||||
|
||||
return $view;
|
||||
}
|
||||
|
||||
private function buildActionsProperties(
|
||||
PhabricatorRepository $repository,
|
||||
PhabricatorActionListView $actions) {
|
||||
|
||||
$viewer = $this->getRequest()->getUser();
|
||||
|
||||
$view = id(new PHUIPropertyListView())
|
||||
->setUser($viewer)
|
||||
->setActionList($actions)
|
||||
->addSectionHeader(pht('Actions'));
|
||||
|
||||
$notify = $repository->getDetail('herald-disabled')
|
||||
? pht('Off')
|
||||
: pht('On');
|
||||
$notify = phutil_tag('em', array(), $notify);
|
||||
$view->addProperty(pht('Publish/Notify'), $notify);
|
||||
|
||||
$autoclose = $repository->getDetail('disable-autoclose')
|
||||
? pht('Off')
|
||||
: pht('On');
|
||||
$autoclose = phutil_tag('em', array(), $autoclose);
|
||||
$view->addProperty(pht('Autoclose'), $autoclose);
|
||||
|
||||
return $view;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user