1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2025-03-03 16:09:17 +01:00

Use ActionListView for all profile actions

Summary:
This leaves the space between the properties and the blurb looking a bit empty, but there will be more stuff there soon (status, VCS names, email, phone/fax numbers, etc., and custom user fields).

I removed "view lint messages" since I'm pretty sure no one has ever clicked it. I think providing better search (e.g, T2625) to that UI in Diffusion is a preferable approach.

Test Plan: {F49423}

Reviewers: chad, btrahan

Reviewed By: chad

CC: aran

Differential Revision: https://secure.phabricator.com/D6403
This commit is contained in:
epriestley 2013-07-10 05:11:08 -07:00
parent 0125984226
commit 6a40df529d
13 changed files with 143 additions and 190 deletions

View file

@ -3029,7 +3029,7 @@ celerity_register_resource_map(array(
),
'phabricator-action-list-view-css' =>
array(
'uri' => '/res/f63afae7/rsrc/css/layout/phabricator-action-list-view.css',
'uri' => '/res/ef104683/rsrc/css/layout/phabricator-action-list-view.css',
'type' => 'css',
'requires' =>
array(
@ -4149,7 +4149,7 @@ celerity_register_resource_map(array(
), array(
'packages' =>
array(
'680ace9b' =>
'6e2d527c' =>
array(
'name' => 'core.pkg.css',
'symbols' =>
@ -4197,7 +4197,7 @@ celerity_register_resource_map(array(
40 => 'phabricator-property-list-view-css',
41 => 'phabricator-tag-view-css',
),
'uri' => '/res/pkg/680ace9b/core.pkg.css',
'uri' => '/res/pkg/6e2d527c/core.pkg.css',
'type' => 'css',
),
'75ccea43' =>
@ -4391,16 +4391,16 @@ celerity_register_resource_map(array(
'reverse' =>
array(
'aphront-attached-file-view-css' => 'adc3c36d',
'aphront-dialog-view-css' => '680ace9b',
'aphront-error-view-css' => '680ace9b',
'aphront-form-view-css' => '680ace9b',
'aphront-list-filter-view-css' => '680ace9b',
'aphront-pager-view-css' => '680ace9b',
'aphront-panel-view-css' => '680ace9b',
'aphront-table-view-css' => '680ace9b',
'aphront-tokenizer-control-css' => '680ace9b',
'aphront-tooltip-css' => '680ace9b',
'aphront-typeahead-control-css' => '680ace9b',
'aphront-dialog-view-css' => '6e2d527c',
'aphront-error-view-css' => '6e2d527c',
'aphront-form-view-css' => '6e2d527c',
'aphront-list-filter-view-css' => '6e2d527c',
'aphront-pager-view-css' => '6e2d527c',
'aphront-panel-view-css' => '6e2d527c',
'aphront-table-view-css' => '6e2d527c',
'aphront-tokenizer-control-css' => '6e2d527c',
'aphront-tooltip-css' => '6e2d527c',
'aphront-typeahead-control-css' => '6e2d527c',
'differential-changeset-view-css' => 'dd27a69b',
'differential-core-view-css' => 'dd27a69b',
'differential-inline-comment-editor' => '4ad86dee',
@ -4414,7 +4414,7 @@ celerity_register_resource_map(array(
'differential-table-of-contents-css' => 'dd27a69b',
'diffusion-commit-view-css' => 'c8ce2d88',
'diffusion-icons-css' => 'c8ce2d88',
'global-drag-and-drop-css' => '680ace9b',
'global-drag-and-drop-css' => '6e2d527c',
'inline-comment-summary-css' => 'dd27a69b',
'javelin-aphlict' => '75ccea43',
'javelin-behavior' => 'a9f14d76',
@ -4488,55 +4488,55 @@ celerity_register_resource_map(array(
'javelin-util' => 'a9f14d76',
'javelin-vector' => 'a9f14d76',
'javelin-workflow' => 'a9f14d76',
'lightbox-attachment-css' => '680ace9b',
'lightbox-attachment-css' => '6e2d527c',
'maniphest-task-summary-css' => 'adc3c36d',
'maniphest-transaction-detail-css' => 'adc3c36d',
'phabricator-action-list-view-css' => '680ace9b',
'phabricator-application-launch-view-css' => '680ace9b',
'phabricator-action-list-view-css' => '6e2d527c',
'phabricator-application-launch-view-css' => '6e2d527c',
'phabricator-busy' => '75ccea43',
'phabricator-content-source-view-css' => 'dd27a69b',
'phabricator-core-css' => '680ace9b',
'phabricator-crumbs-view-css' => '680ace9b',
'phabricator-core-css' => '6e2d527c',
'phabricator-crumbs-view-css' => '6e2d527c',
'phabricator-drag-and-drop-file-upload' => '4ad86dee',
'phabricator-dropdown-menu' => '75ccea43',
'phabricator-file-upload' => '75ccea43',
'phabricator-filetree-view-css' => '680ace9b',
'phabricator-flag-css' => '680ace9b',
'phabricator-form-view-css' => '680ace9b',
'phabricator-header-view-css' => '680ace9b',
'phabricator-filetree-view-css' => '6e2d527c',
'phabricator-flag-css' => '6e2d527c',
'phabricator-form-view-css' => '6e2d527c',
'phabricator-header-view-css' => '6e2d527c',
'phabricator-hovercard' => '75ccea43',
'phabricator-jump-nav' => '680ace9b',
'phabricator-jump-nav' => '6e2d527c',
'phabricator-keyboard-shortcut' => '75ccea43',
'phabricator-keyboard-shortcut-manager' => '75ccea43',
'phabricator-main-menu-view' => '680ace9b',
'phabricator-main-menu-view' => '6e2d527c',
'phabricator-menu-item' => '75ccea43',
'phabricator-nav-view-css' => '680ace9b',
'phabricator-nav-view-css' => '6e2d527c',
'phabricator-notification' => '75ccea43',
'phabricator-notification-css' => '680ace9b',
'phabricator-notification-menu-css' => '680ace9b',
'phabricator-object-item-list-view-css' => '680ace9b',
'phabricator-notification-css' => '6e2d527c',
'phabricator-notification-menu-css' => '6e2d527c',
'phabricator-object-item-list-view-css' => '6e2d527c',
'phabricator-object-selector-css' => 'dd27a69b',
'phabricator-phtize' => '75ccea43',
'phabricator-prefab' => '75ccea43',
'phabricator-project-tag-css' => 'adc3c36d',
'phabricator-property-list-view-css' => '680ace9b',
'phabricator-remarkup-css' => '680ace9b',
'phabricator-property-list-view-css' => '6e2d527c',
'phabricator-remarkup-css' => '6e2d527c',
'phabricator-shaped-request' => '4ad86dee',
'phabricator-side-menu-view-css' => '680ace9b',
'phabricator-standard-page-view' => '680ace9b',
'phabricator-tag-view-css' => '680ace9b',
'phabricator-side-menu-view-css' => '6e2d527c',
'phabricator-standard-page-view' => '6e2d527c',
'phabricator-tag-view-css' => '6e2d527c',
'phabricator-textareautils' => '75ccea43',
'phabricator-tooltip' => '75ccea43',
'phabricator-transaction-view-css' => '680ace9b',
'phabricator-zindex-css' => '680ace9b',
'phui-button-css' => '680ace9b',
'phui-form-css' => '680ace9b',
'phui-icon-view-css' => '680ace9b',
'phui-spacing-css' => '680ace9b',
'sprite-apps-large-css' => '680ace9b',
'sprite-gradient-css' => '680ace9b',
'sprite-icons-css' => '680ace9b',
'sprite-menu-css' => '680ace9b',
'syntax-highlighting-css' => '680ace9b',
'phabricator-transaction-view-css' => '6e2d527c',
'phabricator-zindex-css' => '6e2d527c',
'phui-button-css' => '6e2d527c',
'phui-form-css' => '6e2d527c',
'phui-icon-view-css' => '6e2d527c',
'phui-spacing-css' => '6e2d527c',
'sprite-apps-large-css' => '6e2d527c',
'sprite-gradient-css' => '6e2d527c',
'sprite-icons-css' => '6e2d527c',
'sprite-menu-css' => '6e2d527c',
'syntax-highlighting-css' => '6e2d527c',
),
));

View file

@ -484,7 +484,6 @@ phutil_register_library_map(array(
'DiffusionPathQuery' => 'applications/diffusion/query/DiffusionPathQuery.php',
'DiffusionPathQueryTestCase' => 'applications/diffusion/query/pathid/__tests__/DiffusionPathQueryTestCase.php',
'DiffusionPathValidateController' => 'applications/diffusion/controller/DiffusionPathValidateController.php',
'DiffusionPeopleMenuEventListener' => 'applications/diffusion/events/DiffusionPeopleMenuEventListener.php',
'DiffusionQuery' => 'applications/diffusion/query/DiffusionQuery.php',
'DiffusionRawDiffQuery' => 'applications/diffusion/query/rawdiff/DiffusionRawDiffQuery.php',
'DiffusionRemarkupRule' => 'applications/diffusion/remarkup/DiffusionRemarkupRule.php',
@ -2412,7 +2411,6 @@ phutil_register_library_map(array(
'DiffusionPathCompleteController' => 'DiffusionController',
'DiffusionPathQueryTestCase' => 'PhabricatorTestCase',
'DiffusionPathValidateController' => 'DiffusionController',
'DiffusionPeopleMenuEventListener' => 'PhutilEventListener',
'DiffusionQuery' => 'PhabricatorQuery',
'DiffusionRawDiffQuery' => 'DiffusionQuery',
'DiffusionRemarkupRule' => 'PhabricatorRemarkupRuleObject',

View file

@ -3,34 +3,34 @@
final class AuditPeopleMenuEventListener extends PhutilEventListener {
public function register() {
$this->listen(PhabricatorEventType::TYPE_PEOPLE_DIDRENDERMENU);
$this->listen(PhabricatorEventType::TYPE_UI_DIDRENDERACTIONS);
}
public function handleEvent(PhutilEvent $event) {
switch ($event->getType()) {
case PhabricatorEventType::TYPE_PEOPLE_DIDRENDERMENU:
$this->handleMenuEvent($event);
case PhabricatorEventType::TYPE_UI_DIDRENDERACTIONS:
$this->handleActionsEvent($event);
break;
}
}
private function handleMenuEvent($event) {
$viewer = $event->getUser();
$menu = $event->getValue('menu');
$person = $event->getValue('person');
private function handleActionsEvent($event) {
$person = $event->getValue('object');
if (!($person instanceof PhabricatorUser)) {
return;
}
$actions = $event->getValue('actions');
$username = phutil_escape_uri($person->getUsername());
$href = '/audit/view/author/'.$username.'/';
$name = pht('Commits');
$menu->addMenuItemToLabel('activity',
id(new PHUIListItemView())
->setIsExternal(true)
->setName($name)
->setHref($href)
->setKey($name));
$actions[] = id(new PhabricatorActionView())
->setIcon('transcript')
->setName(pht('View Commits'))
->setHref($href);
$event->setValue('menu', $menu);
$event->setValue('actions', $actions);
}
}

View file

@ -3,35 +3,34 @@
final class ConpherencePeopleMenuEventListener extends PhutilEventListener {
public function register() {
$this->listen(PhabricatorEventType::TYPE_PEOPLE_DIDRENDERMENU);
$this->listen(PhabricatorEventType::TYPE_UI_DIDRENDERACTIONS);
}
public function handleEvent(PhutilEvent $event) {
switch ($event->getType()) {
case PhabricatorEventType::TYPE_PEOPLE_DIDRENDERMENU:
$this->handleMenuEvent($event);
case PhabricatorEventType::TYPE_UI_DIDRENDERACTIONS:
$this->handleActionsEvent($event);
break;
}
}
private function handleMenuEvent($event) {
$viewer = $event->getUser();
$menu = $event->getValue('menu');
$person = $event->getValue('person');
private function handleActionsEvent($event) {
$person = $event->getValue('object');
if (!($person instanceof PhabricatorUser)) {
return;
}
$conpherence_uri =
new PhutilURI('/conpherence/new/?participant='.$person->getPHID());
$name = pht('Message');
$href = '/conpherence/new/?participant='.$person->getPHID();
$menu->addMenuItemBefore('activity',
id(new PHUIListItemView())
->setIsExternal(true)
->setName($name)
->setHref($conpherence_uri)
$actions = $event->getValue('actions');
$actions[] = id(new PhabricatorActionView())
->setIcon('message')
->setName(pht('Send Message'))
->setWorkflow(true)
->setKey($name));
->setHref($href);
$event->setValue('menu', $menu);
$event->setValue('actions', $actions);
}
}

View file

@ -3,34 +3,35 @@
final class DifferentialPeopleMenuEventListener extends PhutilEventListener {
public function register() {
$this->listen(PhabricatorEventType::TYPE_PEOPLE_DIDRENDERMENU);
$this->listen(PhabricatorEventType::TYPE_UI_DIDRENDERACTIONS);
}
public function handleEvent(PhutilEvent $event) {
switch ($event->getType()) {
case PhabricatorEventType::TYPE_PEOPLE_DIDRENDERMENU:
$this->handleMenuEvent($event);
case PhabricatorEventType::TYPE_UI_DIDRENDERACTIONS:
$this->handleActionsEvent($event);
break;
}
}
private function handleMenuEvent($event) {
$viewer = $event->getUser();
$menu = $event->getValue('menu');
$person = $event->getValue('person');
$username = phutil_escape_uri($person->getUserName());
private function handleActionsEvent($event) {
$person = $event->getValue('object');
if (!($person instanceof PhabricatorUser)) {
return;
}
$href = '/differential/filter/revisions/'.$username.'/';
$name = pht('Revisions');
$href = '/differential/?authorPHIDs[]='.$person->getPHID();
$menu->addMenuItemToLabel('activity',
id(new PHUIListItemView())
->setIsExternal(true)
->setHref($href)
->setName($name)
->setKey($name));
$actions = $event->getValue('actions');
$event->setValue('menu', $menu);
$actions[] = id(new PhabricatorActionView())
->setUser($event->getUser())
->setRenderAsForm(true)
->setIcon('transcript')
->setName(pht('View Revisions'))
->setHref($href);
$event->setValue('actions', $actions);
}
}

View file

@ -26,7 +26,6 @@ final class PhabricatorApplicationDiffusion extends PhabricatorApplication {
public function getEventListeners() {
return array(
new DiffusionPeopleMenuEventListener(),
new DiffusionHovercardEventListener(),
);
}

View file

@ -1,36 +0,0 @@
<?php
final class DiffusionPeopleMenuEventListener extends PhutilEventListener {
public function register() {
$this->listen(PhabricatorEventType::TYPE_PEOPLE_DIDRENDERMENU);
}
public function handleEvent(PhutilEvent $event) {
switch ($event->getType()) {
case PhabricatorEventType::TYPE_PEOPLE_DIDRENDERMENU:
$this->handleMenuEvent($event);
break;
}
}
private function handleMenuEvent($event) {
$viewer = $event->getUser();
$menu = $event->getValue('menu');
$person_phid = $event->getValue('person')->getPHID();
$href = '/diffusion/lint/?owner[0]='.$person_phid;
$name = pht('Lint Messages');
$menu->addMenuItemToLabel('activity',
id(new PHUIListItemView())
->setIsExternal(true)
->setHref($href)
->setName($name)
->setKey($name));
$event->setValue('menu', $menu);
}
}

View file

@ -24,6 +24,13 @@ final class PhabricatorFlagsUIEventListener extends PhutilEventListener {
return;
}
if (($object instanceof PhabricatorUser)) {
// Although there's no real reason not to let you flag users, it also
// makes less conceptual sense than flaging other types of objects. For
// now, don't allow it.
return;
}
$flag = PhabricatorFlagQuery::loadUserFlag($user, $object->getPHID());
if ($flag) {

View file

@ -3,33 +3,33 @@
final class ManiphestPeopleMenuEventListener extends PhutilEventListener {
public function register() {
$this->listen(PhabricatorEventType::TYPE_PEOPLE_DIDRENDERMENU);
$this->listen(PhabricatorEventType::TYPE_UI_DIDRENDERACTIONS);
}
public function handleEvent(PhutilEvent $event) {
switch ($event->getType()) {
case PhabricatorEventType::TYPE_PEOPLE_DIDRENDERMENU:
$this->handleMenuEvent($event);
case PhabricatorEventType::TYPE_UI_DIDRENDERACTIONS:
$this->handleActionsEvent($event);
break;
}
}
private function handleMenuEvent($event) {
$viewer = $event->getUser();
$menu = $event->getValue('menu');
$person_phid = $event->getValue('person')->getPHID();
private function handleActionsEvent($event) {
$person = $event->getValue('object');
if (!($person instanceof PhabricatorUser)) {
return;
}
$href = '/maniphest/view/action/?users='.$person_phid;
$name = pht('Tasks');
$href = '/maniphest/view/action/?users='.$person->getPHID();
$menu->addMenuItemToLabel('activity',
id(new PHUIListItemView())
->setIsExternal(true)
->setHref($href)
->setName($name)
->setKey($name));
$actions = $event->getValue('actions');
$event->setValue('menu', $menu);
$actions[] = id(new PhabricatorActionView())
->setIcon('transcript')
->setName(pht('View Tasks'))
->setHref($href);
$event->setValue('actions', $actions);
}
}

View file

@ -49,7 +49,7 @@ final class PhabricatorApplicationPeople extends PhabricatorApplication {
'picture/(?P<id>[1-9]\d*)/' =>
'PhabricatorPeopleProfilePictureController',
),
'/p/(?P<username>[\w._-]+)/(?:(?P<page>\w+)/)?'
'/p/(?P<username>[\w._-]+)/'
=> 'PhabricatorPeopleProfileController',
'/emailverify/(?P<code>[^/]+)/' =>
'PhabricatorEmailVerificationController',

View file

@ -4,7 +4,6 @@ final class PhabricatorPeopleProfileController
extends PhabricatorPeopleController {
private $username;
private $page;
public function shouldRequireAdmin() {
return false;
@ -12,17 +11,6 @@ final class PhabricatorPeopleProfileController
public function willProcessRequest(array $data) {
$this->username = idx($data, 'username');
$this->page = idx($data, 'page');
}
private function getMainFilters($username) {
return array(
array(
'key' => 'feed',
'name' => pht('Feed'),
'href' => '/p/'.$username.'/feed/'
),
);
}
public function processRequest() {
@ -41,26 +29,6 @@ final class PhabricatorPeopleProfileController
$profile = $user->loadUserProfile();
$username = phutil_escape_uri($user->getUserName());
$menu = new PHUIListView();
foreach ($this->getMainFilters($username) as $filter) {
$menu->newLink($filter['name'], $filter['href'], $filter['key']);
}
$menu->newLabel(pht('Activity'), 'activity');
// NOTE: applications install the various links through PhabricatorEvent
// listeners
$event = new PhabricatorEvent(
PhabricatorEventType::TYPE_PEOPLE_DIDRENDERMENU,
array(
'menu' => $menu,
'person' => $user,
));
$event->setUser($viewer);
PhutilEventEngine::dispatchEvent($event);
$nav = AphrontSideNavFilterView::newFromMenu($event->getValue('menu'));
$nav->selectFilter($this->page, 'feed');
$picture = $user->loadProfileImageURI();
$header = id(new PhabricatorHeaderView())
@ -104,6 +72,7 @@ final class PhabricatorPeopleProfileController
}
$actions = id(new PhabricatorActionListView())
->setObject($user)
->setUser($viewer);
$can_edit = ($user->getPHID() == $viewer->getPHID());
@ -134,13 +103,20 @@ final class PhabricatorPeopleProfileController
$properties = $this->buildPropertyView($user);
$nav->appendChild($header);
$nav->appendChild($actions);
$nav->appendChild($properties);
$nav->appendChild($this->renderUserFeed($user));
$crumbs = $this->buildApplicationCrumbs();
$crumbs->addCrumb(
id(new PhabricatorCrumbView())
->setName($user->getUsername()));
$feed = $this->renderUserFeed($user);
return $this->buildApplicationPage(
$nav,
array(
$crumbs,
$header,
$actions,
$properties,
$feed,
),
array(
'title' => $user->getUsername(),
'device' => true,

View file

@ -36,6 +36,9 @@ final class PhabricatorHeaderView extends AphrontView {
public function render() {
require_celerity_resource('phabricator-header-view-css');
$classes = array();
$classes[] = 'phabricator-header-shell';
$image = null;
if ($this->image) {
$image = phutil_tag(
@ -45,6 +48,7 @@ final class PhabricatorHeaderView extends AphrontView {
'style' => 'background-image: url('.$this->image.')',
),
'');
$classes[] = 'phabricator-header-has-image';
}
$header = array();
@ -84,7 +88,7 @@ final class PhabricatorHeaderView extends AphrontView {
return phutil_tag(
'div',
array(
'class' => 'phabricator-header-shell',
'class' => implode(' ', $classes),
),
array(
$image,

View file

@ -21,7 +21,12 @@
}
.device-desktop .phabricator-header-shell + .phabricator-action-list-view {
margin-top: -28px;
margin-top: -33px;
}
.device-desktop .phabricator-header-shell.phabricator-header-has-image +
.phabricator-action-list-view {
margin-top: -53px;
}
.device .phabricator-header-shell + .phabricator-action-list-view {