1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-26 00:32:42 +01:00

Clean up watchers and members project page

Summary: Various little fixes, mostly moves information from the "Details" section either into the curtain or into the specific watchers or members list based on user viewership. I think this page is both cleaner and more informative.

Test Plan:
Lock, Unlock, Watch, Join, various projects with multiple users.

{F4959101}

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin

Differential Revision: https://secure.phabricator.com/D17891
This commit is contained in:
Chad Little 2017-05-15 15:44:50 -07:00
parent 78544334cd
commit f600bc0811
7 changed files with 115 additions and 115 deletions

View file

@ -9,7 +9,7 @@ return array(
'names' => array(
'conpherence.pkg.css' => 'ff161f2d',
'conpherence.pkg.js' => 'b5b51108',
'core.pkg.css' => '24ffbe93',
'core.pkg.css' => 'd1bf3405',
'core.pkg.js' => '2ff7879f',
'darkconsole.pkg.js' => '1f9a31bc',
'differential.pkg.css' => '90b30783',
@ -160,7 +160,7 @@ return array(
'rsrc/css/phui/phui-icon.css' => '12b387a1',
'rsrc/css/phui/phui-image-mask.css' => 'a8498f9c',
'rsrc/css/phui/phui-info-panel.css' => '27ea50a1',
'rsrc/css/phui/phui-info-view.css' => 'ec92802a',
'rsrc/css/phui/phui-info-view.css' => '6e217679',
'rsrc/css/phui/phui-invisible-character-view.css' => '6993d9f0',
'rsrc/css/phui/phui-lightbox.css' => '0a035e40',
'rsrc/css/phui/phui-list.css' => '12eb8ce6',
@ -867,7 +867,7 @@ return array(
'phui-icon-view-css' => '12b387a1',
'phui-image-mask-css' => 'a8498f9c',
'phui-info-panel-css' => '27ea50a1',
'phui-info-view-css' => 'ec92802a',
'phui-info-view-css' => '6e217679',
'phui-inline-comment-view-css' => 'be663c95',
'phui-invisible-character-view-css' => '6993d9f0',
'phui-lightbox-css' => '0a035e40',

View file

@ -20,15 +20,8 @@ final class PhabricatorProjectMembersViewController
$this->setProject($project);
$title = pht('Members and Watchers');
$properties = $this->buildProperties($project);
$curtain = $this->buildCurtainView($project);
$object_box = id(new PHUIObjectBoxView())
->setHeaderText(pht('Details'))
->setBackground(PHUIObjectBoxView::BLUE_PROPERTY)
->addPropertyList($properties);
$member_list = id(new PhabricatorProjectMemberListView())
->setUser($viewer)
->setProject($project)
@ -52,16 +45,18 @@ final class PhabricatorProjectMembersViewController
->setHeader($title)
->setHeaderIcon('fa-group');
require_celerity_resource('project-view-css');
$view = id(new PHUITwoColumnView())
->setHeader($header)
->setCurtain($curtain)
->addClass('project-view-home')
->addClass('project-view-people-home')
->setMainColumn(array(
$object_box,
$member_list,
$watcher_list,
));
return $this->newPage()
->setNavigation($nav)
->setCrumbs($crumbs)
@ -69,105 +64,6 @@ final class PhabricatorProjectMembersViewController
->appendChild($view);
}
private function buildProperties(PhabricatorProject $project) {
$viewer = $this->getViewer();
$view = id(new PHUIPropertyListView())
->setUser($viewer)
->setObject($project);
if ($project->isMilestone()) {
$icon_key = PhabricatorProjectIconSet::getMilestoneIconKey();
$icon = PhabricatorProjectIconSet::getIconIcon($icon_key);
$target = PhabricatorProjectIconSet::getIconName($icon_key);
$note = pht(
'Members of the parent project are members of this project.');
$show_join = false;
} else if ($project->getHasSubprojects()) {
$icon = 'fa-sitemap';
$target = pht('Parent Project');
$note = pht(
'Members of all subprojects are members of this project.');
$show_join = false;
} else if ($project->getIsMembershipLocked()) {
$icon = 'fa-lock';
$target = pht('Locked Project');
$note = pht(
'Users with access may join this project, but may not leave.');
$show_join = true;
} else {
$icon = 'fa-briefcase';
$target = pht('Normal Project');
$note = pht('Users with access may join and leave this project.');
$show_join = true;
}
$item = id(new PHUIStatusItemView())
->setIcon($icon)
->setTarget(phutil_tag('strong', array(), $target))
->setNote($note);
$status = id(new PHUIStatusListView())
->addItem($item);
$view->addProperty(pht('Membership'), $status);
if ($show_join) {
$descriptions = PhabricatorPolicyQuery::renderPolicyDescriptions(
$viewer,
$project);
$view->addProperty(
pht('Joinable By'),
$descriptions[PhabricatorPolicyCapability::CAN_JOIN]);
}
$viewer_phid = $viewer->getPHID();
if ($project->isUserWatcher($viewer_phid)) {
$watch_item = id(new PHUIStatusItemView())
->setIcon('fa-eye green')
->setTarget(phutil_tag('strong', array(), pht('Watching')))
->setNote(
pht(
'You will receive mail about changes made to any related '.
'object.'));
$watch_status = id(new PHUIStatusListView())
->addItem($watch_item);
$view->addProperty(pht('Watching'), $watch_status);
}
if ($project->isUserMember($viewer_phid)) {
$is_silenced = $this->isProjectSilenced($project);
if ($is_silenced) {
$mail_icon = 'fa-envelope-o grey';
$mail_target = pht('Disabled');
$mail_note = pht(
'When mail is sent to project members, you will not receive '.
'a copy.');
} else {
$mail_icon = 'fa-envelope-o green';
$mail_target = pht('Enabled');
$mail_note = pht(
'You will receive mail that is sent to project members.');
}
$mail_item = id(new PHUIStatusItemView())
->setIcon($mail_icon)
->setTarget(phutil_tag('strong', array(), $mail_target))
->setNote($mail_note);
$mail_status = id(new PHUIStatusListView())
->addItem($mail_item);
$view->addProperty(pht('Mail to Members'), $mail_status);
}
return $view;
}
private function buildCurtainView(PhabricatorProject $project) {
$viewer = $this->getViewer();
$id = $project->getID();
@ -272,6 +168,42 @@ final class PhabricatorProjectMembersViewController
->setDisabled(!$can_lock)
->setWorkflow(true));
if ($project->isMilestone()) {
$icon_key = PhabricatorProjectIconSet::getMilestoneIconKey();
$header = PhabricatorProjectIconSet::getIconName($icon_key);
$note = pht(
'Members of the parent project are members of this project.');
$show_join = false;
} else if ($project->getHasSubprojects()) {
$header = pht('Parent Project');
$note = pht(
'Members of all subprojects are members of this project.');
$show_join = false;
} else if ($project->getIsMembershipLocked()) {
$header = pht('Locked Project');
$note = pht(
'Users with access may join this project, but may not leave.');
$show_join = true;
} else {
$header = pht('Normal Project');
$note = pht('Users with access may join and leave this project.');
$show_join = true;
}
$curtain->newPanel()
->setHeaderText($header)
->appendChild($note);
if ($show_join) {
$descriptions = PhabricatorPolicyQuery::renderPolicyDescriptions(
$viewer,
$project);
$curtain->newPanel()
->setHeaderText(pht('Joinable By'))
->appendChild($descriptions[PhabricatorPolicyCapability::CAN_JOIN]);
}
return $curtain;
}

View file

@ -4,7 +4,7 @@ final class PhabricatorProjectMemberListView
extends PhabricatorProjectUserListView {
protected function canEditList() {
$viewer = $this->getUser();
$viewer = $this->getViewer();
$project = $this->getProject();
if (!$project->supportsEditMembers()) {
@ -31,4 +31,35 @@ final class PhabricatorProjectMemberListView
return pht('Members');
}
protected function getMembershipNote() {
$viewer = $this->getViewer();
$viewer_phid = $viewer->getPHID();
$project = $this->getProject();
if (!$viewer_phid) {
return null;
}
$note = null;
if ($project->isUserMember($viewer_phid)) {
$edge_type = PhabricatorProjectSilencedEdgeType::EDGECONST;
$silenced = PhabricatorEdgeQuery::loadDestinationPHIDs(
$project->getPHID(),
$edge_type);
$silenced = array_fuse($silenced);
$is_silenced = isset($silenced[$viewer_phid]);
if ($is_silenced) {
$note = pht(
'You have disabled mail. When mail is sent to project members, '.
'you will not receive a copy.');
} else {
$note = pht(
'You are a member and you will receive mail that is sent to all '.
'project members.');
}
}
return $note;
}
}

View file

@ -43,6 +43,7 @@ abstract class PhabricatorProjectUserListView extends AphrontView {
abstract protected function getNoDataString();
abstract protected function getRemoveURI($phid);
abstract protected function getHeaderText();
abstract protected function getMembershipNote();
public function render() {
$viewer = $this->getViewer();
@ -135,6 +136,13 @@ abstract class PhabricatorProjectUserListView extends AphrontView {
->setHeader($header)
->setObjectList($list);
if ($this->getMembershipNote()) {
$info = id(new PHUIInfoView())
->setSeverity(PHUIInfoView::SEVERITY_PLAIN)
->appendChild($this->getMembershipNote());
$box->setInfoView($info);
}
if ($this->background) {
$box->setBackground($this->background);
}

View file

@ -4,7 +4,7 @@ final class PhabricatorProjectWatcherListView
extends PhabricatorProjectUserListView {
protected function canEditList() {
$viewer = $this->getUser();
$viewer = $this->getViewer();
$project = $this->getProject();
return PhabricatorPolicyFilter::hasCapability(
@ -27,4 +27,17 @@ final class PhabricatorProjectWatcherListView
return pht('Watchers');
}
protected function getMembershipNote() {
$viewer = $this->getViewer();
$viewer_phid = $viewer->getPHID();
$project = $this->getProject();
$note = null;
if ($project->isUserWatcher($viewer_phid)) {
$note = pht('You are watching this project and will receive mail about '.
'changes made to any related object.');
}
return $note;
}
}

View file

@ -7,6 +7,7 @@ final class PHUIInfoView extends AphrontTagView {
const SEVERITY_NOTICE = 'notice';
const SEVERITY_NODATA = 'nodata';
const SEVERITY_SUCCESS = 'success';
const SEVERITY_PLAIN = 'plain';
private $title;
private $errors;
@ -52,8 +53,14 @@ final class PHUIInfoView extends AphrontTagView {
return $this;
}
public function setIcon(PHUIIconView $icon) {
$this->icon = $icon;
public function setIcon($icon) {
if ($icon instanceof PHUIIconView) {
$this->icon = $icon;
} else {
$icon = id(new PHUIIconView())
->setIcon($icon);
}
return $this;
}
@ -72,6 +79,7 @@ final class PHUIInfoView extends AphrontTagView {
case self::SEVERITY_NOTICE:
$icon = 'fa-info-circle';
break;
case self::SEVERITY_PLAIN:
case self::SEVERITY_NODATA:
return null;
break;

View file

@ -11,6 +11,14 @@
border-radius: 3px;
}
div.phui-info-view.phui-info-severity-plain {
background: {$lightgreybackground};
color: {$bluetext};
border: none;
padding: 8px 12px;
margin-bottom: 4px !important;
}
.phui-info-view.phui-info-view-flush {
margin: 0 0 20px 0;
}