1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-18 12:52:42 +01:00

Update Badges for PHUITwoColumnView

Summary: Updates the layout to two column, moves "Add Receipients" to dialog. Ref T10318

Test Plan: Give badges, revoke badges.

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin

Maniphest Tasks: T10318

Differential Revision: https://secure.phabricator.com/D15382
This commit is contained in:
Chad Little 2016-03-02 11:05:26 -08:00
parent 6f481aa84f
commit b9a13e56e4
7 changed files with 57 additions and 51 deletions

View file

@ -155,7 +155,7 @@ return array(
'rsrc/css/phui/phui-status.css' => '888cedb8', 'rsrc/css/phui/phui-status.css' => '888cedb8',
'rsrc/css/phui/phui-tag-view.css' => '9d5d4400', 'rsrc/css/phui/phui-tag-view.css' => '9d5d4400',
'rsrc/css/phui/phui-timeline-view.css' => '2efceff8', 'rsrc/css/phui/phui-timeline-view.css' => '2efceff8',
'rsrc/css/phui/phui-two-column-view.css' => 'cc0b8a09', 'rsrc/css/phui/phui-two-column-view.css' => '64355d16',
'rsrc/css/phui/workboards/phui-workboard-color.css' => 'ac6fe6a7', 'rsrc/css/phui/workboards/phui-workboard-color.css' => 'ac6fe6a7',
'rsrc/css/phui/workboards/phui-workboard.css' => 'e6d89647', 'rsrc/css/phui/workboards/phui-workboard.css' => 'e6d89647',
'rsrc/css/phui/workboards/phui-workcard.css' => '3646fb96', 'rsrc/css/phui/workboards/phui-workcard.css' => '3646fb96',
@ -843,7 +843,7 @@ return array(
'phui-tag-view-css' => '9d5d4400', 'phui-tag-view-css' => '9d5d4400',
'phui-theme-css' => '027ba77e', 'phui-theme-css' => '027ba77e',
'phui-timeline-view-css' => '2efceff8', 'phui-timeline-view-css' => '2efceff8',
'phui-two-column-view-css' => 'cc0b8a09', 'phui-two-column-view-css' => '64355d16',
'phui-workboard-color-css' => 'ac6fe6a7', 'phui-workboard-color-css' => 'ac6fe6a7',
'phui-workboard-view-css' => 'e6d89647', 'phui-workboard-view-css' => 'e6d89647',
'phui-workcard-view-css' => '3646fb96', 'phui-workcard-view-css' => '3646fb96',

View file

@ -6123,7 +6123,7 @@ phutil_register_library_map(array(
'PhabricatorBadgesMailReceiver' => 'PhabricatorObjectMailReceiver', 'PhabricatorBadgesMailReceiver' => 'PhabricatorObjectMailReceiver',
'PhabricatorBadgesPHIDType' => 'PhabricatorPHIDType', 'PhabricatorBadgesPHIDType' => 'PhabricatorPHIDType',
'PhabricatorBadgesQuery' => 'PhabricatorCursorPagedPolicyAwareQuery', 'PhabricatorBadgesQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
'PhabricatorBadgesRecipientsListView' => 'AphrontTagView', 'PhabricatorBadgesRecipientsListView' => 'AphrontView',
'PhabricatorBadgesRemoveRecipientsController' => 'PhabricatorBadgesController', 'PhabricatorBadgesRemoveRecipientsController' => 'PhabricatorBadgesController',
'PhabricatorBadgesReplyHandler' => 'PhabricatorApplicationTransactionReplyHandler', 'PhabricatorBadgesReplyHandler' => 'PhabricatorApplicationTransactionReplyHandler',
'PhabricatorBadgesSchemaSpec' => 'PhabricatorConfigSchemaSpec', 'PhabricatorBadgesSchemaSpec' => 'PhabricatorConfigSchemaSpec',

View file

@ -22,6 +22,7 @@ final class PhabricatorBadgesEditRecipientsController
} }
$recipient_phids = $badge->getRecipientPHIDs(); $recipient_phids = $badge->getRecipientPHIDs();
$view_uri = $this->getApplicationURI('view/'.$badge->getID().'/');
if ($request->isFormPost()) { if ($request->isFormPost()) {
$recipient_spec = array(); $recipient_spec = array();
@ -53,7 +54,7 @@ final class PhabricatorBadgesEditRecipientsController
->applyTransactions($badge, $xactions); ->applyTransactions($badge, $xactions);
return id(new AphrontRedirectResponse()) return id(new AphrontRedirectResponse())
->setURI($request->getRequestURI()); ->setURI($view_uri);
} }
$recipient_phids = array_reverse($recipient_phids); $recipient_phids = array_reverse($recipient_phids);
@ -76,44 +77,26 @@ final class PhabricatorBadgesEditRecipientsController
$title = pht('Add Recipient'); $title = pht('Add Recipient');
if ($can_edit) { if ($can_edit) {
$header_name = pht('Edit Recipients'); $header_name = pht('Edit Recipients');
$view_uri = $this->getApplicationURI('view/'.$badge->getID().'/');
$form = new AphrontFormView(); $form = new AphrontFormView();
$form $form
->setUser($viewer) ->setUser($viewer)
->setFullWidth(true)
->appendControl( ->appendControl(
id(new AphrontFormTokenizerControl()) id(new AphrontFormTokenizerControl())
->setName('phids') ->setName('phids')
->setLabel(pht('Add Recipients')) ->setLabel(pht('Add Recipients'))
->setDatasource(new PhabricatorPeopleDatasource())) ->setDatasource(new PhabricatorPeopleDatasource()));
->appendChild(
id(new AphrontFormSubmitControl())
->addCancelButton($view_uri)
->setValue(pht('Add Recipients')));
$form_box = id(new PHUIObjectBoxView())
->setHeaderText($title)
->setForm($form);
} }
$recipient_list = id(new PhabricatorBadgesRecipientsListView()) $dialog = id(new AphrontDialogView())
->setBadge($badge) ->setUser($viewer)
->setHandles($handles) ->setTitle(pht('Award Badges'))
->setUser($viewer); ->appendForm($form)
->addCancelButton($view_uri)
->addSubmitButton(pht('Add Recipients'));
$badge_url = $this->getApplicationURI('view/'.$id.'/'); return $dialog;
$crumbs = $this->buildApplicationCrumbs();
$crumbs->addTextCrumb($badge->getName(), $badge_url);
$crumbs->addTextCrumb(pht('Recipients'));
return $this->newPage()
->setTitle($title)
->setCrumbs($crumbs)
->appendChild(
array(
$form_box,
$recipient_list,
));
} }
} }

View file

@ -28,8 +28,7 @@ final class PhabricatorBadgesRemoveRecipientsController
return new Aphront404Response(); return new Aphront404Response();
} }
$recipients_uri = $view_uri = $this->getApplicationURI('view/'.$badge->getID().'/');
$this->getApplicationURI('recipients/'.$badge->getID().'/');
if ($request->isFormPost()) { if ($request->isFormPost()) {
$recipient_spec = array(); $recipient_spec = array();
@ -52,7 +51,7 @@ final class PhabricatorBadgesRemoveRecipientsController
->applyTransactions($badge, $xactions); ->applyTransactions($badge, $xactions);
return id(new AphrontRedirectResponse()) return id(new AphrontRedirectResponse())
->setURI($recipients_uri); ->setURI($view_uri);
} }
$handle = id(new PhabricatorHandleQuery()) $handle = id(new PhabricatorHandleQuery())
@ -68,7 +67,7 @@ final class PhabricatorBadgesRemoveRecipientsController
'Really revoke the badge "%s" from %s?', 'Really revoke the badge "%s" from %s?',
phutil_tag('strong', array(), $badge->getName()), phutil_tag('strong', array(), $badge->getName()),
phutil_tag('strong', array(), $handle->getName()))) phutil_tag('strong', array(), $handle->getName())))
->addCancelButton($recipients_uri) ->addCancelButton($view_uri)
->addSubmitButton(pht('Revoke Badge')); ->addSubmitButton(pht('Revoke Badge'));
return $dialog; return $dialog;

View file

@ -22,6 +22,7 @@ final class PhabricatorBadgesViewController
$crumbs = $this->buildApplicationCrumbs(); $crumbs = $this->buildApplicationCrumbs();
$crumbs->addTextCrumb($badge->getName()); $crumbs->addTextCrumb($badge->getName());
$crumbs->setBorder(true);
$title = $badge->getName(); $title = $badge->getName();
if ($badge->isArchived()) { if ($badge->isArchived()) {
@ -39,15 +40,12 @@ final class PhabricatorBadgesViewController
->setHeader($badge->getName()) ->setHeader($badge->getName())
->setUser($viewer) ->setUser($viewer)
->setPolicyObject($badge) ->setPolicyObject($badge)
->setStatus($status_icon, $status_color, $status_name); ->setStatus($status_icon, $status_color, $status_name)
->setHeaderIcon('fa-trophy');
$properties = $this->buildPropertyListView($badge); $properties = $this->buildPropertyListView($badge);
$actions = $this->buildActionListView($badge); $actions = $this->buildActionListView($badge);
$properties->setActionList($actions); $details = $this->buildDetailsView($badge);
$box = id(new PHUIObjectBoxView())
->setHeader($header)
->addPropertyList($properties);
$timeline = $this->buildTransactionTimeline( $timeline = $this->buildTransactionTimeline(
$badge, $badge,
@ -64,26 +62,47 @@ final class PhabricatorBadgesViewController
$add_comment = $this->buildCommentForm($badge); $add_comment = $this->buildCommentForm($badge);
$view = id(new PHUITwoColumnView())
->setHeader($header)
->setMainColumn(array(
$recipient_list,
$timeline,
$add_comment,
))
->setPropertyList($properties)
->setActionList($actions)
->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(
array( array(
$box, $view,
$recipient_list,
$timeline,
$add_comment,
)); ));
} }
private function buildPropertyListView(PhabricatorBadgesBadge $badge) { private function buildPropertyListView(
PhabricatorBadgesBadge $badge) {
$viewer = $this->getViewer(); $viewer = $this->getViewer();
$view = id(new PHUIPropertyListView()) $view = id(new PHUIPropertyListView())
->setUser($viewer) ->setUser($viewer)
->setObject($badge); ->setObject($badge);
$view->invokeWillRenderEvent();
return $view;
}
private function buildDetailsView(
PhabricatorBadgesBadge $badge) {
$viewer = $this->getViewer();
$view = id(new PHUIPropertyListView())
->setUser($viewer);
$quality = idx($badge->getQualityNameMap(), $badge->getQuality()); $quality = idx($badge->getQualityNameMap(), $badge->getQuality());
$view->addProperty( $view->addProperty(
@ -99,8 +118,6 @@ final class PhabricatorBadgesViewController
pht('Flavor'), pht('Flavor'),
$badge->getFlavor()); $badge->getFlavor());
$view->invokeWillRenderEvent();
$description = $badge->getDescription(); $description = $badge->getDescription();
if (strlen($description)) { if (strlen($description)) {
$view->addSectionHeader( $view->addSectionHeader(
@ -160,9 +177,10 @@ final class PhabricatorBadgesViewController
$view->addAction( $view->addAction(
id(new PhabricatorActionView()) id(new PhabricatorActionView())
->setName('Manage Recipients') ->setName('Add Recipients')
->setIcon('fa-users') ->setIcon('fa-users')
->setDisabled(!$can_edit) ->setDisabled(!$can_edit)
->setWorkflow(true)
->setHref($this->getApplicationURI("/recipients/{$id}/"))); ->setHref($this->getApplicationURI("/recipients/{$id}/")));
return $view; return $view;

View file

@ -1,6 +1,6 @@
<?php <?php
final class PhabricatorBadgesRecipientsListView extends AphrontTagView { final class PhabricatorBadgesRecipientsListView extends AphrontView {
private $badge; private $badge;
private $handles; private $handles;
@ -15,7 +15,7 @@ final class PhabricatorBadgesRecipientsListView extends AphrontTagView {
return $this; return $this;
} }
protected function getTagContent() { public function render() {
$viewer = $this->user; $viewer = $this->user;

View file

@ -200,4 +200,10 @@
.phui-two-column-view .phui-two-column-content .phui-info-view { .phui-two-column-view .phui-two-column-content .phui-info-view {
margin: 0 0 20px 0; margin: 0 0 20px 0;
padding: 16px;
}
.phui-two-column-view .phui-two-column-content .phui-object-box
.phui-info-view {
margin: 0;
} }