Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14477662
D8574.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
12 KB
Referenced Files
None
Subscribers
None
D8574.diff
View Options
diff --git a/resources/celerity/map.php b/resources/celerity/map.php
--- a/resources/celerity/map.php
+++ b/resources/celerity/map.php
@@ -95,7 +95,6 @@
'rsrc/css/application/ponder/post.css' => 'ebab8a70',
'rsrc/css/application/ponder/vote.css' => '8ed6ed8b',
'rsrc/css/application/profile/profile-view.css' => '9bdb9804',
- 'rsrc/css/application/projects/phabricator-object-list-view.css' => '1a1ea560',
'rsrc/css/application/projects/project-tag.css' => '095c9404',
'rsrc/css/application/releeph/releeph-branch.css' => 'b8821d2d',
'rsrc/css/application/releeph/releeph-colors.css' => '2d2d6aa8',
@@ -705,7 +704,6 @@
'phabricator-notification' => '0c6946e7',
'phabricator-notification-css' => '6901121e',
'phabricator-notification-menu-css' => 'fc9a363c',
- 'phabricator-object-list-view-css' => '1a1ea560',
'phabricator-object-selector-css' => '029a133d',
'phabricator-phtize' => 'd254d646',
'phabricator-prefab' => '0326e5d0',
diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php
--- a/src/__phutil_library_map__.php
+++ b/src/__phutil_library_map__.php
@@ -1735,7 +1735,6 @@
'PhabricatorObjectHandleStatus' => 'applications/phid/handle/const/PhabricatorObjectHandleStatus.php',
'PhabricatorObjectListQuery' => 'applications/phid/query/PhabricatorObjectListQuery.php',
'PhabricatorObjectListQueryTestCase' => 'applications/phid/query/__tests__/PhabricatorObjectListQueryTestCase.php',
- 'PhabricatorObjectListView' => 'view/control/PhabricatorObjectListView.php',
'PhabricatorObjectMailReceiver' => 'applications/metamta/receiver/PhabricatorObjectMailReceiver.php',
'PhabricatorObjectMailReceiverTestCase' => 'applications/metamta/receiver/__tests__/PhabricatorObjectMailReceiverTestCase.php',
'PhabricatorObjectQuery' => 'applications/phid/query/PhabricatorObjectQuery.php',
@@ -1864,6 +1863,7 @@
'PhabricatorProjectEditorTestCase' => 'applications/project/editor/__tests__/PhabricatorProjectEditorTestCase.php',
'PhabricatorProjectListController' => 'applications/project/controller/PhabricatorProjectListController.php',
'PhabricatorProjectMembersEditController' => 'applications/project/controller/PhabricatorProjectMembersEditController.php',
+ 'PhabricatorProjectMembersRemoveController' => 'applications/project/controller/PhabricatorProjectMembersRemoveController.php',
'PhabricatorProjectMoveController' => 'applications/project/controller/PhabricatorProjectMoveController.php',
'PhabricatorProjectNameCollisionException' => 'applications/project/exception/PhabricatorProjectNameCollisionException.php',
'PhabricatorProjectPHIDTypeColumn' => 'applications/project/phid/PhabricatorProjectPHIDTypeColumn.php',
@@ -4494,7 +4494,6 @@
'PhabricatorObjectHandle' => 'PhabricatorPolicyInterface',
'PhabricatorObjectHandleStatus' => 'PhabricatorObjectHandleConstants',
'PhabricatorObjectListQueryTestCase' => 'PhabricatorTestCase',
- 'PhabricatorObjectListView' => 'AphrontView',
'PhabricatorObjectMailReceiver' => 'PhabricatorMailReceiver',
'PhabricatorObjectMailReceiverTestCase' => 'PhabricatorTestCase',
'PhabricatorObjectQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
@@ -4654,6 +4653,7 @@
1 => 'PhabricatorApplicationSearchResultsControllerInterface',
),
'PhabricatorProjectMembersEditController' => 'PhabricatorProjectController',
+ 'PhabricatorProjectMembersRemoveController' => 'PhabricatorProjectController',
'PhabricatorProjectMoveController' => 'PhabricatorProjectController',
'PhabricatorProjectNameCollisionException' => 'Exception',
'PhabricatorProjectPHIDTypeColumn' => 'PhabricatorPHIDType',
diff --git a/src/applications/project/application/PhabricatorApplicationProject.php b/src/applications/project/application/PhabricatorApplicationProject.php
--- a/src/applications/project/application/PhabricatorApplicationProject.php
+++ b/src/applications/project/application/PhabricatorApplicationProject.php
@@ -44,6 +44,8 @@
'PhabricatorProjectArchiveController',
'members/(?P<id>[1-9]\d*)/'
=> 'PhabricatorProjectMembersEditController',
+ 'members/(?P<id>[1-9]\d*)/remove/'
+ => 'PhabricatorProjectMembersRemoveController',
'view/(?P<id>[1-9]\d*)/'
=> 'PhabricatorProjectProfileController',
'picture/(?P<id>[1-9]\d*)/' =>
diff --git a/src/applications/project/controller/PhabricatorProjectMembersEditController.php b/src/applications/project/controller/PhabricatorProjectMembersEditController.php
--- a/src/applications/project/controller/PhabricatorProjectMembersEditController.php
+++ b/src/applications/project/controller/PhabricatorProjectMembersEditController.php
@@ -76,8 +76,6 @@
$header_name = pht('Edit Members');
$title = pht('Edit Members');
- $list = $this->renderMemberList($handles);
-
$form = new AphrontFormView();
$form
->setUser($user)
@@ -90,15 +88,8 @@
id(new AphrontFormSubmitControl())
->addCancelButton('/project/view/'.$project->getID().'/')
->setValue(pht('Add Members')));
- $faux_form = id(new AphrontFormView())
- ->setUser($user)
- ->appendChild(
- id(new AphrontFormInsetView())
- ->appendChild($list));
- $box = id(new PHUIObjectBoxView())
- ->setHeaderText(pht('Current Members (%d)', count($handles)))
- ->setForm($faux_form);
+ $member_list = $this->renderMemberList($project, $handles);
$form_box = id(new PHUIObjectBoxView())
->setHeaderText($title)
@@ -114,7 +105,7 @@
array(
$crumbs,
$form_box,
- $box,
+ $member_list,
),
array(
'title' => $title,
@@ -122,38 +113,33 @@
));
}
- private function renderMemberList(array $handles) {
+ private function renderMemberList(
+ PhabricatorProject $project,
+ array $handles) {
+
$request = $this->getRequest();
- $user = $request->getUser();
- $list = id(new PhabricatorObjectListView())
- ->setHandles($handles);
+ $viewer = $request->getUser();
+
+ $list = id(new PHUIObjectItemListView())
+ ->setNoDataString(pht('This project does not have any members.'));
foreach ($handles as $handle) {
- $hidden_input = phutil_tag(
- 'input',
- array(
- 'type' => 'hidden',
- 'name' => 'remove',
- 'value' => $handle->getPHID(),
- ),
- '');
-
- $button = javelin_tag(
- 'button',
- array(
- 'class' => 'grey',
- ),
- pht('Remove'));
-
- $list->addButton(
- $handle,
- phabricator_form(
- $user,
- array(
- 'method' => 'POST',
- 'action' => $request->getRequestURI(),
- ),
- array($hidden_input, $button)));
+ $remove_uri = $this->getApplicationURI(
+ '/members/'.$project->getID().'/remove/?phid='.$handle->getPHID());
+
+ $item = id(new PHUIObjectItemView())
+ ->setHeader($handle->getFullName())
+ ->setHref($handle->getURI())
+ ->setImageURI($handle->getImageURI());
+
+ $item->addAction(
+ id(new PHUIListItemView())
+ ->setIcon('delete')
+ ->setName(pht('Remove'))
+ ->setHref($remove_uri)
+ ->setWorkflow(true));
+
+ $list->addItem($item);
}
return $list;
diff --git a/src/applications/project/controller/PhabricatorProjectMembersRemoveController.php b/src/applications/project/controller/PhabricatorProjectMembersRemoveController.php
new file mode 100644
--- /dev/null
+++ b/src/applications/project/controller/PhabricatorProjectMembersRemoveController.php
@@ -0,0 +1,82 @@
+<?php
+
+final class PhabricatorProjectMembersRemoveController
+ extends PhabricatorProjectController {
+
+ private $id;
+
+ public function willProcessRequest(array $data) {
+ $this->id = $data['id'];
+ }
+
+ public function processRequest() {
+ $request = $this->getRequest();
+ $viewer = $request->getUser();
+
+ $project = id(new PhabricatorProjectQuery())
+ ->setViewer($viewer)
+ ->withIDs(array($this->id))
+ ->needMembers(true)
+ ->requireCapabilities(
+ array(
+ PhabricatorPolicyCapability::CAN_VIEW,
+ PhabricatorPolicyCapability::CAN_EDIT,
+ ))
+ ->executeOne();
+ if (!$project) {
+ return new Aphront404Response();
+ }
+
+ $member_phids = $project->getMemberPHIDs();
+ $remove_phid = $request->getStr('phid');
+
+ if (!in_array($remove_phid, $member_phids)) {
+ return new Aphront404Response();
+ }
+
+ $members_uri = $this->getApplicationURI('members/'.$project->getID().'/');
+
+ if ($request->isFormPost()) {
+ $member_spec = array();
+ $member_spec['-'] = array($remove_phid => $remove_phid);
+
+ $type_member = PhabricatorEdgeConfig::TYPE_PROJ_MEMBER;
+
+ $xactions = array();
+
+ $xactions[] = id(new PhabricatorProjectTransaction())
+ ->setTransactionType(PhabricatorTransactions::TYPE_EDGE)
+ ->setMetadataValue('edge:type', $type_member)
+ ->setNewValue($member_spec);
+
+ $editor = id(new PhabricatorProjectTransactionEditor($project))
+ ->setActor($viewer)
+ ->setContentSourceFromRequest($request)
+ ->setContinueOnNoEffect(true)
+ ->setContinueOnMissingFields(true)
+ ->applyTransactions($project, $xactions);
+
+ return id(new AphrontRedirectResponse())
+ ->setURI($members_uri);
+ }
+
+ $handle = id(new PhabricatorHandleQuery())
+ ->setViewer($viewer)
+ ->withPHIDs(array($remove_phid))
+ ->executeOne();
+
+ $dialog = id(new AphrontDialogView())
+ ->setUser($viewer)
+ ->setTitle(pht('Really Remove Member?'))
+ ->appendParagraph(
+ pht(
+ 'Really remove %s from the project %s?',
+ phutil_tag('strong', array(), $handle->getName()),
+ phutil_tag('strong', array(), $project->getName())))
+ ->addCancelButton($members_uri)
+ ->addSubmitButton(pht('Remove Project Member'));
+
+ return id(new AphrontDialogResponse())->setDialog($dialog);
+ }
+
+}
diff --git a/src/view/control/PhabricatorObjectListView.php b/src/view/control/PhabricatorObjectListView.php
deleted file mode 100644
--- a/src/view/control/PhabricatorObjectListView.php
+++ /dev/null
@@ -1,59 +0,0 @@
-<?php
-
-final class PhabricatorObjectListView extends AphrontView {
-
- private $handles = array();
- private $buttons = array();
-
- public function setHandles(array $handles) {
- assert_instances_of($handles, 'PhabricatorObjectHandle');
-
- $this->handles = $handles;
- return $this;
- }
-
- public function addButton(PhabricatorObjectHandle $handle, $button) {
- $this->buttons[$handle->getPHID()][] = $button;
- return $this;
- }
-
- public function render() {
- $handles = $this->handles;
-
- require_celerity_resource('phabricator-object-list-view-css');
-
- $out = array();
- foreach ($handles as $handle) {
- $buttons = idx($this->buttons, $handle->getPHID(), array());
- if ($buttons) {
- $buttons = phutil_tag(
- 'div',
- array(
- 'class' => 'phabricator-object-list-view-buttons',
- ),
- $buttons);
- } else {
- $buttons = null;
- }
-
- $out[] = javelin_tag(
- 'div',
- array(
- 'class' => 'phabricator-object-list-view-item',
- 'style' => 'background-image: url('.$handle->getImageURI().');',
- ),
- array(
- $handle->renderLink(),
- $buttons,
- ));
- }
-
- return phutil_tag(
- 'div',
- array(
- 'class' => 'phabricator-object-list-view',
- ),
- $out);
- }
-
-}
diff --git a/webroot/rsrc/css/application/projects/phabricator-object-list-view.css b/webroot/rsrc/css/application/projects/phabricator-object-list-view.css
deleted file mode 100644
--- a/webroot/rsrc/css/application/projects/phabricator-object-list-view.css
+++ /dev/null
@@ -1,27 +0,0 @@
-/**
- * @provides phabricator-object-list-view-css
- */
-
-.phabricator-object-list-view {
- max-height: 400px;
- overflow-y: auto;
-}
-
-.phabricator-object-list-view-item {
- line-height: 60px;
- background-repeat: no-repeat;
- background-position: 5px 5px;
- padding-left: 70px;
- position: relative;
-}
-
-.phabricator-object-list-view-item + .phabricator-object-list-view-item {
- border-top: 1px solid rgba(0, 0, 0, 0.05);
-}
-
-.phabricator-object-list-view-buttons {
- position: absolute;
- text-align: right;
- top: 0;
- right: 0;
-}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Dec 29, 3:02 PM (8 h, 55 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6942621
Default Alt Text
D8574.diff (12 KB)
Attached To
Mode
D8574: Use standard UI kit on project member page
Attached
Detach File
Event Timeline
Log In to Comment