1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-18 19:40:55 +01:00

Convert every two-column application except Maniphest to curtain views

Summary: Moves over everything except Maniphest, which has some special behavior.

Test Plan:
  - Viewed a badge.
  - Viewed a calendar event.
  - Viewed a countdown.
  - Viewed a Fund initiative.
  - Viewed a Herald rule.
  - Viewed a macro.
  - Viewed an application.
  - Viewed an owners package.
  - Viewed a credential.
  - Viewed a Ponder question.
  - Viewed a poll.

Reviewers: chad

Reviewed By: chad

Differential Revision: https://secure.phabricator.com/D15416
This commit is contained in:
epriestley 2016-03-06 10:08:49 -08:00
parent eb1a0799ae
commit fd9de5d6ec
12 changed files with 184 additions and 373 deletions

View file

@ -43,8 +43,7 @@ final class PhabricatorBadgesViewController
->setStatus($status_icon, $status_color, $status_name) ->setStatus($status_icon, $status_color, $status_name)
->setHeaderIcon('fa-trophy'); ->setHeaderIcon('fa-trophy');
$properties = $this->buildPropertyListView($badge); $curtain = $this->buildCurtain($badge);
$actions = $this->buildActionListView($badge);
$details = $this->buildDetailsView($badge); $details = $this->buildDetailsView($badge);
$timeline = $this->buildTransactionTimeline( $timeline = $this->buildTransactionTimeline(
@ -64,36 +63,19 @@ final class PhabricatorBadgesViewController
$view = id(new PHUITwoColumnView()) $view = id(new PHUITwoColumnView())
->setHeader($header) ->setHeader($header)
->setCurtain($curtain)
->setMainColumn(array( ->setMainColumn(array(
$recipient_list, $recipient_list,
$timeline, $timeline,
$add_comment, $add_comment,
)) ))
->setPropertyList($properties)
->setActionList($actions)
->addPropertySection(pht('BADGE DETAILS'), $details); ->addPropertySection(pht('BADGE DETAILS'), $details);
return $this->newPage() return $this->newPage()
->setTitle($title) ->setTitle($title)
->setCrumbs($crumbs) ->setCrumbs($crumbs)
->setPageObjectPHIDs(array($badge->getPHID())) ->setPageObjectPHIDs(array($badge->getPHID()))
->appendChild( ->appendChild($view);
array(
$view,
));
}
private function buildPropertyListView(
PhabricatorBadgesBadge $badge) {
$viewer = $this->getViewer();
$view = id(new PHUIPropertyListView())
->setUser($viewer)
->setObject($badge);
$view->invokeWillRenderEvent();
return $view;
} }
private function buildDetailsView( private function buildDetailsView(
@ -137,53 +119,55 @@ final class PhabricatorBadgesViewController
return $view; return $view;
} }
private function buildActionListView(PhabricatorBadgesBadge $badge) { private function buildCurtain(PhabricatorBadgesBadge $badge) {
$viewer = $this->getViewer(); $viewer = $this->getViewer();
$id = $badge->getID();
$can_edit = PhabricatorPolicyFilter::hasCapability( $can_edit = PhabricatorPolicyFilter::hasCapability(
$viewer, $viewer,
$badge, $badge,
PhabricatorPolicyCapability::CAN_EDIT); PhabricatorPolicyCapability::CAN_EDIT);
$view = id(new PhabricatorActionListView()) $id = $badge->getID();
->setUser($viewer) $edit_uri = $this->getApplicationURI("/edit/{$id}/");
->setObject($badge); $archive_uri = $this->getApplicationURI("/archive/{$id}/");
$award_uri = $this->getApplicationURI("/recipients/{$id}/");
$view->addAction( $curtain = $this->newCurtainView($badge);
$curtain->addAction(
id(new PhabricatorActionView()) id(new PhabricatorActionView())
->setName(pht('Edit Badge')) ->setName(pht('Edit Badge'))
->setIcon('fa-pencil') ->setIcon('fa-pencil')
->setDisabled(!$can_edit) ->setDisabled(!$can_edit)
->setHref($this->getApplicationURI("/edit/{$id}/"))); ->setHref($edit_uri));
if ($badge->isArchived()) { if ($badge->isArchived()) {
$view->addAction( $curtain->addAction(
id(new PhabricatorActionView()) id(new PhabricatorActionView())
->setName(pht('Activate Badge')) ->setName(pht('Activate Badge'))
->setIcon('fa-check') ->setIcon('fa-check')
->setDisabled(!$can_edit) ->setDisabled(!$can_edit)
->setWorkflow($can_edit) ->setWorkflow($can_edit)
->setHref($this->getApplicationURI("/archive/{$id}/"))); ->setHref($archive_uri));
} else { } else {
$view->addAction( $curtain->addAction(
id(new PhabricatorActionView()) id(new PhabricatorActionView())
->setName(pht('Archive Badge')) ->setName(pht('Archive Badge'))
->setIcon('fa-ban') ->setIcon('fa-ban')
->setDisabled(!$can_edit) ->setDisabled(!$can_edit)
->setWorkflow($can_edit) ->setWorkflow($can_edit)
->setHref($this->getApplicationURI("/archive/{$id}/"))); ->setHref($archive_uri));
} }
$view->addAction( $curtain->addAction(
id(new PhabricatorActionView()) id(new PhabricatorActionView())
->setName('Add Recipients') ->setName('Add Recipients')
->setIcon('fa-users') ->setIcon('fa-users')
->setDisabled(!$can_edit) ->setDisabled(!$can_edit)
->setWorkflow(true) ->setWorkflow(true)
->setHref($this->getApplicationURI("/recipients/{$id}/"))); ->setHref($award_uri));
return $view; return $curtain;
} }
private function buildCommentForm(PhabricatorBadgesBadge $badge) { private function buildCommentForm(PhabricatorBadgesBadge $badge) {

View file

@ -475,8 +475,14 @@ abstract class PhabricatorController extends AphrontController {
$viewer = $this->getViewer(); $viewer = $this->getViewer();
$action_list = id(new PhabricatorActionListView()) $action_list = id(new PhabricatorActionListView())
->setViewer($viewer) ->setViewer($viewer);
->setObject($object);
// NOTE: Applications (objects of class PhabricatorApplication) can't
// currently be set here, although they don't need any of the extensions
// anyway. This should probably work differently than it does, though.
if ($object instanceof PhabricatorLiskDAO) {
$action_list->setObject($object);
}
$curtain = id(new PHUICurtainView()) $curtain = id(new PHUICurtainView())
->setViewer($viewer) ->setViewer($viewer)

View file

@ -63,8 +63,7 @@ final class PhabricatorCalendarEventViewController
} }
$header = $this->buildHeaderView($event); $header = $this->buildHeaderView($event);
$actions = $this->buildActionView($event); $curtain = $this->buildCurtain($event);
$properties = $this->buildPropertyListView($event);
$details = $this->buildPropertySection($event); $details = $this->buildPropertySection($event);
$description = $this->buildDescriptionView($event); $description = $this->buildDescriptionView($event);
@ -91,10 +90,9 @@ final class PhabricatorCalendarEventViewController
$view = id(new PHUITwoColumnView()) $view = id(new PHUITwoColumnView())
->setHeader($header) ->setHeader($header)
->setMainColumn($timeline) ->setMainColumn($timeline)
->setPropertyList($properties) ->setCurtain($curtain)
->addPropertySection(pht('DETAILS'), $details) ->addPropertySection(pht('DETAILS'), $details)
->addPropertySection(pht('DESCRIPTION'), $description) ->addPropertySection(pht('DESCRIPTION'), $description);
->setActionList($actions);
return $this->newPage() return $this->newPage()
->setTitle($page_title) ->setTitle($page_title)
@ -148,16 +146,12 @@ final class PhabricatorCalendarEventViewController
return $header; return $header;
} }
private function buildActionView(PhabricatorCalendarEvent $event) { private function buildCurtain(PhabricatorCalendarEvent $event) {
$viewer = $this->getRequest()->getUser(); $viewer = $this->getRequest()->getUser();
$id = $event->getID(); $id = $event->getID();
$is_cancelled = $event->getIsCancelled(); $is_cancelled = $event->getIsCancelled();
$is_attending = $event->getIsUserAttending($viewer->getPHID()); $is_attending = $event->getIsUserAttending($viewer->getPHID());
$actions = id(new PhabricatorActionListView())
->setUser($viewer)
->setObject($event);
$can_edit = PhabricatorPolicyFilter::hasCapability( $can_edit = PhabricatorPolicyFilter::hasCapability(
$viewer, $viewer,
$event, $event,
@ -178,8 +172,10 @@ final class PhabricatorCalendarEventViewController
$edit_uri = "event/edit/{$id}/"; $edit_uri = "event/edit/{$id}/";
} }
$curtain = $this->newCurtainView($event);
if ($edit_label && $edit_uri) { if ($edit_label && $edit_uri) {
$actions->addAction( $curtain->addAction(
id(new PhabricatorActionView()) id(new PhabricatorActionView())
->setName($edit_label) ->setName($edit_label)
->setIcon('fa-pencil') ->setIcon('fa-pencil')
@ -189,14 +185,14 @@ final class PhabricatorCalendarEventViewController
} }
if ($is_attending) { if ($is_attending) {
$actions->addAction( $curtain->addAction(
id(new PhabricatorActionView()) id(new PhabricatorActionView())
->setName(pht('Decline Event')) ->setName(pht('Decline Event'))
->setIcon('fa-user-times') ->setIcon('fa-user-times')
->setHref($this->getApplicationURI("event/join/{$id}/")) ->setHref($this->getApplicationURI("event/join/{$id}/"))
->setWorkflow(true)); ->setWorkflow(true));
} else { } else {
$actions->addAction( $curtain->addAction(
id(new PhabricatorActionView()) id(new PhabricatorActionView())
->setName(pht('Join Event')) ->setName(pht('Join Event'))
->setIcon('fa-user-plus') ->setIcon('fa-user-plus')
@ -230,7 +226,7 @@ final class PhabricatorCalendarEventViewController
} }
if ($is_cancelled) { if ($is_cancelled) {
$actions->addAction( $curtain->addAction(
id(new PhabricatorActionView()) id(new PhabricatorActionView())
->setName($reinstate_label) ->setName($reinstate_label)
->setIcon('fa-plus') ->setIcon('fa-plus')
@ -238,7 +234,7 @@ final class PhabricatorCalendarEventViewController
->setDisabled($cancel_disabled) ->setDisabled($cancel_disabled)
->setWorkflow(true)); ->setWorkflow(true));
} else { } else {
$actions->addAction( $curtain->addAction(
id(new PhabricatorActionView()) id(new PhabricatorActionView())
->setName($cancel_label) ->setName($cancel_label)
->setIcon('fa-times') ->setIcon('fa-times')
@ -247,20 +243,7 @@ final class PhabricatorCalendarEventViewController
->setWorkflow(true)); ->setWorkflow(true));
} }
return $actions; return $curtain;
}
private function buildPropertyListView(
PhabricatorCalendarEvent $event) {
$viewer = $this->getViewer();
$properties = id(new PHUIPropertyListView())
->setUser($viewer)
->setObject($event);
$properties->invokeWillRenderEvent();
return $properties;
} }
private function buildPropertySection( private function buildPropertySection(

View file

@ -49,8 +49,7 @@ final class PhabricatorCountdownViewController
->setStatus($icon, $color, $status) ->setStatus($icon, $color, $status)
->setHeaderIcon('fa-rocket'); ->setHeaderIcon('fa-rocket');
$actions = $this->buildActionListView($countdown); $curtain = $this->buildCurtain($countdown);
$properties = $this->buildPropertyListView($countdown);
$subheader = $this->buildSubheaderView($countdown); $subheader = $this->buildSubheaderView($countdown);
$timeline = $this->buildTransactionTimeline( $timeline = $this->buildTransactionTimeline(
@ -67,9 +66,8 @@ final class PhabricatorCountdownViewController
$view = id(new PHUITwoColumnView()) $view = id(new PHUITwoColumnView())
->setHeader($header) ->setHeader($header)
->setSubheader($subheader) ->setSubheader($subheader)
->setMainColumn($content) ->setCurtain($curtain)
->setPropertyList($properties) ->setMainColumn($content);
->setActionList($actions);
return $this->newPage() return $this->newPage()
->setTitle($title) ->setTitle($title)
@ -78,28 +76,22 @@ final class PhabricatorCountdownViewController
array( array(
$countdown->getPHID(), $countdown->getPHID(),
)) ))
->appendChild( ->appendChild($view);
array(
$view,
));
} }
private function buildActionListView(PhabricatorCountdown $countdown) { private function buildCurtain(PhabricatorCountdown $countdown) {
$request = $this->getRequest(); $viewer = $this->getViewer();
$viewer = $request->getUser();
$id = $countdown->getID(); $id = $countdown->getID();
$view = id(new PhabricatorActionListView())
->setObject($countdown)
->setUser($viewer);
$can_edit = PhabricatorPolicyFilter::hasCapability( $can_edit = PhabricatorPolicyFilter::hasCapability(
$viewer, $viewer,
$countdown, $countdown,
PhabricatorPolicyCapability::CAN_EDIT); PhabricatorPolicyCapability::CAN_EDIT);
$view->addAction( $curtain = $this->newCurtainView($countdown);
$curtain->addAction(
id(new PhabricatorActionView()) id(new PhabricatorActionView())
->setIcon('fa-pencil') ->setIcon('fa-pencil')
->setName(pht('Edit Countdown')) ->setName(pht('Edit Countdown'))
@ -107,7 +99,7 @@ final class PhabricatorCountdownViewController
->setDisabled(!$can_edit) ->setDisabled(!$can_edit)
->setWorkflow(!$can_edit)); ->setWorkflow(!$can_edit));
$view->addAction( $curtain->addAction(
id(new PhabricatorActionView()) id(new PhabricatorActionView())
->setIcon('fa-times') ->setIcon('fa-times')
->setName(pht('Delete Countdown')) ->setName(pht('Delete Countdown'))
@ -115,17 +107,7 @@ final class PhabricatorCountdownViewController
->setDisabled(!$can_edit) ->setDisabled(!$can_edit)
->setWorkflow(true)); ->setWorkflow(true));
return $view; return $curtain;
}
private function buildPropertyListView(
PhabricatorCountdown $countdown) {
$viewer = $this->getViewer();
$view = id(new PHUIPropertyListView())
->setUser($viewer)
->setObject($countdown);
$view->invokeWillRenderEvent();
return $view;
} }
private function buildSubheaderView( private function buildSubheaderView(

View file

@ -46,8 +46,7 @@ final class FundInitiativeViewController
->setStatus($status_icon, $status_color, $status_name) ->setStatus($status_icon, $status_color, $status_name)
->setHeaderIcon('fa-heart'); ->setHeaderIcon('fa-heart');
$properties = $this->buildPropertyListView($initiative); $curtain = $this->buildCurtain($initiative);
$actions = $this->buildActionListView($initiative);
$details = $this->buildPropertySectionView($initiative); $details = $this->buildPropertySectionView($initiative);
$timeline = $this->buildTransactionTimeline( $timeline = $this->buildTransactionTimeline(
@ -57,31 +56,15 @@ final class FundInitiativeViewController
$view = id(new PHUITwoColumnView()) $view = id(new PHUITwoColumnView())
->setHeader($header) ->setHeader($header)
->setCurtain($curtain)
->setMainColumn($timeline) ->setMainColumn($timeline)
->setPropertyList($properties) ->addPropertySection(pht('DETAILS'), $details);
->addPropertySection(pht('DETAILS'), $details)
->setActionList($actions);
return $this->newPage() return $this->newPage()
->setTitle($title) ->setTitle($title)
->setCrumbs($crumbs) ->setCrumbs($crumbs)
->setPageObjectPHIDs(array($initiative->getPHID())) ->setPageObjectPHIDs(array($initiative->getPHID()))
->appendChild( ->appendChild($view);
array(
$view,
));
}
private function buildPropertyListView(FundInitiative $initiative) {
$viewer = $this->getRequest()->getUser();
$view = id(new PHUIPropertyListView())
->setUser($viewer)
->setObject($initiative);
$view->invokeWillRenderEvent();
return $view;
} }
private function buildPropertySectionView(FundInitiative $initiative) { private function buildPropertySectionView(FundInitiative $initiative) {
@ -124,8 +107,9 @@ final class FundInitiativeViewController
return $view; return $view;
} }
private function buildActionListView(FundInitiative $initiative) { private function buildCurtain(FundInitiative $initiative) {
$viewer = $this->getRequest()->getUser(); $viewer = $this->getViewer();
$id = $initiative->getID(); $id = $initiative->getID();
$can_edit = PhabricatorPolicyFilter::hasCapability( $can_edit = PhabricatorPolicyFilter::hasCapability(
@ -133,11 +117,9 @@ final class FundInitiativeViewController
$initiative, $initiative,
PhabricatorPolicyCapability::CAN_EDIT); PhabricatorPolicyCapability::CAN_EDIT);
$view = id(new PhabricatorActionListView()) $curtain = $this->newCurtainView($initiative);
->setUser($viewer)
->setObject($initiative);
$view->addAction( $curtain->addAction(
id(new PhabricatorActionView()) id(new PhabricatorActionView())
->setName(pht('Edit Initiative')) ->setName(pht('Edit Initiative'))
->setIcon('fa-pencil') ->setIcon('fa-pencil')
@ -153,7 +135,7 @@ final class FundInitiativeViewController
$close_icon = 'fa-times'; $close_icon = 'fa-times';
} }
$view->addAction( $curtain->addAction(
id(new PhabricatorActionView()) id(new PhabricatorActionView())
->setName($close_name) ->setName($close_name)
->setIcon($close_icon) ->setIcon($close_icon)
@ -161,7 +143,7 @@ final class FundInitiativeViewController
->setWorkflow(true) ->setWorkflow(true)
->setHref($this->getApplicationURI("/close/{$id}/"))); ->setHref($this->getApplicationURI("/close/{$id}/")));
$view->addAction( $curtain->addAction(
id(new PhabricatorActionView()) id(new PhabricatorActionView())
->setName(pht('Back Initiative')) ->setName(pht('Back Initiative'))
->setIcon('fa-money') ->setIcon('fa-money')
@ -169,13 +151,13 @@ final class FundInitiativeViewController
->setWorkflow(true) ->setWorkflow(true)
->setHref($this->getApplicationURI("/back/{$id}/"))); ->setHref($this->getApplicationURI("/back/{$id}/")));
$view->addAction( $curtain->addAction(
id(new PhabricatorActionView()) id(new PhabricatorActionView())
->setName(pht('View Backers')) ->setName(pht('View Backers'))
->setIcon('fa-bank') ->setIcon('fa-bank')
->setHref($this->getApplicationURI("/backers/{$id}/"))); ->setHref($this->getApplicationURI("/backers/{$id}/")));
return $view; return $curtain;
} }
} }

View file

@ -33,8 +33,7 @@ final class HeraldRuleViewController extends HeraldController {
pht('Active')); pht('Active'));
} }
$actions = $this->buildActionView($rule); $curtain = $this->buildCurtain($rule);
$properties = $this->buildPropertyView($rule);
$details = $this->buildPropertySectionView($rule); $details = $this->buildPropertySectionView($rule);
$description = $this->buildDescriptionView($rule); $description = $this->buildDescriptionView($rule);
@ -44,10 +43,6 @@ final class HeraldRuleViewController extends HeraldController {
$crumbs->addTextCrumb("H{$id}"); $crumbs->addTextCrumb("H{$id}");
$crumbs->setBorder(true); $crumbs->setBorder(true);
$object_box = id(new PHUIObjectBoxView())
->setHeader($header)
->addPropertyList($properties);
$timeline = $this->buildTransactionTimeline( $timeline = $this->buildTransactionTimeline(
$rule, $rule,
new HeraldTransactionQuery()); new HeraldTransactionQuery());
@ -57,35 +52,30 @@ final class HeraldRuleViewController extends HeraldController {
$view = id(new PHUITwoColumnView()) $view = id(new PHUITwoColumnView())
->setHeader($header) ->setHeader($header)
->setCurtain($curtain)
->setMainColumn($timeline) ->setMainColumn($timeline)
->addPropertySection(pht('DETAILS'), $details) ->addPropertySection(pht('DETAILS'), $details)
->addPropertySection(pht('DESCRIPTION'), $description) ->addPropertySection(pht('DESCRIPTION'), $description);
->setPropertyList($properties)
->setActionList($actions);
return $this->newPage() return $this->newPage()
->setTitle($title) ->setTitle($title)
->setCrumbs($crumbs) ->setCrumbs($crumbs)
->appendChild( ->appendChild($view);
array(
$view,
));
} }
private function buildActionView(HeraldRule $rule) { private function buildCurtain(HeraldRule $rule) {
$viewer = $this->getRequest()->getUser(); $viewer = $this->getViewer();
$id = $rule->getID();
$view = id(new PhabricatorActionListView()) $id = $rule->getID();
->setUser($viewer)
->setObject($rule);
$can_edit = PhabricatorPolicyFilter::hasCapability( $can_edit = PhabricatorPolicyFilter::hasCapability(
$viewer, $viewer,
$rule, $rule,
PhabricatorPolicyCapability::CAN_EDIT); PhabricatorPolicyCapability::CAN_EDIT);
$view->addAction( $curtain = $this->newCurtainView($rule);
$curtain->addAction(
id(new PhabricatorActionView()) id(new PhabricatorActionView())
->setName(pht('Edit Rule')) ->setName(pht('Edit Rule'))
->setHref($this->getApplicationURI("edit/{$id}/")) ->setHref($this->getApplicationURI("edit/{$id}/"))
@ -103,7 +93,7 @@ final class HeraldRuleViewController extends HeraldController {
$disable_name = pht('Archive Rule'); $disable_name = pht('Archive Rule');
} }
$view->addAction( $curtain->addAction(
id(new PhabricatorActionView()) id(new PhabricatorActionView())
->setName(pht('Disable Rule')) ->setName(pht('Disable Rule'))
->setHref($this->getApplicationURI($disable_uri)) ->setHref($this->getApplicationURI($disable_uri))
@ -112,23 +102,10 @@ final class HeraldRuleViewController extends HeraldController {
->setDisabled(!$can_edit) ->setDisabled(!$can_edit)
->setWorkflow(true)); ->setWorkflow(true));
return $view; return $curtain;
} }
private function buildPropertyView( private function buildPropertySectionView(
HeraldRule $rule) {
$viewer = $this->getRequest()->getUser();
$view = id(new PHUIPropertyListView())
->setUser($viewer)
->setObject($rule);
$view->invokeWillRenderEvent();
return $view;
}
private function buildPropertySectionView(
HeraldRule $rule) { HeraldRule $rule) {
$viewer = $this->getRequest()->getUser(); $viewer = $this->getRequest()->getUser();

View file

@ -23,9 +23,8 @@ final class PhabricatorMacroViewController
$title_short = pht('Macro "%s"', $macro->getName()); $title_short = pht('Macro "%s"', $macro->getName());
$title_long = pht('Image Macro "%s"', $macro->getName()); $title_long = pht('Image Macro "%s"', $macro->getName());
$actions = $this->buildActionView($macro); $curtain = $this->buildCurtain($macro);
$subheader = $this->buildSubheaderView($macro); $subheader = $this->buildSubheaderView($macro);
$properties = $this->buildPropertyView($macro);
$file = $this->buildFileView($macro); $file = $this->buildFileView($macro);
$details = $this->buildPropertySectionView($macro); $details = $this->buildPropertySectionView($macro);
@ -68,35 +67,29 @@ final class PhabricatorMacroViewController
$view = id(new PHUITwoColumnView()) $view = id(new PHUITwoColumnView())
->setHeader($header) ->setHeader($header)
->setSubheader($subheader) ->setSubheader($subheader)
->setCurtain($curtain)
->setMainColumn(array( ->setMainColumn(array(
$timeline, $timeline,
$add_comment_form, $add_comment_form,
)) ))
->addPropertySection(pht('MACRO'), $file) ->addPropertySection(pht('MACRO'), $file)
->addPropertySection(pht('DETAILS'), $details) ->addPropertySection(pht('DETAILS'), $details);
->setPropertyList($properties)
->setActionList($actions);
return $this->newPage() return $this->newPage()
->setTitle($title_short) ->setTitle($title_short)
->setCrumbs($crumbs) ->setCrumbs($crumbs)
->setPageObjectPHIDs(array($macro->getPHID())) ->setPageObjectPHIDs(array($macro->getPHID()))
->appendChild( ->appendChild($view);
array(
$view,
));
} }
private function buildActionView( private function buildCurtain(
PhabricatorFileImageMacro $macro) { PhabricatorFileImageMacro $macro) {
$can_manage = $this->hasApplicationCapability( $can_manage = $this->hasApplicationCapability(
PhabricatorMacroManageCapability::CAPABILITY); PhabricatorMacroManageCapability::CAPABILITY);
$request = $this->getRequest(); $curtain = $this->newCurtainView($macro);
$view = id(new PhabricatorActionListView())
->setUser($request->getUser()) $curtain->addAction(
->setObject($macro)
->addAction(
id(new PhabricatorActionView()) id(new PhabricatorActionView())
->setName(pht('Edit Macro')) ->setName(pht('Edit Macro'))
->setHref($this->getApplicationURI('/edit/'.$macro->getID().'/')) ->setHref($this->getApplicationURI('/edit/'.$macro->getID().'/'))
@ -104,7 +97,7 @@ final class PhabricatorMacroViewController
->setWorkflow(!$can_manage) ->setWorkflow(!$can_manage)
->setIcon('fa-pencil')); ->setIcon('fa-pencil'));
$view->addAction( $curtain->addAction(
id(new PhabricatorActionView()) id(new PhabricatorActionView())
->setName(pht('Edit Audio')) ->setName(pht('Edit Audio'))
->setHref($this->getApplicationURI('/audio/'.$macro->getID().'/')) ->setHref($this->getApplicationURI('/audio/'.$macro->getID().'/'))
@ -113,7 +106,7 @@ final class PhabricatorMacroViewController
->setIcon('fa-music')); ->setIcon('fa-music'));
if ($macro->getIsDisabled()) { if ($macro->getIsDisabled()) {
$view->addAction( $curtain->addAction(
id(new PhabricatorActionView()) id(new PhabricatorActionView())
->setName(pht('Activate Macro')) ->setName(pht('Activate Macro'))
->setHref($this->getApplicationURI('/disable/'.$macro->getID().'/')) ->setHref($this->getApplicationURI('/disable/'.$macro->getID().'/'))
@ -121,7 +114,7 @@ final class PhabricatorMacroViewController
->setDisabled(!$can_manage) ->setDisabled(!$can_manage)
->setIcon('fa-check')); ->setIcon('fa-check'));
} else { } else {
$view->addAction( $curtain->addAction(
id(new PhabricatorActionView()) id(new PhabricatorActionView())
->setName(pht('Archive Macro')) ->setName(pht('Archive Macro'))
->setHref($this->getApplicationURI('/disable/'.$macro->getID().'/')) ->setHref($this->getApplicationURI('/disable/'.$macro->getID().'/'))
@ -130,7 +123,7 @@ final class PhabricatorMacroViewController
->setIcon('fa-ban')); ->setIcon('fa-ban'));
} }
return $view; return $curtain;
} }
private function buildSubheaderView( private function buildSubheaderView(
@ -206,17 +199,4 @@ final class PhabricatorMacroViewController
return null; return null;
} }
private function buildPropertyView(
PhabricatorFileImageMacro $macro) {
$viewer = $this->getViewer();
$view = id(new PHUIPropertyListView())
->setUser($this->getRequest()->getUser())
->setObject($macro);
$view->invokeWillRenderEvent();
return $view;
}
} }

View file

@ -38,7 +38,7 @@ final class PhabricatorApplicationDetailViewController
$header->setStatus('fa-ban', 'dark', pht('Uninstalled')); $header->setStatus('fa-ban', 'dark', pht('Uninstalled'));
} }
$actions = $this->buildActionView($viewer, $selected); $curtain = $this->buildCurtain($selected);
$details = $this->buildPropertySectionView($selected); $details = $this->buildPropertySectionView($selected);
$policies = $this->buildPolicyView($selected); $policies = $this->buildPolicyView($selected);
@ -58,12 +58,12 @@ final class PhabricatorApplicationDetailViewController
$view = id(new PHUITwoColumnView()) $view = id(new PHUITwoColumnView())
->setHeader($header) ->setHeader($header)
->setCurtain($curtain)
->setMainColumn(array( ->setMainColumn(array(
$policies, $policies,
$panels, $panels,
)) ))
->addPropertySection(pht('DETAILS'), $details) ->addPropertySection(pht('DETAILS'), $details);
->setActionList($actions);
return $this->newPage() return $this->newPage()
->setTitle($title) ->setTitle($title)
@ -147,21 +147,22 @@ final class PhabricatorApplicationDetailViewController
} }
private function buildActionView( private function buildCurtain(PhabricatorApplication $application) {
PhabricatorUser $user, $viewer = $this->getViewer();
PhabricatorApplication $selected) {
$view = id(new PhabricatorActionListView())
->setUser($user);
$can_edit = PhabricatorPolicyFilter::hasCapability( $can_edit = PhabricatorPolicyFilter::hasCapability(
$user, $viewer,
$selected, $application,
PhabricatorPolicyCapability::CAN_EDIT); PhabricatorPolicyCapability::CAN_EDIT);
$edit_uri = $this->getApplicationURI('edit/'.get_class($selected).'/'); $key = get_class($application);
$edit_uri = $this->getApplicationURI("edit/{$key}/");
$install_uri = $this->getApplicationURI("{$key}/install/");
$uninstall_uri = $this->getApplicationURI("{$key}/uninstall/");
$view->addAction( $curtain = $this->newCurtainView($application);
$curtain->addAction(
id(new PhabricatorActionView()) id(new PhabricatorActionView())
->setName(pht('Edit Policies')) ->setName(pht('Edit Policies'))
->setIcon('fa-pencil') ->setIcon('fa-pencil')
@ -169,45 +170,42 @@ final class PhabricatorApplicationDetailViewController
->setWorkflow(!$can_edit) ->setWorkflow(!$can_edit)
->setHref($edit_uri)); ->setHref($edit_uri));
if ($selected->canUninstall()) { if ($application->canUninstall()) {
if ($selected->isInstalled()) { if ($application->isInstalled()) {
$view->addAction( $curtain->addAction(
id(new PhabricatorActionView()) id(new PhabricatorActionView())
->setName(pht('Uninstall')) ->setName(pht('Uninstall'))
->setIcon('fa-times') ->setIcon('fa-times')
->setDisabled(!$can_edit) ->setDisabled(!$can_edit)
->setWorkflow(true) ->setWorkflow(true)
->setHref( ->setHref($uninstall_uri));
$this->getApplicationURI(get_class($selected).'/uninstall/')));
} else { } else {
$action = id(new PhabricatorActionView()) $action = id(new PhabricatorActionView())
->setName(pht('Install')) ->setName(pht('Install'))
->setIcon('fa-plus') ->setIcon('fa-plus')
->setDisabled(!$can_edit) ->setDisabled(!$can_edit)
->setWorkflow(true) ->setWorkflow(true)
->setHref( ->setHref($install_uri);
$this->getApplicationURI(get_class($selected).'/install/'));
$prototypes_enabled = PhabricatorEnv::getEnvConfig( $prototypes_enabled = PhabricatorEnv::getEnvConfig(
'phabricator.show-prototypes'); 'phabricator.show-prototypes');
if ($selected->isPrototype() && !$prototypes_enabled) { if ($application->isPrototype() && !$prototypes_enabled) {
$action->setDisabled(true); $action->setDisabled(true);
} }
$view->addAction($action); $curtain->addAction($action);
} }
} else { } else {
$view->addAction( $curtain->addAction(
id(new PhabricatorActionView()) id(new PhabricatorActionView())
->setName(pht('Uninstall')) ->setName(pht('Uninstall'))
->setIcon('fa-times') ->setIcon('fa-times')
->setWorkflow(true) ->setWorkflow(true)
->setDisabled(true) ->setDisabled(true)
->setHref( ->setHref($uninstall_uri));
$this->getApplicationURI(get_class($selected).'/uninstall/')));
} }
return $view; return $curtain;
} }
} }

View file

@ -43,8 +43,7 @@ final class PhabricatorOwnersDetailController
->setViewer($viewer) ->setViewer($viewer)
->readFieldsFromStorage($package); ->readFieldsFromStorage($package);
$actions = $this->buildPackageActionView($package); $curtain = $this->buildCurtain($package);
$properties = $this->buildPackagePropertyView($package, $field_list);
$details = $this->buildPackageDetailView($package, $field_list); $details = $this->buildPackageDetailView($package, $field_list);
if ($package->isArchived()) { if ($package->isArchived()) {
@ -155,35 +154,18 @@ final class PhabricatorOwnersDetailController
$view = id(new PHUITwoColumnView()) $view = id(new PHUITwoColumnView())
->setHeader($header) ->setHeader($header)
->setCurtain($curtain)
->setMainColumn(array( ->setMainColumn(array(
$this->renderPathsTable($paths, $repositories), $this->renderPathsTable($paths, $repositories),
$commit_panels, $commit_panels,
$timeline, $timeline,
)) ))
->addPropertySection(pht('Details'), $details) ->addPropertySection(pht('Details'), $details);
->setPropertyList($properties)
->setActionList($actions);
return $this->newPage() return $this->newPage()
->setTitle($package->getName()) ->setTitle($package->getName())
->setCrumbs($crumbs) ->setCrumbs($crumbs)
->appendChild( ->appendChild($view);
array(
$view,
));
}
private function buildPackagePropertyView(
PhabricatorOwnersPackage $package,
PhabricatorCustomFieldList $field_list) {
$viewer = $this->getViewer();
$view = id(new PHUIPropertyListView())
->setUser($viewer)
->setObject($package);
$view->invokeWillRenderEvent();
return $view;
} }
private function buildPackageDetailView( private function buildPackageDetailView(
@ -224,7 +206,7 @@ final class PhabricatorOwnersDetailController
return $view; return $view;
} }
private function buildPackageActionView(PhabricatorOwnersPackage $package) { private function buildCurtain(PhabricatorOwnersPackage $package) {
$viewer = $this->getViewer(); $viewer = $this->getViewer();
$can_edit = PhabricatorPolicyFilter::hasCapability( $can_edit = PhabricatorPolicyFilter::hasCapability(
@ -236,45 +218,43 @@ final class PhabricatorOwnersDetailController
$edit_uri = $this->getApplicationURI("/edit/{$id}/"); $edit_uri = $this->getApplicationURI("/edit/{$id}/");
$paths_uri = $this->getApplicationURI("/paths/{$id}/"); $paths_uri = $this->getApplicationURI("/paths/{$id}/");
$action_list = id(new PhabricatorActionListView()) $curtain = $this->newCurtainView($package);
->setUser($viewer)
->setObject($package);
$action_list->addAction( $curtain->addAction(
id(new PhabricatorActionView()) id(new PhabricatorActionView())
->setName(pht('Edit Package')) ->setName(pht('Edit Package'))
->setIcon('fa-pencil') ->setIcon('fa-pencil')
->setDisabled(!$can_edit) ->setDisabled(!$can_edit)
->setWorkflow(!$can_edit) ->setWorkflow(!$can_edit)
->setHref($edit_uri)); ->setHref($edit_uri));
if ($package->isArchived()) { if ($package->isArchived()) {
$action_list->addAction( $curtain->addAction(
id(new PhabricatorActionView()) id(new PhabricatorActionView())
->setName(pht('Activate Package')) ->setName(pht('Activate Package'))
->setIcon('fa-check') ->setIcon('fa-check')
->setDisabled(!$can_edit) ->setDisabled(!$can_edit)
->setWorkflow($can_edit) ->setWorkflow($can_edit)
->setHref($this->getApplicationURI("/archive/{$id}/"))); ->setHref($this->getApplicationURI("/archive/{$id}/")));
} else { } else {
$action_list->addAction( $curtain->addAction(
id(new PhabricatorActionView()) id(new PhabricatorActionView())
->setName(pht('Archive Package')) ->setName(pht('Archive Package'))
->setIcon('fa-ban') ->setIcon('fa-ban')
->setDisabled(!$can_edit) ->setDisabled(!$can_edit)
->setWorkflow($can_edit) ->setWorkflow($can_edit)
->setHref($this->getApplicationURI("/archive/{$id}/"))); ->setHref($this->getApplicationURI("/archive/{$id}/")));
} }
$action_list->addAction( $curtain->addAction(
id(new PhabricatorActionView()) id(new PhabricatorActionView())
->setName(pht('Edit Paths')) ->setName(pht('Edit Paths'))
->setIcon('fa-folder-open') ->setIcon('fa-folder-open')
->setDisabled(!$can_edit) ->setDisabled(!$can_edit)
->setWorkflow(!$can_edit) ->setWorkflow(!$can_edit)
->setHref($paths_uri)); ->setHref($paths_uri));
return $action_list; return $curtain;
} }
private function renderPathsTable(array $paths, array $repositories) { private function renderPathsTable(array $paths, array $repositories) {

View file

@ -31,26 +31,21 @@ final class PassphraseCredentialViewController extends PassphraseController {
$crumbs->setBorder(true); $crumbs->setBorder(true);
$header = $this->buildHeaderView($credential); $header = $this->buildHeaderView($credential);
$actions = $this->buildActionView($credential, $type); $curtain = $this->buildCurtain($credential, $type);
$properties = $this->buildPropertyView($credential, $type);
$subheader = $this->buildSubheaderView($credential); $subheader = $this->buildSubheaderView($credential);
$content = $this->buildPropertySectionView($credential, $type); $content = $this->buildPropertySectionView($credential, $type);
$view = id(new PHUITwoColumnView()) $view = id(new PHUITwoColumnView())
->setHeader($header) ->setHeader($header)
->setSubheader($subheader) ->setSubheader($subheader)
->setCurtain($curtain)
->setMainColumn($timeline) ->setMainColumn($timeline)
->addPropertySection(pht('PROPERTIES'), $content) ->addPropertySection(pht('PROPERTIES'), $content);
->setPropertyList($properties)
->setActionList($actions);
return $this->newPage() return $this->newPage()
->setTitle($title) ->setTitle($title)
->setCrumbs($crumbs) ->setCrumbs($crumbs)
->appendChild( ->appendChild($view);
array(
$view,
));
} }
private function buildHeaderView(PassphraseCredential $credential) { private function buildHeaderView(PassphraseCredential $credential) {
@ -98,10 +93,10 @@ final class PassphraseCredentialViewController extends PassphraseController {
->setContent($content); ->setContent($content);
} }
private function buildActionView( private function buildCurtain(
PassphraseCredential $credential, PassphraseCredential $credential,
PassphraseCredentialType $type) { PassphraseCredentialType $type) {
$viewer = $this->getRequest()->getUser(); $viewer = $this->getViewer();
$id = $credential->getID(); $id = $credential->getID();
@ -123,16 +118,14 @@ final class PassphraseCredentialViewController extends PassphraseController {
$credential_conduit_icon = 'fa-wrench'; $credential_conduit_icon = 'fa-wrench';
} }
$actions = id(new PhabricatorActionListView())
->setObject($credential)
->setUser($viewer);
$can_edit = PhabricatorPolicyFilter::hasCapability( $can_edit = PhabricatorPolicyFilter::hasCapability(
$viewer, $viewer,
$credential, $credential,
PhabricatorPolicyCapability::CAN_EDIT); PhabricatorPolicyCapability::CAN_EDIT);
$actions->addAction( $curtain = $this->newCurtainView($credential);
$curtain->addAction(
id(new PhabricatorActionView()) id(new PhabricatorActionView())
->setName(pht('Edit Credential')) ->setName(pht('Edit Credential'))
->setIcon('fa-pencil') ->setIcon('fa-pencil')
@ -141,7 +134,7 @@ final class PassphraseCredentialViewController extends PassphraseController {
->setWorkflow(!$can_edit)); ->setWorkflow(!$can_edit));
if (!$credential->getIsDestroyed()) { if (!$credential->getIsDestroyed()) {
$actions->addAction( $curtain->addAction(
id(new PhabricatorActionView()) id(new PhabricatorActionView())
->setName(pht('Destroy Credential')) ->setName(pht('Destroy Credential'))
->setIcon('fa-times') ->setIcon('fa-times')
@ -149,7 +142,7 @@ final class PassphraseCredentialViewController extends PassphraseController {
->setDisabled(!$can_edit) ->setDisabled(!$can_edit)
->setWorkflow(true)); ->setWorkflow(true));
$actions->addAction( $curtain->addAction(
id(new PhabricatorActionView()) id(new PhabricatorActionView())
->setName(pht('Show Secret')) ->setName(pht('Show Secret'))
->setIcon('fa-eye') ->setIcon('fa-eye')
@ -158,7 +151,7 @@ final class PassphraseCredentialViewController extends PassphraseController {
->setWorkflow(true)); ->setWorkflow(true));
if ($type->hasPublicKey()) { if ($type->hasPublicKey()) {
$actions->addAction( $curtain->addAction(
id(new PhabricatorActionView()) id(new PhabricatorActionView())
->setName(pht('Show Public Key')) ->setName(pht('Show Public Key'))
->setIcon('fa-download') ->setIcon('fa-download')
@ -167,7 +160,7 @@ final class PassphraseCredentialViewController extends PassphraseController {
->setWorkflow(true)); ->setWorkflow(true));
} }
$actions->addAction( $curtain->addAction(
id(new PhabricatorActionView()) id(new PhabricatorActionView())
->setName($credential_conduit_text) ->setName($credential_conduit_text)
->setIcon($credential_conduit_icon) ->setIcon($credential_conduit_icon)
@ -175,7 +168,7 @@ final class PassphraseCredentialViewController extends PassphraseController {
->setDisabled(!$can_edit) ->setDisabled(!$can_edit)
->setWorkflow(true)); ->setWorkflow(true));
$actions->addAction( $curtain->addAction(
id(new PhabricatorActionView()) id(new PhabricatorActionView())
->setName($credential_lock_text) ->setName($credential_lock_text)
->setIcon($credential_lock_icon) ->setIcon($credential_lock_icon)
@ -184,8 +177,7 @@ final class PassphraseCredentialViewController extends PassphraseController {
->setWorkflow(true)); ->setWorkflow(true));
} }
return $curtain;
return $actions;
} }
private function buildPropertySectionView( private function buildPropertySectionView(
@ -236,17 +228,4 @@ final class PassphraseCredentialViewController extends PassphraseController {
return $properties; return $properties;
} }
private function buildPropertyView(
PassphraseCredential $credential,
PassphraseCredentialType $type) {
$viewer = $this->getRequest()->getUser();
$properties = id(new PHUIPropertyListView())
->setUser($viewer)
->setObject($credential);
$properties->invokeWillRenderEvent();
return $properties;
}
} }

View file

@ -43,8 +43,7 @@ final class PonderQuestionViewController extends PonderController {
$header->setStatus($icon, 'dark', $text); $header->setStatus($icon, 'dark', $text);
} }
$properties = $this->buildPropertyListView($question); $curtain = $this->buildCurtain($question);
$actions = $this->buildActionListView($question);
$details = $this->buildPropertySectionView($question); $details = $this->buildPropertySectionView($question);
$can_edit = PhabricatorPolicyFilter::hasCapability( $can_edit = PhabricatorPolicyFilter::hasCapability(
@ -118,29 +117,24 @@ final class PonderQuestionViewController extends PonderController {
$ponder_view = id(new PHUITwoColumnView()) $ponder_view = id(new PHUITwoColumnView())
->setHeader($header) ->setHeader($header)
->setSubheader($subheader) ->setSubheader($subheader)
->setCurtain($curtain)
->setMainColumn($ponder_content) ->setMainColumn($ponder_content)
->setPropertyList($properties)
->addPropertySection(pht('DETAILS'), $details) ->addPropertySection(pht('DETAILS'), $details)
->setActionList($actions)
->addClass('ponder-question-view'); ->addClass('ponder-question-view');
$page_objects = array_merge( $page_objects = array_merge(
array($question->getPHID()), array($question->getPHID()),
mpull($question->getAnswers(), 'getPHID')); mpull($question->getAnswers(), 'getPHID'));
return $this->newPage() return $this->newPage()
->setTitle('Q'.$question->getID().' '.$question->getTitle()) ->setTitle('Q'.$question->getID().' '.$question->getTitle())
->setCrumbs($crumbs) ->setCrumbs($crumbs)
->setPageObjectPHIDs($page_objects) ->setPageObjectPHIDs($page_objects)
->appendChild( ->appendChild($ponder_view);
array(
$ponder_view,
));
} }
private function buildActionListView(PonderQuestion $question) { private function buildCurtain(PonderQuestion $question) {
$viewer = $this->getViewer(); $viewer = $this->getViewer();
$request = $this->getRequest();
$id = $question->getID(); $id = $question->getID();
$can_edit = PhabricatorPolicyFilter::hasCapability( $can_edit = PhabricatorPolicyFilter::hasCapability(
@ -148,9 +142,7 @@ final class PonderQuestionViewController extends PonderController {
$question, $question,
PhabricatorPolicyCapability::CAN_EDIT); PhabricatorPolicyCapability::CAN_EDIT);
$view = id(new PhabricatorActionListView()) $curtain = $this->newCurtainView($question);
->setUser($viewer)
->setObject($question);
if ($question->getStatus() == PonderQuestionStatus::STATUS_OPEN) { if ($question->getStatus() == PonderQuestionStatus::STATUS_OPEN) {
$name = pht('Close Question'); $name = pht('Close Question');
@ -160,7 +152,7 @@ final class PonderQuestionViewController extends PonderController {
$icon = 'fa-square-o'; $icon = 'fa-square-o';
} }
$view->addAction( $curtain->addAction(
id(new PhabricatorActionView()) id(new PhabricatorActionView())
->setIcon('fa-pencil') ->setIcon('fa-pencil')
->setName(pht('Edit Question')) ->setName(pht('Edit Question'))
@ -168,7 +160,7 @@ final class PonderQuestionViewController extends PonderController {
->setDisabled(!$can_edit) ->setDisabled(!$can_edit)
->setWorkflow(!$can_edit)); ->setWorkflow(!$can_edit));
$view->addAction( $curtain->addAction(
id(new PhabricatorActionView()) id(new PhabricatorActionView())
->setName($name) ->setName($name)
->setIcon($icon) ->setIcon($icon)
@ -176,26 +168,13 @@ final class PonderQuestionViewController extends PonderController {
->setDisabled(!$can_edit) ->setDisabled(!$can_edit)
->setHref($this->getApplicationURI("/question/status/{$id}/"))); ->setHref($this->getApplicationURI("/question/status/{$id}/")));
$view->addAction( $curtain->addAction(
id(new PhabricatorActionView()) id(new PhabricatorActionView())
->setIcon('fa-list') ->setIcon('fa-list')
->setName(pht('View History')) ->setName(pht('View History'))
->setHref($this->getApplicationURI("/question/history/{$id}/"))); ->setHref($this->getApplicationURI("/question/history/{$id}/")));
return $view; return $curtain;
}
private function buildPropertyListView(
PonderQuestion $question) {
$viewer = $this->getViewer();
$view = id(new PHUIPropertyListView())
->setUser($viewer)
->setObject($question);
$view->invokeWillRenderEvent();
return $view;
} }
private function buildSubheaderView( private function buildSubheaderView(

View file

@ -46,8 +46,7 @@ final class PhabricatorSlowvotePollController
->setPolicyObject($poll) ->setPolicyObject($poll)
->setHeaderIcon('fa-bar-chart'); ->setHeaderIcon('fa-bar-chart');
$actions = $this->buildActionView($poll); $curtain = $this->buildCurtain($poll);
$properties = $this->buildPropertyView($poll);
$subheader = $this->buildSubheaderView($poll); $subheader = $this->buildSubheaderView($poll);
$crumbs = $this->buildApplicationCrumbs(); $crumbs = $this->buildApplicationCrumbs();
@ -68,37 +67,31 @@ final class PhabricatorSlowvotePollController
$view = id(new PHUITwoColumnView()) $view = id(new PHUITwoColumnView())
->setHeader($header) ->setHeader($header)
->setSubheader($subheader) ->setSubheader($subheader)
->setMainColumn($poll_content) ->setCurtain($curtain)
->setPropertyList($properties) ->setMainColumn($poll_content);
->setActionList($actions);
return $this->newPage() return $this->newPage()
->setTitle('V'.$poll->getID().' '.$poll->getQuestion()) ->setTitle('V'.$poll->getID().' '.$poll->getQuestion())
->setCrumbs($crumbs) ->setCrumbs($crumbs)
->setPageObjectPHIDs(array($poll->getPHID())) ->setPageObjectPHIDs(array($poll->getPHID()))
->appendChild( ->appendChild($view);
array(
$view,
));
} }
private function buildActionView(PhabricatorSlowvotePoll $poll) { private function buildCurtain(PhabricatorSlowvotePoll $poll) {
$viewer = $this->getRequest()->getUser(); $viewer = $this->getViewer();
$view = id(new PhabricatorActionListView())
->setUser($viewer)
->setObject($poll);
$can_edit = PhabricatorPolicyFilter::hasCapability( $can_edit = PhabricatorPolicyFilter::hasCapability(
$viewer, $viewer,
$poll, $poll,
PhabricatorPolicyCapability::CAN_EDIT); PhabricatorPolicyCapability::CAN_EDIT);
$curtain = $this->newCurtainView($poll);
$is_closed = $poll->getIsClosed(); $is_closed = $poll->getIsClosed();
$close_poll_text = $is_closed ? pht('Reopen Poll') : pht('Close Poll'); $close_poll_text = $is_closed ? pht('Reopen Poll') : pht('Close Poll');
$close_poll_icon = $is_closed ? 'fa-play-circle-o' : 'fa-ban'; $close_poll_icon = $is_closed ? 'fa-play-circle-o' : 'fa-ban';
$view->addAction( $curtain->addAction(
id(new PhabricatorActionView()) id(new PhabricatorActionView())
->setName(pht('Edit Poll')) ->setName(pht('Edit Poll'))
->setIcon('fa-pencil') ->setIcon('fa-pencil')
@ -106,7 +99,7 @@ final class PhabricatorSlowvotePollController
->setDisabled(!$can_edit) ->setDisabled(!$can_edit)
->setWorkflow(!$can_edit)); ->setWorkflow(!$can_edit));
$view->addAction( $curtain->addAction(
id(new PhabricatorActionView()) id(new PhabricatorActionView())
->setName($close_poll_text) ->setName($close_poll_text)
->setIcon($close_poll_icon) ->setIcon($close_poll_icon)
@ -114,19 +107,7 @@ final class PhabricatorSlowvotePollController
->setDisabled(!$can_edit) ->setDisabled(!$can_edit)
->setWorkflow(true)); ->setWorkflow(true));
return $view; return $curtain;
}
private function buildPropertyView(
PhabricatorSlowvotePoll $poll) {
$viewer = $this->getRequest()->getUser();
$view = id(new PHUIPropertyListView())
->setUser($viewer)
->setObject($poll);
$view->invokeWillRenderEvent();
return $view;
} }
private function buildSubheaderView( private function buildSubheaderView(