mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-10 08:52:39 +01:00
Revamp Profile with new IconNav
Summary: Revamps Profile to be like Projects, a mini portal and side nav with icons. Test Plan: Viewed my own profile, as well as others. Test seeing my commits, tasks, diffs, and upcoming events. Checked mobile navigation. Reviewers: btrahan, epriestley Reviewed By: epriestley Subscribers: Korvin, epriestley Differential Revision: https://secure.phabricator.com/D11547
This commit is contained in:
parent
7982b23eb4
commit
8f1e0c0262
17 changed files with 179 additions and 344 deletions
|
@ -94,7 +94,7 @@ return array(
|
|||
'rsrc/css/application/ponder/feed.css' => 'e62615b6',
|
||||
'rsrc/css/application/ponder/post.css' => 'ebab8a70',
|
||||
'rsrc/css/application/ponder/vote.css' => '8ed6ed8b',
|
||||
'rsrc/css/application/profile/profile-view.css' => 'fddedfa1',
|
||||
'rsrc/css/application/profile/profile-view.css' => 'b4896815',
|
||||
'rsrc/css/application/projects/project-icon.css' => 'c2ecb7f1',
|
||||
'rsrc/css/application/releeph/releeph-core.css' => '9b3c5733',
|
||||
'rsrc/css/application/releeph/releeph-preview-branch.css' => 'b7a6f4a5',
|
||||
|
@ -731,7 +731,7 @@ return array(
|
|||
'phabricator-object-selector-css' => '029a133d',
|
||||
'phabricator-phtize' => 'd254d646',
|
||||
'phabricator-prefab' => '72da38cc',
|
||||
'phabricator-profile-css' => 'fddedfa1',
|
||||
'phabricator-profile-css' => 'b4896815',
|
||||
'phabricator-remarkup-css' => '0ee3d256',
|
||||
'phabricator-search-results-css' => 'f240504c',
|
||||
'phabricator-shaped-request' => '7cbe244b',
|
||||
|
|
|
@ -177,7 +177,6 @@ phutil_register_library_map(array(
|
|||
'AphrontWebpageResponse' => 'aphront/response/AphrontWebpageResponse.php',
|
||||
'ArcanistConduitAPIMethod' => 'applications/arcanist/conduit/ArcanistConduitAPIMethod.php',
|
||||
'ArcanistProjectInfoConduitAPIMethod' => 'applications/arcanist/conduit/ArcanistProjectInfoConduitAPIMethod.php',
|
||||
'AuditActionMenuEventListener' => 'applications/audit/events/AuditActionMenuEventListener.php',
|
||||
'AuditConduitAPIMethod' => 'applications/audit/conduit/AuditConduitAPIMethod.php',
|
||||
'AuditQueryConduitAPIMethod' => 'applications/audit/conduit/AuditQueryConduitAPIMethod.php',
|
||||
'AuthManageProvidersCapability' => 'applications/auth/capability/AuthManageProvidersCapability.php',
|
||||
|
@ -222,7 +221,6 @@ phutil_register_library_map(array(
|
|||
'ConduitQueryConduitAPIMethod' => 'applications/conduit/method/ConduitQueryConduitAPIMethod.php',
|
||||
'ConduitSSHWorkflow' => 'applications/conduit/ssh/ConduitSSHWorkflow.php',
|
||||
'ConduitTokenGarbageCollector' => 'applications/conduit/garbagecollector/ConduitTokenGarbageCollector.php',
|
||||
'ConpherenceActionMenuEventListener' => 'applications/conpherence/events/ConpherenceActionMenuEventListener.php',
|
||||
'ConpherenceConduitAPIMethod' => 'applications/conpherence/conduit/ConpherenceConduitAPIMethod.php',
|
||||
'ConpherenceConfigOptions' => 'applications/conpherence/config/ConpherenceConfigOptions.php',
|
||||
'ConpherenceConstants' => 'applications/conpherence/constants/ConpherenceConstants.php',
|
||||
|
@ -990,7 +988,6 @@ phutil_register_library_map(array(
|
|||
'MacroConduitAPIMethod' => 'applications/macro/conduit/MacroConduitAPIMethod.php',
|
||||
'MacroCreateMemeConduitAPIMethod' => 'applications/macro/conduit/MacroCreateMemeConduitAPIMethod.php',
|
||||
'MacroQueryConduitAPIMethod' => 'applications/macro/conduit/MacroQueryConduitAPIMethod.php',
|
||||
'ManiphestActionMenuEventListener' => 'applications/maniphest/event/ManiphestActionMenuEventListener.php',
|
||||
'ManiphestBatchEditController' => 'applications/maniphest/controller/ManiphestBatchEditController.php',
|
||||
'ManiphestBulkEditCapability' => 'applications/maniphest/capability/ManiphestBulkEditCapability.php',
|
||||
'ManiphestConduitAPIMethod' => 'applications/maniphest/conduit/ManiphestConduitAPIMethod.php',
|
||||
|
@ -2124,6 +2121,7 @@ phutil_register_library_map(array(
|
|||
'PhabricatorPeopleDisableController' => 'applications/people/controller/PhabricatorPeopleDisableController.php',
|
||||
'PhabricatorPeopleEmpowerController' => 'applications/people/controller/PhabricatorPeopleEmpowerController.php',
|
||||
'PhabricatorPeopleExternalPHIDType' => 'applications/people/phid/PhabricatorPeopleExternalPHIDType.php',
|
||||
'PhabricatorPeopleFeedController' => 'applications/people/controller/PhabricatorPeopleFeedController.php',
|
||||
'PhabricatorPeopleHovercardEventListener' => 'applications/people/event/PhabricatorPeopleHovercardEventListener.php',
|
||||
'PhabricatorPeopleLdapController' => 'applications/people/controller/PhabricatorPeopleLdapController.php',
|
||||
'PhabricatorPeopleListController' => 'applications/people/controller/PhabricatorPeopleListController.php',
|
||||
|
@ -3299,7 +3297,6 @@ phutil_register_library_map(array(
|
|||
'AphrontWebpageResponse' => 'AphrontHTMLResponse',
|
||||
'ArcanistConduitAPIMethod' => 'ConduitAPIMethod',
|
||||
'ArcanistProjectInfoConduitAPIMethod' => 'ArcanistConduitAPIMethod',
|
||||
'AuditActionMenuEventListener' => 'PhabricatorEventListener',
|
||||
'AuditConduitAPIMethod' => 'ConduitAPIMethod',
|
||||
'AuditQueryConduitAPIMethod' => 'AuditConduitAPIMethod',
|
||||
'AuthManageProvidersCapability' => 'PhabricatorPolicyCapability',
|
||||
|
@ -3335,7 +3332,6 @@ phutil_register_library_map(array(
|
|||
'ConduitQueryConduitAPIMethod' => 'ConduitAPIMethod',
|
||||
'ConduitSSHWorkflow' => 'PhabricatorSSHWorkflow',
|
||||
'ConduitTokenGarbageCollector' => 'PhabricatorGarbageCollector',
|
||||
'ConpherenceActionMenuEventListener' => 'PhabricatorEventListener',
|
||||
'ConpherenceConduitAPIMethod' => 'ConduitAPIMethod',
|
||||
'ConpherenceConfigOptions' => 'PhabricatorApplicationConfigOptions',
|
||||
'ConpherenceController' => 'PhabricatorController',
|
||||
|
@ -4165,7 +4161,6 @@ phutil_register_library_map(array(
|
|||
'MacroConduitAPIMethod' => 'ConduitAPIMethod',
|
||||
'MacroCreateMemeConduitAPIMethod' => 'MacroConduitAPIMethod',
|
||||
'MacroQueryConduitAPIMethod' => 'MacroConduitAPIMethod',
|
||||
'ManiphestActionMenuEventListener' => 'PhabricatorEventListener',
|
||||
'ManiphestBatchEditController' => 'ManiphestController',
|
||||
'ManiphestBulkEditCapability' => 'PhabricatorPolicyCapability',
|
||||
'ManiphestConduitAPIMethod' => 'ConduitAPIMethod',
|
||||
|
@ -4362,7 +4357,7 @@ phutil_register_library_map(array(
|
|||
'PHUIObjectItemListExample' => 'PhabricatorUIExample',
|
||||
'PHUIObjectItemListView' => 'AphrontTagView',
|
||||
'PHUIObjectItemView' => 'AphrontTagView',
|
||||
'PHUIPagedFormView' => 'AphrontTagView',
|
||||
'PHUIPagedFormView' => 'AphrontView',
|
||||
'PHUIPinboardItemView' => 'AphrontView',
|
||||
'PHUIPinboardView' => 'AphrontView',
|
||||
'PHUIPropertyGroupView' => 'AphrontTagView',
|
||||
|
@ -5375,6 +5370,7 @@ phutil_register_library_map(array(
|
|||
'PhabricatorPeopleDisableController' => 'PhabricatorPeopleController',
|
||||
'PhabricatorPeopleEmpowerController' => 'PhabricatorPeopleController',
|
||||
'PhabricatorPeopleExternalPHIDType' => 'PhabricatorPHIDType',
|
||||
'PhabricatorPeopleFeedController' => 'PhabricatorPeopleController',
|
||||
'PhabricatorPeopleHovercardEventListener' => 'PhabricatorEventListener',
|
||||
'PhabricatorPeopleLdapController' => 'PhabricatorPeopleController',
|
||||
'PhabricatorPeopleListController' => 'PhabricatorPeopleController',
|
||||
|
|
|
@ -26,12 +26,6 @@ final class PhabricatorAuditApplication extends PhabricatorApplication {
|
|||
return PhabricatorEnv::getDoclink('Audit User Guide');
|
||||
}
|
||||
|
||||
public function getEventListeners() {
|
||||
return array(
|
||||
new AuditActionMenuEventListener(),
|
||||
);
|
||||
}
|
||||
|
||||
public function getRoutes() {
|
||||
return array(
|
||||
'/audit/' => array(
|
||||
|
|
|
@ -1,44 +0,0 @@
|
|||
<?php
|
||||
|
||||
final class AuditActionMenuEventListener extends PhabricatorEventListener {
|
||||
|
||||
public function register() {
|
||||
$this->listen(PhabricatorEventType::TYPE_UI_DIDRENDERACTIONS);
|
||||
}
|
||||
|
||||
public function handleEvent(PhutilEvent $event) {
|
||||
switch ($event->getType()) {
|
||||
case PhabricatorEventType::TYPE_UI_DIDRENDERACTIONS:
|
||||
$this->handleActionsEvent($event);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private function handleActionsEvent(PhutilEvent $event) {
|
||||
$object = $event->getValue('object');
|
||||
|
||||
$actions = null;
|
||||
if ($object instanceof PhabricatorUser) {
|
||||
$actions = $this->renderUserItems($event);
|
||||
}
|
||||
|
||||
$this->addActionMenuItems($event, $actions);
|
||||
}
|
||||
|
||||
private function renderUserItems(PhutilEvent $event) {
|
||||
if (!$this->canUseApplication($event->getUser())) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$user = $event->getValue('object');
|
||||
|
||||
$username = phutil_escape_uri($user->getUsername());
|
||||
$view_uri = '/audit/?authors='.$username;
|
||||
|
||||
return id(new PhabricatorActionView())
|
||||
->setIcon('fa-check-circle-o')
|
||||
->setName(pht('View Commits'))
|
||||
->setHref($view_uri);
|
||||
}
|
||||
|
||||
}
|
|
@ -24,7 +24,6 @@ final class PhabricatorConpherenceApplication extends PhabricatorApplication {
|
|||
|
||||
public function getEventListeners() {
|
||||
return array(
|
||||
new ConpherenceActionMenuEventListener(),
|
||||
new ConpherenceHovercardEventListener(),
|
||||
);
|
||||
}
|
||||
|
|
|
@ -1,44 +0,0 @@
|
|||
<?php
|
||||
|
||||
final class ConpherenceActionMenuEventListener
|
||||
extends PhabricatorEventListener {
|
||||
|
||||
public function register() {
|
||||
$this->listen(PhabricatorEventType::TYPE_UI_DIDRENDERACTIONS);
|
||||
}
|
||||
|
||||
public function handleEvent(PhutilEvent $event) {
|
||||
switch ($event->getType()) {
|
||||
case PhabricatorEventType::TYPE_UI_DIDRENDERACTIONS:
|
||||
$this->handleActionsEvent($event);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private function handleActionsEvent(PhutilEvent $event) {
|
||||
$object = $event->getValue('object');
|
||||
|
||||
$actions = null;
|
||||
if ($object instanceof PhabricatorUser) {
|
||||
$actions = $this->renderUserItems($event);
|
||||
}
|
||||
|
||||
$this->addActionMenuItems($event, $actions);
|
||||
}
|
||||
|
||||
private function renderUserItems(PhutilEvent $event) {
|
||||
if (!$this->canUseApplication($event->getUser())) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$user = $event->getValue('object');
|
||||
$href = '/conpherence/new/?participant='.$user->getPHID();
|
||||
|
||||
return id(new PhabricatorActionView())
|
||||
->setIcon('fa-envelope')
|
||||
->setName(pht('Send Message'))
|
||||
->setWorkflow(true)
|
||||
->setHref($href);
|
||||
}
|
||||
|
||||
}
|
|
@ -19,27 +19,11 @@ final class DifferentialActionMenuEventListener
|
|||
$object = $event->getValue('object');
|
||||
|
||||
$actions = null;
|
||||
if ($object instanceof PhabricatorUser) {
|
||||
$actions = $this->renderUserItems($event);
|
||||
} else if ($object instanceof ManiphestTask) {
|
||||
if ($object instanceof ManiphestTask) {
|
||||
$actions = $this->renderTaskItems($event);
|
||||
$this->addActionMenuItems($event, $actions);
|
||||
}
|
||||
|
||||
$this->addActionMenuItems($event, $actions);
|
||||
}
|
||||
|
||||
private function renderUserItems(PhutilEvent $event) {
|
||||
if (!$this->canUseApplication($event->getUser())) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$person = $event->getValue('object');
|
||||
$href = '/differential/?authors='.$person->getUsername();
|
||||
|
||||
return id(new PhabricatorActionView())
|
||||
->setIcon('fa-cog')
|
||||
->setName(pht('View Revisions'))
|
||||
->setHref($href);
|
||||
}
|
||||
|
||||
private function renderTaskItems(PhutilEvent $event) {
|
||||
|
|
|
@ -39,7 +39,6 @@ final class PhabricatorManiphestApplication extends PhabricatorApplication {
|
|||
public function getEventListeners() {
|
||||
return array(
|
||||
new ManiphestNameIndexEventListener(),
|
||||
new ManiphestActionMenuEventListener(),
|
||||
new ManiphestHovercardEventListener(),
|
||||
);
|
||||
}
|
||||
|
|
|
@ -1,46 +0,0 @@
|
|||
<?php
|
||||
|
||||
final class ManiphestActionMenuEventListener extends PhabricatorEventListener {
|
||||
|
||||
public function register() {
|
||||
$this->listen(PhabricatorEventType::TYPE_UI_DIDRENDERACTIONS);
|
||||
}
|
||||
|
||||
public function handleEvent(PhutilEvent $event) {
|
||||
switch ($event->getType()) {
|
||||
case PhabricatorEventType::TYPE_UI_DIDRENDERACTIONS:
|
||||
$this->handleActionsEvent($event);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private function handleActionsEvent(PhutilEvent $event) {
|
||||
$object = $event->getValue('object');
|
||||
|
||||
$actions = null;
|
||||
if ($object instanceof PhabricatorUser) {
|
||||
$actions = $this->renderUserItems($event);
|
||||
}
|
||||
|
||||
$this->addActionMenuItems($event, $actions);
|
||||
}
|
||||
|
||||
private function renderUserItems(PhutilEvent $event) {
|
||||
if (!$this->canUseApplication($event->getUser())) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$user = $event->getValue('object');
|
||||
$phid = $user->getPHID();
|
||||
$view_uri = sprintf(
|
||||
'/maniphest/?statuses=%s&assigned=%s#R',
|
||||
implode(',', ManiphestTaskStatus::getOpenStatusConstants()),
|
||||
$phid);
|
||||
|
||||
return id(new PhabricatorActionView())
|
||||
->setIcon('fa-anchor')
|
||||
->setName(pht('View Tasks'))
|
||||
->setHref($view_uri);
|
||||
}
|
||||
|
||||
}
|
|
@ -62,11 +62,13 @@ final class PhabricatorPeopleApplication extends PhabricatorApplication {
|
|||
'PhabricatorPeopleProfileEditController',
|
||||
'picture/(?P<id>[1-9]\d*)/' =>
|
||||
'PhabricatorPeopleProfilePictureController',
|
||||
),
|
||||
),
|
||||
'/p/(?P<username>[\w._-]+)/'
|
||||
=> 'PhabricatorPeopleProfileController',
|
||||
'/p/(?P<username>[\w._-]+)/calendar/'
|
||||
=> 'PhabricatorPeopleCalendarController',
|
||||
'/p/(?P<username>[\w._-]+)/feed/'
|
||||
=> 'PhabricatorPeopleFeedController',
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -73,17 +73,15 @@ final class PhabricatorPeopleCalendarController
|
|||
$month_view->addEvent($event);
|
||||
}
|
||||
|
||||
$date = new DateTime("{$year}-{$month}-01");
|
||||
$crumbs = $this->buildApplicationCrumbs();
|
||||
$crumbs->addTextCrumb(
|
||||
$user->getUsername(),
|
||||
'/p/'.$user->getUsername().'/');
|
||||
$crumbs->addTextCrumb($date->format('F Y'));
|
||||
$name = $user->getUsername();
|
||||
|
||||
$nav = $this->buildIconNavView($user);
|
||||
$nav->selectFilter("{$name}/calendar/");
|
||||
$nav->appendChild($month_view);
|
||||
|
||||
return $this->buildApplicationPage(
|
||||
array(
|
||||
$crumbs,
|
||||
$month_view,
|
||||
$nav,
|
||||
),
|
||||
array(
|
||||
'title' => pht('Calendar'),
|
||||
|
|
|
@ -6,47 +6,93 @@ abstract class PhabricatorPeopleController extends PhabricatorController {
|
|||
return true;
|
||||
}
|
||||
|
||||
public function buildSideNavView() {
|
||||
public function buildSideNavView($for_app = false) {
|
||||
$nav = new AphrontSideNavFilterView();
|
||||
$nav->setBaseURI(new PhutilURI($this->getApplicationURI()));
|
||||
|
||||
$viewer = $this->getRequest()->getUser();
|
||||
|
||||
id(new PhabricatorPeopleSearchEngine())
|
||||
->setViewer($viewer)
|
||||
->addNavigationItems($nav->getMenu());
|
||||
|
||||
if ($viewer->getIsAdmin()) {
|
||||
$nav->addLabel(pht('User Administration'));
|
||||
if (PhabricatorLDAPAuthProvider::getLDAPProvider()) {
|
||||
$nav->addFilter('ldap', pht('Import from LDAP'));
|
||||
$name = null;
|
||||
if ($for_app) {
|
||||
$name = $this->getRequest()->getURIData('username');
|
||||
if ($name) {
|
||||
$nav->setBaseURI(new PhutilURI('/p/'));
|
||||
$nav->addFilter("{$name}/", $name);
|
||||
$nav->addFilter("feed/{$name}/", pht('Feed'));
|
||||
$nav->addFilter("calendar/{$name}/", pht('Calendar'));
|
||||
}
|
||||
}
|
||||
|
||||
$nav->addFilter('logs', pht('Activity Logs'));
|
||||
if (!$name) {
|
||||
$viewer = $this->getRequest()->getUser();
|
||||
id(new PhabricatorPeopleSearchEngine())
|
||||
->setViewer($viewer)
|
||||
->addNavigationItems($nav->getMenu());
|
||||
|
||||
if ($viewer->getIsAdmin()) {
|
||||
$nav->addLabel(pht('User Administration'));
|
||||
if (PhabricatorLDAPAuthProvider::getLDAPProvider()) {
|
||||
$nav->addFilter('ldap', pht('Import from LDAP'));
|
||||
}
|
||||
|
||||
$nav->addFilter('logs', pht('Activity Logs'));
|
||||
}
|
||||
}
|
||||
|
||||
return $nav;
|
||||
}
|
||||
|
||||
public function buildApplicationMenu() {
|
||||
return $this->buildSideNavView()->getMenu();
|
||||
return $this->buildSideNavView(true)->getMenu();
|
||||
}
|
||||
|
||||
protected function buildApplicationCrumbs() {
|
||||
$crumbs = parent::buildApplicationCrumbs();
|
||||
return parent::buildApplicationCrumbs();
|
||||
}
|
||||
|
||||
$viewer = $this->getRequest()->getUser();
|
||||
public function buildIconNavView(PhabricatorUser $user) {
|
||||
$viewer = $this->getViewer();
|
||||
$picture = $user->getProfileImageURI();
|
||||
$name = $user->getUsername();
|
||||
|
||||
$can_create = $this->hasApplicationCapability(
|
||||
PeopleCreateUsersCapability::CAPABILITY);
|
||||
$crumbs->addAction(
|
||||
id(new PHUIListItemView())
|
||||
->setName(pht('Create New User'))
|
||||
->setHref($this->getApplicationURI('create/'))
|
||||
->setDisabled(!$can_create)
|
||||
->setIcon('fa-plus-square'));
|
||||
$nav = new AphrontSideNavFilterView();
|
||||
$nav->setIconNav(true);
|
||||
$nav->setBaseURI(new PhutilURI('/p/'));
|
||||
$nav->addIcon("{$name}/", $name, null, $picture);
|
||||
$nav->addIcon("{$name}/feed/", pht('Feed'), 'fa-newspaper-o');
|
||||
|
||||
return $crumbs;
|
||||
$class = 'PhabricatorCalendarApplication';
|
||||
if (PhabricatorApplication::isClassInstalledForViewer($class, $viewer)) {
|
||||
$nav->addIcon(
|
||||
"{$name}/calendar/", pht('Calendar'), 'fa-calendar');
|
||||
}
|
||||
|
||||
$class = 'PhabricatorManiphestApplication';
|
||||
if (PhabricatorApplication::isClassInstalledForViewer($class, $viewer)) {
|
||||
$phid = $user->getPHID();
|
||||
$view_uri = sprintf(
|
||||
'/maniphest/?statuses=%s&assigned=%s#R',
|
||||
implode(',', ManiphestTaskStatus::getOpenStatusConstants()),
|
||||
$phid);
|
||||
$nav->addIcon(
|
||||
'maniphest', pht('Open Tasks'), 'fa-anchor', null, $view_uri);
|
||||
}
|
||||
|
||||
$class = 'PhabricatorDifferentialApplication';
|
||||
if (PhabricatorApplication::isClassInstalledForViewer($class, $viewer)) {
|
||||
$username = phutil_escape_uri($name);
|
||||
$view_uri = '/differential/?authors='.$username;
|
||||
$nav->addIcon(
|
||||
'differential', pht('Revisions'), 'fa-cog', null, $view_uri);
|
||||
}
|
||||
|
||||
$class = 'PhabricatorAuditApplication';
|
||||
if (PhabricatorApplication::isClassInstalledForViewer($class, $viewer)) {
|
||||
$username = phutil_escape_uri($name);
|
||||
$view_uri = '/audit/?authors='.$username;
|
||||
$nav->addIcon(
|
||||
'audit', pht('Commits'), 'fa-code', null, $view_uri);
|
||||
}
|
||||
|
||||
return $nav;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,60 @@
|
|||
<?php
|
||||
|
||||
final class PhabricatorPeopleFeedController
|
||||
extends PhabricatorPeopleController {
|
||||
|
||||
private $username;
|
||||
|
||||
public function shouldRequireAdmin() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public function willProcessRequest(array $data) {
|
||||
$this->username = idx($data, 'username');
|
||||
}
|
||||
|
||||
public function processRequest() {
|
||||
require_celerity_resource('phabricator-profile-css');
|
||||
$viewer = $this->getRequest()->getUser();
|
||||
$user = id(new PhabricatorPeopleQuery())
|
||||
->setViewer($viewer)
|
||||
->withUsernames(array($this->username))
|
||||
->needProfileImage(true)
|
||||
->executeOne();
|
||||
|
||||
if (!$user) {
|
||||
return new Aphront404Response();
|
||||
}
|
||||
|
||||
$query = new PhabricatorFeedQuery();
|
||||
$query->setFilterPHIDs(
|
||||
array(
|
||||
$user->getPHID(),
|
||||
));
|
||||
$query->setLimit(100);
|
||||
$query->setViewer($viewer);
|
||||
$stories = $query->execute();
|
||||
|
||||
$builder = new PhabricatorFeedBuilder($stories);
|
||||
$builder->setUser($viewer);
|
||||
$builder->setShowHovercards(true);
|
||||
$view = $builder->buildView();
|
||||
|
||||
$feed = phutil_tag_div(
|
||||
'phabricator-project-feed',
|
||||
$view->render());
|
||||
$name = $user->getUsername();
|
||||
|
||||
$nav = $this->buildIconNavView($user);
|
||||
$nav->selectFilter("{$name}/feed/");
|
||||
$nav->appendChild($feed);
|
||||
|
||||
return $this->buildApplicationPage(
|
||||
array(
|
||||
$nav,
|
||||
),
|
||||
array(
|
||||
'title' => pht('Feed'),
|
||||
));
|
||||
}
|
||||
}
|
|
@ -128,40 +128,37 @@ final class PhabricatorPeopleProfileController
|
|||
}
|
||||
|
||||
$properties = $this->buildPropertyView($user, $actions);
|
||||
$name = $user->getUsername();
|
||||
|
||||
$crumbs = $this->buildApplicationCrumbs();
|
||||
$crumbs->addTextCrumb($user->getUsername());
|
||||
$crumbs->addTextCrumb($name);
|
||||
|
||||
$feed = $this->renderUserFeed($user);
|
||||
$cal_class = 'PhabricatorCalendarApplication';
|
||||
$classes = array();
|
||||
$classes[] = 'profile-activity-view';
|
||||
if (PhabricatorApplication::isClassInstalledForViewer($cal_class, $user)) {
|
||||
$calendar = $this->renderUserCalendar($user);
|
||||
$classes[] = 'profile-has-calendar';
|
||||
$classes[] = 'grouped';
|
||||
} else {
|
||||
$calendar = null;
|
||||
$class = 'PhabricatorManiphestApplication';
|
||||
if (PhabricatorApplication::isClassInstalledForViewer($class, $viewer)) {
|
||||
$href = '/conpherence/new/?participant='.$user->getPHID();
|
||||
$image = id(new PHUIIconView())
|
||||
->setIconFont('fa-comments');
|
||||
$button = id(new PHUIButtonView())
|
||||
->setTag('a')
|
||||
->setColor(PHUIButtonView::SIMPLE)
|
||||
->setIcon($image)
|
||||
->setHref($href)
|
||||
->setText(pht('Send Message'))
|
||||
->setWorkflow(true);
|
||||
$header->addActionLink($button);
|
||||
}
|
||||
$activity = phutil_tag(
|
||||
'div',
|
||||
array(
|
||||
'class' => implode($classes, ' '),
|
||||
),
|
||||
array(
|
||||
$calendar,
|
||||
$feed,
|
||||
));
|
||||
|
||||
$object_box = id(new PHUIObjectBoxView())
|
||||
->setHeader($header)
|
||||
->addPropertyList($properties);
|
||||
|
||||
$nav = $this->buildIconNavView($user);
|
||||
$nav->selectFilter("{$name}/");
|
||||
$nav->appendChild($object_box);
|
||||
|
||||
return $this->buildApplicationPage(
|
||||
array(
|
||||
$crumbs,
|
||||
$object_box,
|
||||
$activity,
|
||||
$nav,
|
||||
),
|
||||
array(
|
||||
'title' => $user->getUsername(),
|
||||
|
@ -186,103 +183,4 @@ final class PhabricatorPeopleProfileController
|
|||
return $view;
|
||||
}
|
||||
|
||||
private function renderUserFeed(PhabricatorUser $user) {
|
||||
$viewer = $this->getRequest()->getUser();
|
||||
|
||||
$query = new PhabricatorFeedQuery();
|
||||
$query->setFilterPHIDs(
|
||||
array(
|
||||
$user->getPHID(),
|
||||
));
|
||||
$query->setLimit(100);
|
||||
$query->setViewer($viewer);
|
||||
$stories = $query->execute();
|
||||
|
||||
$builder = new PhabricatorFeedBuilder($stories);
|
||||
$builder->setUser($viewer);
|
||||
$builder->setShowHovercards(true);
|
||||
$view = $builder->buildView();
|
||||
|
||||
return phutil_tag_div(
|
||||
'profile-feed',
|
||||
$view->render());
|
||||
}
|
||||
|
||||
private function renderUserCalendar(PhabricatorUser $user) {
|
||||
$viewer = $this->getRequest()->getUser();
|
||||
$epochs = CalendarTimeUtil::getCalendarEventEpochs(
|
||||
$viewer,
|
||||
'today',
|
||||
7);
|
||||
$start_epoch = $epochs['start_epoch'];
|
||||
$end_epoch = $epochs['end_epoch'];
|
||||
$statuses = id(new PhabricatorCalendarEventQuery())
|
||||
->setViewer($viewer)
|
||||
->withInvitedPHIDs(array($user->getPHID()))
|
||||
->withDateRange($start_epoch, $end_epoch)
|
||||
->execute();
|
||||
|
||||
$timestamps = CalendarTimeUtil::getCalendarWeekTimestamps(
|
||||
$viewer);
|
||||
$today = $timestamps['today'];
|
||||
$epoch_stamps = $timestamps['epoch_stamps'];
|
||||
$events = array();
|
||||
|
||||
foreach ($epoch_stamps as $day) {
|
||||
$epoch_start = $day->format('U');
|
||||
$next_day = clone $day;
|
||||
$next_day->modify('+1 day');
|
||||
$epoch_end = $next_day->format('U');
|
||||
|
||||
foreach ($statuses as $status) {
|
||||
if ($status->getDateTo() < $epoch_start) {
|
||||
continue;
|
||||
}
|
||||
if ($status->getDateFrom() >= $epoch_end) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$event = new AphrontCalendarEventView();
|
||||
$event->setEpochRange($status->getDateFrom(), $status->getDateTo());
|
||||
|
||||
$status_text = $status->getHumanStatus();
|
||||
$event->setUserPHID($status->getUserPHID());
|
||||
$event->setName($status_text);
|
||||
$event->setDescription($status->getDescription());
|
||||
$event->setEventID($status->getID());
|
||||
$events[$epoch_start][] = $event;
|
||||
}
|
||||
}
|
||||
|
||||
$week = array();
|
||||
foreach ($epoch_stamps as $day) {
|
||||
$epoch = $day->format('U');
|
||||
$headertext = phabricator_format_local_time($epoch, $user, 'l, M d');
|
||||
|
||||
$list = new PHUICalendarListView();
|
||||
$list->setUser($viewer);
|
||||
$list->showBlankState(true);
|
||||
if (isset($events[$epoch])) {
|
||||
foreach ($events[$epoch] as $event) {
|
||||
$list->addEvent($event);
|
||||
}
|
||||
}
|
||||
|
||||
$header = phutil_tag(
|
||||
'a',
|
||||
array(
|
||||
'href' => $this->getRequest()->getRequestURI().'calendar/',
|
||||
),
|
||||
$headertext);
|
||||
|
||||
$calendar = new PHUICalendarWidgetView();
|
||||
$calendar->setHeader($header);
|
||||
$calendar->setCalendarList($list);
|
||||
$week[] = $calendar;
|
||||
}
|
||||
|
||||
return phutil_tag_div(
|
||||
'profile-calendar',
|
||||
$week);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,6 +20,7 @@ final class PhabricatorPeopleProfileEditController
|
|||
$user = id(new PhabricatorPeopleQuery())
|
||||
->setViewer($viewer)
|
||||
->withIDs(array($this->id))
|
||||
->needProfileImage(true)
|
||||
->requireCapabilities(
|
||||
array(
|
||||
PhabricatorPolicyCapability::CAN_VIEW,
|
||||
|
@ -60,9 +61,6 @@ final class PhabricatorPeopleProfileEditController
|
|||
}
|
||||
|
||||
$title = pht('Edit Profile');
|
||||
$crumbs = $this->buildApplicationCrumbs();
|
||||
$crumbs->addTextCrumb($user->getUsername(), $profile_uri);
|
||||
$crumbs->addTextCrumb($title);
|
||||
|
||||
$form = id(new AphrontFormView())
|
||||
->setUser($viewer);
|
||||
|
@ -80,10 +78,13 @@ final class PhabricatorPeopleProfileEditController
|
|||
->setValidationException($validation_exception)
|
||||
->setForm($form);
|
||||
|
||||
$nav = $this->buildIconNavView($user);
|
||||
$nav->selectFilter('/');
|
||||
$nav->appendChild($form_box);
|
||||
|
||||
return $this->buildApplicationPage(
|
||||
array(
|
||||
$crumbs,
|
||||
$form_box,
|
||||
$nav,
|
||||
),
|
||||
array(
|
||||
'title' => $title,
|
||||
|
|
|
@ -20,6 +20,7 @@ final class PhabricatorPeopleProfilePictureController
|
|||
$user = id(new PhabricatorPeopleQuery())
|
||||
->setViewer($viewer)
|
||||
->withIDs(array($this->id))
|
||||
->needProfileImage(true)
|
||||
->requireCapabilities(
|
||||
array(
|
||||
PhabricatorPolicyCapability::CAN_VIEW,
|
||||
|
@ -91,9 +92,6 @@ final class PhabricatorPeopleProfilePictureController
|
|||
}
|
||||
|
||||
$title = pht('Edit Profile Picture');
|
||||
$crumbs = $this->buildApplicationCrumbs();
|
||||
$crumbs->addTextCrumb($user->getUsername(), $profile_uri);
|
||||
$crumbs->addTextCrumb($title);
|
||||
|
||||
$form = id(new PHUIFormLayoutView())
|
||||
->setUser($viewer);
|
||||
|
@ -242,11 +240,14 @@ final class PhabricatorPeopleProfilePictureController
|
|||
->setHeaderText(pht('Upload New Picture'))
|
||||
->setForm($upload_form);
|
||||
|
||||
$nav = $this->buildIconNavView($user);
|
||||
$nav->selectFilter('/');
|
||||
$nav->appendChild($form_box);
|
||||
$nav->appendChild($upload_box);
|
||||
|
||||
return $this->buildApplicationPage(
|
||||
array(
|
||||
$crumbs,
|
||||
$form_box,
|
||||
$upload_box,
|
||||
$nav,
|
||||
),
|
||||
array(
|
||||
'title' => $title,
|
||||
|
|
|
@ -33,15 +33,6 @@
|
|||
margin-left: 16px;
|
||||
}
|
||||
|
||||
.profile-activity-view.profile-has-calendar .profile-feed {
|
||||
margin-left: 332px;
|
||||
}
|
||||
|
||||
.device-phone .profile-activity-view .profile-calendar {
|
||||
float: none;
|
||||
margin: 0 8px;
|
||||
}
|
||||
|
||||
.device-phone .profile-activity-view .profile-feed {
|
||||
float: none;
|
||||
margin: 0 8px;
|
||||
|
|
Loading…
Reference in a new issue