1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-23 05:50:55 +01:00

Modernize Slowvote, fix Badges mobile menu

Summary: Uses modern methods in Slowvote, adds appmenu, consistent create into Badges

Test Plan: View Poll list, new poll, edit poll, vote in poll.

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin

Maniphest Tasks: T9690

Differential Revision: https://secure.phabricator.com/D14592
This commit is contained in:
Chad Little 2015-11-30 12:51:56 -08:00
parent d2bed3438d
commit 065df01f65
5 changed files with 40 additions and 59 deletions

View file

@ -1,3 +1,10 @@
<?php
abstract class PhabricatorBadgesController extends PhabricatorController {}
abstract class PhabricatorBadgesController extends PhabricatorController {
public function buildApplicationMenu() {
return $this->newApplicationMenu()
->setSearchEngine(new PhabricatorBadgesSearchEngine());
}
}

View file

@ -2,40 +2,9 @@
abstract class PhabricatorSlowvoteController extends PhabricatorController {
public function buildSideNavView($for_app = false) {
$user = $this->getRequest()->getUser();
$nav = new AphrontSideNavFilterView();
$nav->setBaseURI(new PhutilURI($this->getApplicationURI()));
if ($for_app) {
$nav->addFilter('', pht('Create Poll'),
$this->getApplicationURI('create/'));
}
id(new PhabricatorSlowvoteSearchEngine())
->setViewer($user)
->addNavigationItems($nav->getMenu());
$nav->selectFilter(null);
return $nav;
}
public function buildApplicationMenu() {
return $this->buildSideNavView(true)->getMenu();
}
protected function buildApplicationCrumbs() {
$crumbs = parent::buildApplicationCrumbs();
$crumbs->addAction(
id(new PHUIListItemView())
->setName(pht('Create Poll'))
->setHref($this->getApplicationURI('create/'))
->setIcon('fa-plus-square'));
return $crumbs;
return $this->newApplicationMenu()
->setSearchEngine(new PhabricatorSlowvoteSearchEngine());
}
}

View file

@ -257,7 +257,7 @@ final class PhabricatorSlowvoteEditController
->setValue($button)
->addCancelButton($cancel_uri));
$crumbs = $this->buildApplicationCrumbs($this->buildSideNavView());
$crumbs = $this->buildApplicationCrumbs();
$crumbs->addTextCrumb($title);
$form_box = id(new PHUIObjectBoxView())
@ -265,13 +265,12 @@ final class PhabricatorSlowvoteEditController
->setFormErrors($errors)
->setForm($form);
return $this->buildApplicationPage(
array(
$crumbs,
$form_box,
),
array(
'title' => $title,
return $this->newPage()
->setTitle($title)
->setCrumbs($crumbs)
->appendChild(
array(
$form_box,
));
}

View file

@ -8,14 +8,21 @@ final class PhabricatorSlowvoteListController
}
public function handleRequest(AphrontRequest $request) {
$querykey = $request->getURIData('queryKey');
return id(new PhabricatorSlowvoteSearchEngine())
->setController($this)
->buildResponse();
}
$controller = id(new PhabricatorApplicationSearchController())
->setQueryKey($querykey)
->setSearchEngine(new PhabricatorSlowvoteSearchEngine())
->setNavigation($this->buildSideNavView());
protected function buildApplicationCrumbs() {
$crumbs = parent::buildApplicationCrumbs();
return $this->delegateToController($controller);
$crumbs->addAction(
id(new PHUIListItemView())
->setName(pht('Create Poll'))
->setHref($this->getApplicationURI('create/'))
->setIcon('fa-plus-square'));
return $crumbs;
}
}

View file

@ -61,17 +61,16 @@ final class PhabricatorSlowvotePollController
->setHeader($header)
->addPropertyList($properties);
return $this->buildApplicationPage(
array(
$crumbs,
$object_box,
$poll_view,
$timeline,
$add_comment,
),
array(
'title' => 'V'.$poll->getID().' '.$poll->getQuestion(),
'pageObjects' => array($poll->getPHID()),
return $this->newPage()
->setTitle('V'.$poll->getID().' '.$poll->getQuestion())
->setCrumbs($crumbs)
->setPageObjectPHIDs(array($poll->getPHID()))
->appendChild(
array(
$object_box,
$poll_view,
$timeline,
$add_comment,
));
}