diff --git a/resources/celerity/map.php b/resources/celerity/map.php index 2f74d82db8..4aa7284757 100644 --- a/resources/celerity/map.php +++ b/resources/celerity/map.php @@ -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', diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index 8d634c1c86..32a5f5cdf1 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -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', diff --git a/src/applications/badges/controller/PhabricatorBadgesEditRecipientsController.php b/src/applications/badges/controller/PhabricatorBadgesEditRecipientsController.php index 872b715e5b..70e3d8f029 100644 --- a/src/applications/badges/controller/PhabricatorBadgesEditRecipientsController.php +++ b/src/applications/badges/controller/PhabricatorBadgesEditRecipientsController.php @@ -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; } } diff --git a/src/applications/badges/controller/PhabricatorBadgesRemoveRecipientsController.php b/src/applications/badges/controller/PhabricatorBadgesRemoveRecipientsController.php index 0282854790..bc467b703d 100644 --- a/src/applications/badges/controller/PhabricatorBadgesRemoveRecipientsController.php +++ b/src/applications/badges/controller/PhabricatorBadgesRemoveRecipientsController.php @@ -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; diff --git a/src/applications/badges/controller/PhabricatorBadgesViewController.php b/src/applications/badges/controller/PhabricatorBadgesViewController.php index 81241edd9f..3858965d41 100644 --- a/src/applications/badges/controller/PhabricatorBadgesViewController.php +++ b/src/applications/badges/controller/PhabricatorBadgesViewController.php @@ -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; diff --git a/src/applications/badges/view/PhabricatorBadgesRecipientsListView.php b/src/applications/badges/view/PhabricatorBadgesRecipientsListView.php index 30d883bb57..6b633bed5b 100644 --- a/src/applications/badges/view/PhabricatorBadgesRecipientsListView.php +++ b/src/applications/badges/view/PhabricatorBadgesRecipientsListView.php @@ -1,6 +1,6 @@ user; diff --git a/webroot/rsrc/css/phui/phui-two-column-view.css b/webroot/rsrc/css/phui/phui-two-column-view.css index d0dd4eebdf..d6f87c3828 100644 --- a/webroot/rsrc/css/phui/phui-two-column-view.css +++ b/webroot/rsrc/css/phui/phui-two-column-view.css @@ -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; }