mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-22 05:20:56 +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:
parent
6f481aa84f
commit
b9a13e56e4
7 changed files with 57 additions and 51 deletions
|
@ -155,7 +155,7 @@ return array(
|
|||
'rsrc/css/phui/phui-status.css' => '888cedb8',
|
||||
'rsrc/css/phui/phui-tag-view.css' => '9d5d4400',
|
||||
'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.css' => 'e6d89647',
|
||||
'rsrc/css/phui/workboards/phui-workcard.css' => '3646fb96',
|
||||
|
@ -843,7 +843,7 @@ return array(
|
|||
'phui-tag-view-css' => '9d5d4400',
|
||||
'phui-theme-css' => '027ba77e',
|
||||
'phui-timeline-view-css' => '2efceff8',
|
||||
'phui-two-column-view-css' => 'cc0b8a09',
|
||||
'phui-two-column-view-css' => '64355d16',
|
||||
'phui-workboard-color-css' => 'ac6fe6a7',
|
||||
'phui-workboard-view-css' => 'e6d89647',
|
||||
'phui-workcard-view-css' => '3646fb96',
|
||||
|
|
|
@ -6123,7 +6123,7 @@ phutil_register_library_map(array(
|
|||
'PhabricatorBadgesMailReceiver' => 'PhabricatorObjectMailReceiver',
|
||||
'PhabricatorBadgesPHIDType' => 'PhabricatorPHIDType',
|
||||
'PhabricatorBadgesQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
|
||||
'PhabricatorBadgesRecipientsListView' => 'AphrontTagView',
|
||||
'PhabricatorBadgesRecipientsListView' => 'AphrontView',
|
||||
'PhabricatorBadgesRemoveRecipientsController' => 'PhabricatorBadgesController',
|
||||
'PhabricatorBadgesReplyHandler' => 'PhabricatorApplicationTransactionReplyHandler',
|
||||
'PhabricatorBadgesSchemaSpec' => 'PhabricatorConfigSchemaSpec',
|
||||
|
|
|
@ -22,6 +22,7 @@ final class PhabricatorBadgesEditRecipientsController
|
|||
}
|
||||
|
||||
$recipient_phids = $badge->getRecipientPHIDs();
|
||||
$view_uri = $this->getApplicationURI('view/'.$badge->getID().'/');
|
||||
|
||||
if ($request->isFormPost()) {
|
||||
$recipient_spec = array();
|
||||
|
@ -53,7 +54,7 @@ final class PhabricatorBadgesEditRecipientsController
|
|||
->applyTransactions($badge, $xactions);
|
||||
|
||||
return id(new AphrontRedirectResponse())
|
||||
->setURI($request->getRequestURI());
|
||||
->setURI($view_uri);
|
||||
}
|
||||
|
||||
$recipient_phids = array_reverse($recipient_phids);
|
||||
|
@ -76,44 +77,26 @@ final class PhabricatorBadgesEditRecipientsController
|
|||
$title = pht('Add Recipient');
|
||||
if ($can_edit) {
|
||||
$header_name = pht('Edit Recipients');
|
||||
$view_uri = $this->getApplicationURI('view/'.$badge->getID().'/');
|
||||
|
||||
$form = new AphrontFormView();
|
||||
$form
|
||||
->setUser($viewer)
|
||||
->setFullWidth(true)
|
||||
->appendControl(
|
||||
id(new AphrontFormTokenizerControl())
|
||||
->setName('phids')
|
||||
->setLabel(pht('Add Recipients'))
|
||||
->setDatasource(new PhabricatorPeopleDatasource()))
|
||||
->appendChild(
|
||||
id(new AphrontFormSubmitControl())
|
||||
->addCancelButton($view_uri)
|
||||
->setValue(pht('Add Recipients')));
|
||||
$form_box = id(new PHUIObjectBoxView())
|
||||
->setHeaderText($title)
|
||||
->setForm($form);
|
||||
->setDatasource(new PhabricatorPeopleDatasource()));
|
||||
}
|
||||
|
||||
$recipient_list = id(new PhabricatorBadgesRecipientsListView())
|
||||
->setBadge($badge)
|
||||
->setHandles($handles)
|
||||
->setUser($viewer);
|
||||
$dialog = id(new AphrontDialogView())
|
||||
->setUser($viewer)
|
||||
->setTitle(pht('Award Badges'))
|
||||
->appendForm($form)
|
||||
->addCancelButton($view_uri)
|
||||
->addSubmitButton(pht('Add Recipients'));
|
||||
|
||||
$badge_url = $this->getApplicationURI('view/'.$id.'/');
|
||||
|
||||
$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,
|
||||
));
|
||||
return $dialog;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -28,8 +28,7 @@ final class PhabricatorBadgesRemoveRecipientsController
|
|||
return new Aphront404Response();
|
||||
}
|
||||
|
||||
$recipients_uri =
|
||||
$this->getApplicationURI('recipients/'.$badge->getID().'/');
|
||||
$view_uri = $this->getApplicationURI('view/'.$badge->getID().'/');
|
||||
|
||||
if ($request->isFormPost()) {
|
||||
$recipient_spec = array();
|
||||
|
@ -52,7 +51,7 @@ final class PhabricatorBadgesRemoveRecipientsController
|
|||
->applyTransactions($badge, $xactions);
|
||||
|
||||
return id(new AphrontRedirectResponse())
|
||||
->setURI($recipients_uri);
|
||||
->setURI($view_uri);
|
||||
}
|
||||
|
||||
$handle = id(new PhabricatorHandleQuery())
|
||||
|
@ -68,7 +67,7 @@ final class PhabricatorBadgesRemoveRecipientsController
|
|||
'Really revoke the badge "%s" from %s?',
|
||||
phutil_tag('strong', array(), $badge->getName()),
|
||||
phutil_tag('strong', array(), $handle->getName())))
|
||||
->addCancelButton($recipients_uri)
|
||||
->addCancelButton($view_uri)
|
||||
->addSubmitButton(pht('Revoke Badge'));
|
||||
|
||||
return $dialog;
|
||||
|
|
|
@ -22,6 +22,7 @@ final class PhabricatorBadgesViewController
|
|||
|
||||
$crumbs = $this->buildApplicationCrumbs();
|
||||
$crumbs->addTextCrumb($badge->getName());
|
||||
$crumbs->setBorder(true);
|
||||
$title = $badge->getName();
|
||||
|
||||
if ($badge->isArchived()) {
|
||||
|
@ -39,15 +40,12 @@ final class PhabricatorBadgesViewController
|
|||
->setHeader($badge->getName())
|
||||
->setUser($viewer)
|
||||
->setPolicyObject($badge)
|
||||
->setStatus($status_icon, $status_color, $status_name);
|
||||
->setStatus($status_icon, $status_color, $status_name)
|
||||
->setHeaderIcon('fa-trophy');
|
||||
|
||||
$properties = $this->buildPropertyListView($badge);
|
||||
$actions = $this->buildActionListView($badge);
|
||||
$properties->setActionList($actions);
|
||||
|
||||
$box = id(new PHUIObjectBoxView())
|
||||
->setHeader($header)
|
||||
->addPropertyList($properties);
|
||||
$details = $this->buildDetailsView($badge);
|
||||
|
||||
$timeline = $this->buildTransactionTimeline(
|
||||
$badge,
|
||||
|
@ -64,26 +62,47 @@ final class PhabricatorBadgesViewController
|
|||
|
||||
$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()
|
||||
->setTitle($title)
|
||||
->setCrumbs($crumbs)
|
||||
->setPageObjectPHIDs(array($badge->getPHID()))
|
||||
->appendChild(
|
||||
array(
|
||||
$box,
|
||||
$recipient_list,
|
||||
$timeline,
|
||||
$add_comment,
|
||||
$view,
|
||||
));
|
||||
}
|
||||
|
||||
private function buildPropertyListView(PhabricatorBadgesBadge $badge) {
|
||||
private function buildPropertyListView(
|
||||
PhabricatorBadgesBadge $badge) {
|
||||
$viewer = $this->getViewer();
|
||||
|
||||
$view = id(new PHUIPropertyListView())
|
||||
->setUser($viewer)
|
||||
->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());
|
||||
|
||||
$view->addProperty(
|
||||
|
@ -99,8 +118,6 @@ final class PhabricatorBadgesViewController
|
|||
pht('Flavor'),
|
||||
$badge->getFlavor());
|
||||
|
||||
$view->invokeWillRenderEvent();
|
||||
|
||||
$description = $badge->getDescription();
|
||||
if (strlen($description)) {
|
||||
$view->addSectionHeader(
|
||||
|
@ -160,9 +177,10 @@ final class PhabricatorBadgesViewController
|
|||
|
||||
$view->addAction(
|
||||
id(new PhabricatorActionView())
|
||||
->setName('Manage Recipients')
|
||||
->setName('Add Recipients')
|
||||
->setIcon('fa-users')
|
||||
->setDisabled(!$can_edit)
|
||||
->setWorkflow(true)
|
||||
->setHref($this->getApplicationURI("/recipients/{$id}/")));
|
||||
|
||||
return $view;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
final class PhabricatorBadgesRecipientsListView extends AphrontTagView {
|
||||
final class PhabricatorBadgesRecipientsListView extends AphrontView {
|
||||
|
||||
private $badge;
|
||||
private $handles;
|
||||
|
@ -15,7 +15,7 @@ final class PhabricatorBadgesRecipientsListView extends AphrontTagView {
|
|||
return $this;
|
||||
}
|
||||
|
||||
protected function getTagContent() {
|
||||
public function render() {
|
||||
|
||||
$viewer = $this->user;
|
||||
|
||||
|
|
|
@ -200,4 +200,10 @@
|
|||
|
||||
.phui-two-column-view .phui-two-column-content .phui-info-view {
|
||||
margin: 0 0 20px 0;
|
||||
padding: 16px;
|
||||
}
|
||||
|
||||
.phui-two-column-view .phui-two-column-content .phui-object-box
|
||||
.phui-info-view {
|
||||
margin: 0;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue