diff --git a/resources/celerity/map.php b/resources/celerity/map.php --- a/resources/celerity/map.php +++ b/resources/celerity/map.php @@ -9,7 +9,7 @@ '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 @@ '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 @@ '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', diff --git a/src/applications/project/controller/PhabricatorProjectMembersViewController.php b/src/applications/project/controller/PhabricatorProjectMembersViewController.php --- a/src/applications/project/controller/PhabricatorProjectMembersViewController.php +++ b/src/applications/project/controller/PhabricatorProjectMembersViewController.php @@ -20,15 +20,8 @@ $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 @@ ->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 @@ ->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 @@ ->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; } diff --git a/src/applications/project/view/PhabricatorProjectMemberListView.php b/src/applications/project/view/PhabricatorProjectMemberListView.php --- a/src/applications/project/view/PhabricatorProjectMemberListView.php +++ b/src/applications/project/view/PhabricatorProjectMemberListView.php @@ -4,7 +4,7 @@ extends PhabricatorProjectUserListView { protected function canEditList() { - $viewer = $this->getUser(); + $viewer = $this->getViewer(); $project = $this->getProject(); if (!$project->supportsEditMembers()) { @@ -31,4 +31,35 @@ 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; + } + } diff --git a/src/applications/project/view/PhabricatorProjectUserListView.php b/src/applications/project/view/PhabricatorProjectUserListView.php --- a/src/applications/project/view/PhabricatorProjectUserListView.php +++ b/src/applications/project/view/PhabricatorProjectUserListView.php @@ -43,6 +43,7 @@ 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 @@ ->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); } diff --git a/src/applications/project/view/PhabricatorProjectWatcherListView.php b/src/applications/project/view/PhabricatorProjectWatcherListView.php --- a/src/applications/project/view/PhabricatorProjectWatcherListView.php +++ b/src/applications/project/view/PhabricatorProjectWatcherListView.php @@ -4,7 +4,7 @@ extends PhabricatorProjectUserListView { protected function canEditList() { - $viewer = $this->getUser(); + $viewer = $this->getViewer(); $project = $this->getProject(); return PhabricatorPolicyFilter::hasCapability( @@ -27,4 +27,17 @@ 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; + } + } diff --git a/src/view/form/PHUIInfoView.php b/src/view/form/PHUIInfoView.php --- a/src/view/form/PHUIInfoView.php +++ b/src/view/form/PHUIInfoView.php @@ -7,6 +7,7 @@ const SEVERITY_NOTICE = 'notice'; const SEVERITY_NODATA = 'nodata'; const SEVERITY_SUCCESS = 'success'; + const SEVERITY_PLAIN = 'plain'; private $title; private $errors; @@ -52,8 +53,14 @@ 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 @@ case self::SEVERITY_NOTICE: $icon = 'fa-info-circle'; break; + case self::SEVERITY_PLAIN: case self::SEVERITY_NODATA: return null; break; diff --git a/webroot/rsrc/css/phui/phui-info-view.css b/webroot/rsrc/css/phui/phui-info-view.css --- a/webroot/rsrc/css/phui/phui-info-view.css +++ b/webroot/rsrc/css/phui/phui-info-view.css @@ -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; }