mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-10 08:52:39 +01:00
Remove PhabricatorProfileHeaderView in favor of PhabricatorHeaderView
Summary: We have this old view which is only used in two places and looks the same but has totally different markup. Get rid of it. @chad, I'm generally going to move the user/project profiles a step toward looking like other object detail view with the custom field stuff. Not sure if you have any grand vision here; we can easily do something else later since this is like 80% "delete weird epriestley one-offs that don't look quite right in favor of standard elements". Test Plan: {F49324} {F49325} {F49326} Reviewers: chad, btrahan Reviewed By: chad CC: aran Differential Revision: https://secure.phabricator.com/D6394
This commit is contained in:
parent
2432a47997
commit
f548dc0067
8 changed files with 137 additions and 218 deletions
|
@ -3197,7 +3197,7 @@ celerity_register_resource_map(array(
|
|||
),
|
||||
'phabricator-header-view-css' =>
|
||||
array(
|
||||
'uri' => '/res/585b771c/rsrc/css/layout/phabricator-header-view.css',
|
||||
'uri' => '/res/76173bb6/rsrc/css/layout/phabricator-header-view.css',
|
||||
'type' => 'css',
|
||||
'requires' =>
|
||||
array(
|
||||
|
@ -3398,15 +3398,6 @@ celerity_register_resource_map(array(
|
|||
),
|
||||
'disk' => '/rsrc/css/application/profile/profile-view.css',
|
||||
),
|
||||
'phabricator-profile-header-css' =>
|
||||
array(
|
||||
'uri' => '/res/a03c1e20/rsrc/css/application/profile/profile-header-view.css',
|
||||
'type' => 'css',
|
||||
'requires' =>
|
||||
array(
|
||||
),
|
||||
'disk' => '/rsrc/css/application/profile/profile-header-view.css',
|
||||
),
|
||||
'phabricator-project-tag-css' =>
|
||||
array(
|
||||
'uri' => '/res/383b8c30/rsrc/css/application/projects/project-tag.css',
|
||||
|
@ -4149,7 +4140,7 @@ celerity_register_resource_map(array(
|
|||
), array(
|
||||
'packages' =>
|
||||
array(
|
||||
'178f5351' =>
|
||||
'd7254b92' =>
|
||||
array(
|
||||
'name' => 'core.pkg.css',
|
||||
'symbols' =>
|
||||
|
@ -4197,7 +4188,7 @@ celerity_register_resource_map(array(
|
|||
40 => 'phabricator-property-list-view-css',
|
||||
41 => 'phabricator-tag-view-css',
|
||||
),
|
||||
'uri' => '/res/pkg/178f5351/core.pkg.css',
|
||||
'uri' => '/res/pkg/d7254b92/core.pkg.css',
|
||||
'type' => 'css',
|
||||
),
|
||||
'75ccea43' =>
|
||||
|
@ -4391,16 +4382,16 @@ celerity_register_resource_map(array(
|
|||
'reverse' =>
|
||||
array(
|
||||
'aphront-attached-file-view-css' => 'adc3c36d',
|
||||
'aphront-dialog-view-css' => '178f5351',
|
||||
'aphront-error-view-css' => '178f5351',
|
||||
'aphront-form-view-css' => '178f5351',
|
||||
'aphront-list-filter-view-css' => '178f5351',
|
||||
'aphront-pager-view-css' => '178f5351',
|
||||
'aphront-panel-view-css' => '178f5351',
|
||||
'aphront-table-view-css' => '178f5351',
|
||||
'aphront-tokenizer-control-css' => '178f5351',
|
||||
'aphront-tooltip-css' => '178f5351',
|
||||
'aphront-typeahead-control-css' => '178f5351',
|
||||
'aphront-dialog-view-css' => 'd7254b92',
|
||||
'aphront-error-view-css' => 'd7254b92',
|
||||
'aphront-form-view-css' => 'd7254b92',
|
||||
'aphront-list-filter-view-css' => 'd7254b92',
|
||||
'aphront-pager-view-css' => 'd7254b92',
|
||||
'aphront-panel-view-css' => 'd7254b92',
|
||||
'aphront-table-view-css' => 'd7254b92',
|
||||
'aphront-tokenizer-control-css' => 'd7254b92',
|
||||
'aphront-tooltip-css' => 'd7254b92',
|
||||
'aphront-typeahead-control-css' => 'd7254b92',
|
||||
'differential-changeset-view-css' => 'dd27a69b',
|
||||
'differential-core-view-css' => 'dd27a69b',
|
||||
'differential-inline-comment-editor' => '4ad86dee',
|
||||
|
@ -4414,7 +4405,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' => '178f5351',
|
||||
'global-drag-and-drop-css' => 'd7254b92',
|
||||
'inline-comment-summary-css' => 'dd27a69b',
|
||||
'javelin-aphlict' => '75ccea43',
|
||||
'javelin-behavior' => 'a9f14d76',
|
||||
|
@ -4488,55 +4479,55 @@ celerity_register_resource_map(array(
|
|||
'javelin-util' => 'a9f14d76',
|
||||
'javelin-vector' => 'a9f14d76',
|
||||
'javelin-workflow' => 'a9f14d76',
|
||||
'lightbox-attachment-css' => '178f5351',
|
||||
'lightbox-attachment-css' => 'd7254b92',
|
||||
'maniphest-task-summary-css' => 'adc3c36d',
|
||||
'maniphest-transaction-detail-css' => 'adc3c36d',
|
||||
'phabricator-action-list-view-css' => '178f5351',
|
||||
'phabricator-application-launch-view-css' => '178f5351',
|
||||
'phabricator-action-list-view-css' => 'd7254b92',
|
||||
'phabricator-application-launch-view-css' => 'd7254b92',
|
||||
'phabricator-busy' => '75ccea43',
|
||||
'phabricator-content-source-view-css' => 'dd27a69b',
|
||||
'phabricator-core-css' => '178f5351',
|
||||
'phabricator-crumbs-view-css' => '178f5351',
|
||||
'phabricator-core-css' => 'd7254b92',
|
||||
'phabricator-crumbs-view-css' => 'd7254b92',
|
||||
'phabricator-drag-and-drop-file-upload' => '4ad86dee',
|
||||
'phabricator-dropdown-menu' => '75ccea43',
|
||||
'phabricator-file-upload' => '75ccea43',
|
||||
'phabricator-filetree-view-css' => '178f5351',
|
||||
'phabricator-flag-css' => '178f5351',
|
||||
'phabricator-form-view-css' => '178f5351',
|
||||
'phabricator-header-view-css' => '178f5351',
|
||||
'phabricator-filetree-view-css' => 'd7254b92',
|
||||
'phabricator-flag-css' => 'd7254b92',
|
||||
'phabricator-form-view-css' => 'd7254b92',
|
||||
'phabricator-header-view-css' => 'd7254b92',
|
||||
'phabricator-hovercard' => '75ccea43',
|
||||
'phabricator-jump-nav' => '178f5351',
|
||||
'phabricator-jump-nav' => 'd7254b92',
|
||||
'phabricator-keyboard-shortcut' => '75ccea43',
|
||||
'phabricator-keyboard-shortcut-manager' => '75ccea43',
|
||||
'phabricator-main-menu-view' => '178f5351',
|
||||
'phabricator-main-menu-view' => 'd7254b92',
|
||||
'phabricator-menu-item' => '75ccea43',
|
||||
'phabricator-nav-view-css' => '178f5351',
|
||||
'phabricator-nav-view-css' => 'd7254b92',
|
||||
'phabricator-notification' => '75ccea43',
|
||||
'phabricator-notification-css' => '178f5351',
|
||||
'phabricator-notification-menu-css' => '178f5351',
|
||||
'phabricator-object-item-list-view-css' => '178f5351',
|
||||
'phabricator-notification-css' => 'd7254b92',
|
||||
'phabricator-notification-menu-css' => 'd7254b92',
|
||||
'phabricator-object-item-list-view-css' => 'd7254b92',
|
||||
'phabricator-object-selector-css' => 'dd27a69b',
|
||||
'phabricator-phtize' => '75ccea43',
|
||||
'phabricator-prefab' => '75ccea43',
|
||||
'phabricator-project-tag-css' => 'adc3c36d',
|
||||
'phabricator-property-list-view-css' => '178f5351',
|
||||
'phabricator-remarkup-css' => '178f5351',
|
||||
'phabricator-property-list-view-css' => 'd7254b92',
|
||||
'phabricator-remarkup-css' => 'd7254b92',
|
||||
'phabricator-shaped-request' => '4ad86dee',
|
||||
'phabricator-side-menu-view-css' => '178f5351',
|
||||
'phabricator-standard-page-view' => '178f5351',
|
||||
'phabricator-tag-view-css' => '178f5351',
|
||||
'phabricator-side-menu-view-css' => 'd7254b92',
|
||||
'phabricator-standard-page-view' => 'd7254b92',
|
||||
'phabricator-tag-view-css' => 'd7254b92',
|
||||
'phabricator-textareautils' => '75ccea43',
|
||||
'phabricator-tooltip' => '75ccea43',
|
||||
'phabricator-transaction-view-css' => '178f5351',
|
||||
'phabricator-zindex-css' => '178f5351',
|
||||
'phui-button-css' => '178f5351',
|
||||
'phui-form-css' => '178f5351',
|
||||
'phui-icon-view-css' => '178f5351',
|
||||
'phui-spacing-css' => '178f5351',
|
||||
'sprite-apps-large-css' => '178f5351',
|
||||
'sprite-gradient-css' => '178f5351',
|
||||
'sprite-icons-css' => '178f5351',
|
||||
'sprite-menu-css' => '178f5351',
|
||||
'syntax-highlighting-css' => '178f5351',
|
||||
'phabricator-transaction-view-css' => 'd7254b92',
|
||||
'phabricator-zindex-css' => 'd7254b92',
|
||||
'phui-button-css' => 'd7254b92',
|
||||
'phui-form-css' => 'd7254b92',
|
||||
'phui-icon-view-css' => 'd7254b92',
|
||||
'phui-spacing-css' => 'd7254b92',
|
||||
'sprite-apps-large-css' => 'd7254b92',
|
||||
'sprite-gradient-css' => 'd7254b92',
|
||||
'sprite-icons-css' => 'd7254b92',
|
||||
'sprite-menu-css' => 'd7254b92',
|
||||
'syntax-highlighting-css' => 'd7254b92',
|
||||
),
|
||||
));
|
||||
|
|
|
@ -1369,7 +1369,6 @@ phutil_register_library_map(array(
|
|||
'PhabricatorPolicyTestCase' => 'applications/policy/__tests__/PhabricatorPolicyTestCase.php',
|
||||
'PhabricatorPolicyTestObject' => 'applications/policy/__tests__/PhabricatorPolicyTestObject.php',
|
||||
'PhabricatorPolicyType' => 'applications/policy/constants/PhabricatorPolicyType.php',
|
||||
'PhabricatorProfileHeaderView' => 'view/layout/PhabricatorProfileHeaderView.php',
|
||||
'PhabricatorProject' => 'applications/project/storage/PhabricatorProject.php',
|
||||
'PhabricatorProjectConstants' => 'applications/project/constants/PhabricatorProjectConstants.php',
|
||||
'PhabricatorProjectController' => 'applications/project/controller/PhabricatorProjectController.php',
|
||||
|
@ -3325,7 +3324,6 @@ phutil_register_library_map(array(
|
|||
'PhabricatorPolicyTestCase' => 'PhabricatorTestCase',
|
||||
'PhabricatorPolicyTestObject' => 'PhabricatorPolicyInterface',
|
||||
'PhabricatorPolicyType' => 'PhabricatorPolicyConstants',
|
||||
'PhabricatorProfileHeaderView' => 'AphrontView',
|
||||
'PhabricatorProject' =>
|
||||
array(
|
||||
0 => 'PhabricatorProjectDAO',
|
||||
|
|
|
@ -89,11 +89,10 @@ final class PhabricatorPeopleProfileController
|
|||
|
||||
$picture = $user->loadProfileImageURI();
|
||||
|
||||
$header = new PhabricatorProfileHeaderView();
|
||||
$header
|
||||
->setProfilePicture($picture)
|
||||
->setName($user->getUserName().' ('.$user->getRealName().')')
|
||||
->setDescription($profile->getTitle());
|
||||
$header = id(new PhabricatorHeaderView())
|
||||
->setHeader($user->getUserName().' ('.$user->getRealName().')')
|
||||
->setSubheader($profile->getTitle())
|
||||
->setImage($picture);
|
||||
|
||||
if ($user->getIsDisabled()) {
|
||||
$header->setStatus(pht('Disabled'));
|
||||
|
@ -106,7 +105,7 @@ final class PhabricatorPeopleProfileController
|
|||
}
|
||||
|
||||
$nav->appendChild($header);
|
||||
$header->appendChild($content);
|
||||
$nav->appendChild($content);
|
||||
|
||||
if ($user->getPHID() == $viewer->getPHID()) {
|
||||
$nav->addFilter(
|
||||
|
|
|
@ -65,48 +65,40 @@ final class PhabricatorProjectProfileController
|
|||
$tasks,
|
||||
$content);
|
||||
|
||||
$header = new PhabricatorProfileHeaderView();
|
||||
$header->setName($project->getName());
|
||||
$header->setDescription(
|
||||
phutil_utf8_shorten($profile->getBlurb(), 1024));
|
||||
$header->setProfilePicture($picture);
|
||||
$header = id(new PhabricatorHeaderView())
|
||||
->setHeader($project->getName())
|
||||
->setSubheader(phutil_utf8_shorten($profile->getBlurb(), 1024))
|
||||
->setImage($picture);
|
||||
|
||||
$action = null;
|
||||
if (!$project->isUserMember($user->getPHID())) {
|
||||
$can_join = PhabricatorPolicyCapability::CAN_JOIN;
|
||||
|
||||
if (PhabricatorPolicyFilter::hasCapability($user, $project, $can_join)) {
|
||||
$class = 'green';
|
||||
} else {
|
||||
$class = 'grey disabled';
|
||||
}
|
||||
|
||||
$action = phabricator_form(
|
||||
$can_join = PhabricatorPolicyFilter::hasCapability(
|
||||
$user,
|
||||
array(
|
||||
'action' => '/project/update/'.$project->getID().'/join/',
|
||||
'method' => 'post',
|
||||
),
|
||||
phutil_tag(
|
||||
'button',
|
||||
array(
|
||||
'class' => $class,
|
||||
),
|
||||
pht('Join Project')));
|
||||
$project,
|
||||
PhabricatorPolicyCapability::CAN_JOIN);
|
||||
|
||||
$action = id(new PhabricatorActionView())
|
||||
->setUser($user)
|
||||
->setRenderAsForm(true)
|
||||
->setHref('/project/update/'.$project->getID().'/join/')
|
||||
->setIcon('new')
|
||||
->setDisabled(!$can_join)
|
||||
->setName(pht('Join Project'));
|
||||
} else {
|
||||
$action = javelin_tag(
|
||||
'a',
|
||||
array(
|
||||
'href' => '/project/update/'.$project->getID().'/leave/',
|
||||
'sigil' => 'workflow',
|
||||
'class' => 'grey button',
|
||||
),
|
||||
pht('Leave Project...'));
|
||||
$action = id(new PhabricatorActionView())
|
||||
->setWorkflow(true)
|
||||
->setHref('/project/update/'.$project->getID().'/leave/')
|
||||
->setIcon('delete')
|
||||
->setName(pht('Leave Project...'));
|
||||
}
|
||||
|
||||
$header->addAction($action);
|
||||
$action_list = id(new PhabricatorActionListView())
|
||||
->setUser($user)
|
||||
->addAction($action);
|
||||
|
||||
$nav_view->appendChild($header);
|
||||
$header->appendChild($content);
|
||||
$nav_view->appendChild($action_list);
|
||||
$nav_view->appendChild($content);
|
||||
|
||||
return $this->buildApplicationPage(
|
||||
$nav_view,
|
||||
|
|
|
@ -5,6 +5,8 @@ final class PhabricatorHeaderView extends AphrontView {
|
|||
private $objectName;
|
||||
private $header;
|
||||
private $tags = array();
|
||||
private $image;
|
||||
private $subheader;
|
||||
|
||||
public function setHeader($header) {
|
||||
$this->header = $header;
|
||||
|
@ -21,10 +23,32 @@ final class PhabricatorHeaderView extends AphrontView {
|
|||
return $this;
|
||||
}
|
||||
|
||||
public function setImage($uri) {
|
||||
$this->image = $uri;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setSubheader($subheader) {
|
||||
$this->subheader = $subheader;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function render() {
|
||||
require_celerity_resource('phabricator-header-view-css');
|
||||
|
||||
$header = array($this->header);
|
||||
$image = null;
|
||||
if ($this->image) {
|
||||
$image = phutil_tag(
|
||||
'span',
|
||||
array(
|
||||
'class' => 'phabricator-header-image',
|
||||
'style' => 'background-image: url('.$this->image.')',
|
||||
),
|
||||
'');
|
||||
}
|
||||
|
||||
$header = array();
|
||||
$header[] = $this->header;
|
||||
|
||||
if ($this->objectName) {
|
||||
array_unshift(
|
||||
|
@ -48,17 +72,29 @@ final class PhabricatorHeaderView extends AphrontView {
|
|||
array_interleave(' ', $this->tags));
|
||||
}
|
||||
|
||||
if ($this->subheader) {
|
||||
$header[] = phutil_tag(
|
||||
'div',
|
||||
array(
|
||||
'class' => 'phabricator-header-subheader',
|
||||
),
|
||||
$this->subheader);
|
||||
}
|
||||
|
||||
return phutil_tag(
|
||||
'div',
|
||||
array(
|
||||
'class' => 'phabricator-header-shell',
|
||||
),
|
||||
phutil_tag(
|
||||
'h1',
|
||||
array(
|
||||
'class' => 'phabricator-header-view',
|
||||
),
|
||||
$header));
|
||||
array(
|
||||
$image,
|
||||
phutil_tag(
|
||||
'h1',
|
||||
array(
|
||||
'class' => 'phabricator-header-view',
|
||||
),
|
||||
$header),
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,76 +0,0 @@
|
|||
<?php
|
||||
|
||||
final class PhabricatorProfileHeaderView extends AphrontView {
|
||||
|
||||
protected $profilePicture;
|
||||
protected $profileName;
|
||||
protected $profileDescription;
|
||||
protected $profileActions = array();
|
||||
protected $profileStatus;
|
||||
|
||||
public function setProfilePicture($picture) {
|
||||
$this->profilePicture = $picture;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setName($name) {
|
||||
$this->profileName = $name;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setDescription($description) {
|
||||
$this->profileDescription = $description;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function addAction($action) {
|
||||
$this->profileActions[] = $action;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setStatus($status) {
|
||||
$this->profileStatus = $status;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function render() {
|
||||
require_celerity_resource('phabricator-profile-header-css');
|
||||
|
||||
$image = null;
|
||||
if ($this->profilePicture) {
|
||||
$image = phutil_tag(
|
||||
'div',
|
||||
array(
|
||||
'class' => 'profile-header-picture-frame',
|
||||
'style' => 'background-image: url('.$this->profilePicture.');',
|
||||
),
|
||||
'');
|
||||
}
|
||||
|
||||
$description = $this->profileDescription;
|
||||
if ($this->profileStatus != '') {
|
||||
$description = hsprintf(
|
||||
'<strong>%s</strong>%s',
|
||||
$this->profileStatus,
|
||||
($description != '' ? "\xE2\x80\x94".$description : ''));
|
||||
}
|
||||
|
||||
return hsprintf(
|
||||
'<table class="phabricator-profile-header">
|
||||
<tr>
|
||||
<td class="profile-header-name">%s</td>
|
||||
<td class="profile-header-actions" rowspan="2">%s</td>
|
||||
<td class="profile-header-picture" rowspan="2">%s</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="profile-header-description">%s</td>
|
||||
</tr>
|
||||
</table>
|
||||
%s',
|
||||
$this->profileName,
|
||||
$this->profileActions,
|
||||
$image,
|
||||
$description,
|
||||
$this->renderChildren());
|
||||
}
|
||||
}
|
|
@ -1,39 +0,0 @@
|
|||
/**
|
||||
* @provides phabricator-profile-header-css
|
||||
*/
|
||||
|
||||
.phabricator-profile-header {
|
||||
background: #e0e3ec;
|
||||
border-width: 1px 0;
|
||||
border-style: solid;
|
||||
border-color: #c0c5d1;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.phabricator-profile-header .profile-header-name {
|
||||
font-size: 24px;
|
||||
color: #333;
|
||||
font-weight: bold;
|
||||
padding: 12px 12px 6px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.phabricator-profile-header .profile-header-actions {
|
||||
padding: 12px;
|
||||
}
|
||||
|
||||
.phabricator-profile-header .profile-header-picture-frame {
|
||||
margin: 11px;
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
position: relative;
|
||||
|
||||
background: no-repeat;
|
||||
border: 1px solid #ffffff;
|
||||
}
|
||||
|
||||
.phabricator-profile-header .profile-header-description {
|
||||
padding: 0 12px 12px;
|
||||
color: #555;
|
||||
font-size: 13px;
|
||||
}
|
|
@ -7,6 +7,7 @@
|
|||
border-width: 1px 0;
|
||||
border-style: solid;
|
||||
border-color: #c0c5d1;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.phabricator-header-shell + .phabricator-form-view {
|
||||
|
@ -31,3 +32,20 @@
|
|||
.phabricator-header-tags .phabricator-tag-view {
|
||||
margin-left: 4px;
|
||||
}
|
||||
|
||||
.phabricator-header-image {
|
||||
display: inline-block;
|
||||
background-repeat: no-repeat;
|
||||
border: 1px solid white;
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
margin: 12px;
|
||||
float: left;
|
||||
}
|
||||
|
||||
.phabricator-header-subheader {
|
||||
color: #444444;
|
||||
font-weight: normal;
|
||||
font-size: 13px;
|
||||
margin-top: 4px;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue