public function setDropdownMenu(PhabricatorActionListView $actions)
 {
     Javelin::initBehavior('phui-dropdown-menu');
     $this->addSigil('phui-dropdown-menu');
     $this->setMetadata($actions->getDropdownMenuMetadata());
     return $this;
 }
 private function buildActionListView(PonderQuestion $question)
 {
     $viewer = $this->getRequest()->getUser();
     $view = new PhabricatorActionListView();
     $view->setUser($viewer);
     $view->setObject($question);
     return $view;
 }
 public function renderExample()
 {
     $request = $this->getRequest();
     $user = $request->getUser();
     $notices = array();
     if ($request->isFormPost()) {
         $notices[] = 'You just submitted a valid form POST.';
     }
     if ($request->isJavelinWorkflow()) {
         $notices[] = 'You just submitted a Workflow request.';
     }
     if ($notices) {
         $notices = id(new AphrontErrorView())->setSeverity(AphrontErrorView::SEVERITY_NOTICE)->setErrors($notices);
     } else {
         $notices = null;
     }
     if ($request->isJavelinWorkflow()) {
         $dialog = new AphrontDialogView();
         $dialog->setUser($user);
         $dialog->setTitle('Request Information');
         $dialog->appendChild($notices);
         $dialog->addCancelButton($request->getRequestURI(), 'Close');
         return id(new AphrontDialogResponse())->setDialog($dialog);
     }
     $view = new PhabricatorActionListView();
     $view->setUser($user);
     $view->addAction(id(new PhabricatorActionView())->setUser($user)->setHref($request->getRequestURI())->setName('Normal Action')->setIcon('file'));
     $view->addAction(id(new PhabricatorActionView())->setUser($user)->setHref($request->getRequestURI())->setDisabled(true)->setName('Disabled Action')->setIcon('file'));
     $view->addAction(id(new PhabricatorActionView())->setUser($user)->setHref($request->getRequestURI())->setRenderAsForm(true)->setName('Form Action')->setIcon('file'));
     $view->addAction(id(new PhabricatorActionView())->setUser($user)->setHref($request->getRequestURI())->setRenderAsForm(true)->setDisabled(true)->setName('Disabled Form Action')->setIcon('file'));
     $view->addAction(id(new PhabricatorActionView())->setUser($user)->setHref($request->getRequestURI())->setWorkflow(true)->setName('Workflow Action')->setIcon('file'));
     $view->addAction(id(new PhabricatorActionView())->setUser($user)->setHref($request->getRequestURI())->setRenderAsForm(true)->setWorkflow(true)->setName('Form + Workflow Action')->setIcon('file'));
     return array($view, '<div style="clear: both;"></div>', $notices);
 }
 private function enrichActionView(PhabricatorActionListView $view, DiffusionRequest $drequest, $show_blame, $show_color)
 {
     $viewer = $this->getRequest()->getUser();
     $base_uri = $this->getRequest()->getRequestURI();
     $view->addAction(id(new PhabricatorActionView())->setName(pht('Show Last Change'))->setHref($drequest->generateURI(array('action' => 'change')))->setIcon('fa-backward'));
     if ($show_blame) {
         $blame_text = pht('Disable Blame');
         $blame_icon = 'fa-exclamation-circle lightgreytext';
         $blame_value = 0;
     } else {
         $blame_text = pht('Enable Blame');
         $blame_icon = 'fa-exclamation-circle';
         $blame_value = 1;
     }
     $view->addAction(id(new PhabricatorActionView())->setName($blame_text)->setHref($base_uri->alter('blame', $blame_value))->setIcon($blame_icon)->setUser($viewer)->setRenderAsForm($viewer->isLoggedIn()));
     if ($show_color) {
         $highlight_text = pht('Disable Highlighting');
         $highlight_icon = 'fa-star-o grey';
         $highlight_value = 0;
     } else {
         $highlight_text = pht('Enable Highlighting');
         $highlight_icon = 'fa-star';
         $highlight_value = 1;
     }
     $view->addAction(id(new PhabricatorActionView())->setName($highlight_text)->setHref($base_uri->alter('color', $highlight_value))->setIcon($highlight_icon)->setUser($viewer)->setRenderAsForm($viewer->isLoggedIn()));
     $href = null;
     if ($this->getRequest()->getStr('lint') !== null) {
         $lint_text = pht('Hide %d Lint Message(s)', count($this->lintMessages));
         $href = $base_uri->alter('lint', null);
     } else {
         if ($this->lintCommit === null) {
             $lint_text = pht('Lint not Available');
         } else {
             $lint_text = pht('Show %d Lint Message(s)', count($this->lintMessages));
             $href = $this->getDiffusionRequest()->generateURI(array('action' => 'browse', 'commit' => $this->lintCommit))->alter('lint', '');
         }
     }
     $view->addAction(id(new PhabricatorActionView())->setName($lint_text)->setHref($href)->setIcon('fa-exclamation-triangle')->setDisabled(!$href));
     return $view;
 }
 public function setActionList(PhabricatorActionListView $list)
 {
     $this->actionListID = celerity_generate_unique_node_id();
     $list->setId($this->actionListID);
     return $this;
 }