1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-10 08:52:39 +01:00

Modernize People application

Summary: Move to application navigation, make it possible to get to /logs/ from the navigation.

Test Plan: Hit all interfaces, verified email.

Reviewers: btrahan, vrana

Reviewed By: btrahan

CC: aran

Maniphest Tasks: T1569, T631

Differential Revision: https://secure.phabricator.com/D3261
This commit is contained in:
epriestley 2012-08-13 15:27:21 -07:00
parent dd26bc6d1a
commit e0e339f16c
9 changed files with 59 additions and 44 deletions

View file

@ -305,9 +305,6 @@ class AphrontDefaultApplicationConfiguration
'testpaymentform/' => 'PhortuneStripeTestPaymentFormController',
),
),
'/emailverify/(?P<code>[^/]+)/' =>
'PhabricatorEmailVerificationController',
);
}

View file

@ -26,6 +26,10 @@ final class PhabricatorApplicationPeople extends PhabricatorApplication {
return '/people/';
}
public function getTitleGlyph() {
return "\xE2\x99\x9F";
}
public function getIconURI() {
return celerity_get_resource_uri('/rsrc/image/app/app_people.png');
}
@ -41,6 +45,8 @@ final class PhabricatorApplicationPeople extends PhabricatorApplication {
),
'/p/(?P<username>[\w._-]+)/(?:(?P<page>\w+)/)?'
=> 'PhabricatorPeopleProfileController',
'/emailverify/(?P<code>[^/]+)/' =>
'PhabricatorEmailVerificationController',
);
}

View file

@ -87,7 +87,7 @@ final class PhabricatorEmailVerificationController
$settings_link);
}
return $this->buildStandardPageResponse(
return $this->buildApplicationPage(
$content,
array(
'title' => 'Verify Email',

View file

@ -1,7 +1,7 @@
<?php
/*
* Copyright 2011 Facebook, Inc.
* Copyright 2012 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -18,38 +18,29 @@
abstract class PhabricatorPeopleController extends PhabricatorController {
public function buildStandardPageResponse($view, array $data) {
$page = $this->buildStandardPageView();
public function buildSideNavView() {
$nav = new AphrontSideNavFilterView();
$nav->setBaseURI(new PhutilURI($this->getApplicationURI()));
$page->setApplicationName('People');
$page->setBaseURI('/people/');
$page->setTitle(idx($data, 'title'));
$is_admin = $this->getRequest()->getUser()->getIsAdmin();
$tabs = array(
'directory' => array(
'name' => 'User Directory',
'href' => '/people/',
),
);
if ($this->getRequest()->getUser()->getIsAdmin()) {
$tabs = array_merge(
$tabs,
array(
'logs' => array(
'name' => 'Activity Logs',
'href' => '/people/logs/',
),
));
if ($is_admin) {
$nav->addLabel('Create Users');
$nav->addFilter('edit', 'Create New User');
$nav->addFilter('ldap', 'Import from LDAP');
$nav->addSpacer();
}
$page->setTabs($tabs, idx($data, 'tab'));
$nav->addLabel('Directory');
$nav->addFilter('people', 'User Directory', $this->getApplicationURI());
$page->setGlyph("\xE2\x99\x9F");
$page->appendChild($view);
if ($is_admin) {
$nav->addSpacer();
$nav->addLabel('Logs');
$nav->addFilter('logs', 'Activity Logs');
}
$response = new AphrontWebpageResponse();
return $response->setContent($page->render());
return $nav;
}
}

View file

@ -49,16 +49,20 @@ final class PhabricatorPeopleEditController
$nav = new AphrontSideNavFilterView();
$nav->setBaseURI(new PhutilURI($base_uri));
$nav->addLabel('User Information');
$nav->addFilter('basic', 'Basic Information');
$nav->addFilter('role', 'Edit Roles');
$nav->addFilter('cert', 'Conduit Certificate');
$nav->addFilter('profile', 'View Profile', '/p/'.$user->getUsername().'/');
$nav->addSpacer();
$nav->addLabel('Special');
$nav->addFilter('rename', 'Change Username');
$nav->addFilter('delete', 'Delete User');
if (!$user->getID()) {
$this->view = 'basic';
}
$view = $nav->selectFilter($this->view, 'basic');
$content = array();
@ -99,11 +103,14 @@ final class PhabricatorPeopleEditController
if ($user->getID()) {
$nav->appendChild($content);
$content = $nav;
} else {
$nav = $this->buildSideNavView();
$nav->selectFilter('edit');
$nav->appendChild($content);
}
return $this->buildStandardPageResponse(
$content,
return $this->buildApplicationPage(
$nav,
array(
'title' => 'Edit User',
));

View file

@ -68,8 +68,12 @@ final class PhabricatorPeopleLdapController
$content[] = $this->processSearchRequest($request);
}
return $this->buildStandardPageResponse(
$content,
$nav = $this->buildSideNavView();
$nav->selectFilter('ldap');
$nav->appendChild($content);
return $this->buildApplicationPage(
$nav,
array(
'title' => 'Import Ldap Users',
));

View file

@ -138,13 +138,18 @@ final class PhabricatorPeopleListController
'href' => '/people/ldap/',
'class' => 'button green'
),
'Import from Ldap'));
'Import from LDAP'));
}
}
return $this->buildStandardPageResponse($panel, array(
'title' => 'People',
'tab' => 'directory',
$nav = $this->buildSideNavView();
$nav->selectFilter('people');
$nav->appendChild($panel);
return $this->buildApplicationPage(
$nav,
array(
'title' => 'People',
));
}
}

View file

@ -232,14 +232,19 @@ final class PhabricatorPeopleLogsController
$filter = new AphrontListFilterView();
$filter->appendChild($form);
return $this->buildStandardPageResponse(
$nav = $this->buildSideNavView();
$nav->selectFilter('logs');
$nav->appendChild(
array(
$filter,
$panel,
),
));
return $this->buildApplicationPage(
$nav,
array(
'title' => 'Activity Logs',
'tab' => 'logs',
));
}
}

View file

@ -158,7 +158,7 @@ final class PhabricatorPeopleProfileController
'/people/edit/'.$user->getID().'/');
}
return $this->buildStandardPageResponse(
return $this->buildApplicationPage(
$header,
array(
'title' => $user->getUsername(),