1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-15 03:12:41 +01:00
phorge-phorge/src/view/layout/PhabricatorActionListView.php
Chad Little e187312177 Action Menu (mobile)
Summary: First pass here, still needs some UI work (maybe? tablets?). Getting it out to see if implementation is corrrect.

Test Plan: Shrink Maniphest task on Chrome, see new UI. Toggle menu. Test on iOS.

Reviewers: epriestley, btrahan

Reviewed By: epriestley

CC: aran, Korvin

Differential Revision: https://secure.phabricator.com/D5631
2013-04-09 12:42:03 -07:00

56 lines
1.1 KiB
PHP

<?php
final class PhabricatorActionListView extends AphrontView {
private $actions = array();
private $object;
private $id = null;
public function setObject(PhabricatorLiskDAO $object) {
$this->object = $object;
return $this;
}
public function addAction(PhabricatorActionView $view) {
$this->actions[] = $view;
return $this;
}
public function setID($id) {
$this->id = $id;
return $this;
}
public function render() {
if (!$this->user) {
throw new Exception(pht("Call setUser() before render()!"));
}
$event = new PhabricatorEvent(
PhabricatorEventType::TYPE_UI_DIDRENDERACTIONS,
array(
'object' => $this->object,
'actions' => $this->actions,
));
$event->setUser($this->user);
PhutilEventEngine::dispatchEvent($event);
$actions = $event->getValue('actions');
if (!$actions) {
return null;
}
require_celerity_resource('phabricator-action-list-view-css');
return phutil_tag(
'ul',
array(
'class' => 'phabricator-action-list-view',
'id' => $this->id
),
$actions);
}
}