1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-09-19 16:58:48 +02:00

Members page of Parent Subproject: less dead-end

Summary:
When you visit the Members page of a Parent Subproject,
some actions are greyed out by design. And, if you click on
them, nothing really useful happens to continue with what
you want to do.

For example, see this page and click on "Join Project":

https://we.phorge.it/project/members/1/

After this change, the interface at least provides a link to
proceed to the next step of what you wanted to do - that is -
allowing to quickly list direct Subprojects and do something
more meaningful than that.

A/B for the "Join Project" view:

| Before    | After     |
|-----------|-----------|
| {F282337} | {F282331} |

A/B for the "Add Members" view:

| Before    | After     |
|-----------|-----------|
| {F282338} | {F282332} |

Just to be nice, this change adds some inline documentation
on some methods of AphrontDialogView used here.

Closes T15258

Test Plan:
- Create a Project (A) with a Subproject (B)
- Visit Members page of (A)
- Click on Join Project and click on the Blue Button
- Click on the Add Member and click on Blue Button
- in both cases it should get you to Subprojects list

Reviewers: O1 Blessed Committers, Matthew

Reviewed By: O1 Blessed Committers, Matthew

Subscribers: speck, tobiaswiese, Matthew, Cigaryno

Maniphest Tasks: T15258

Differential Revision: https://we.phorge.it/D25127
This commit is contained in:
Valerio Bozzolan 2023-04-25 20:52:51 +02:00
parent 935d7120ee
commit a89b4ff5b8
3 changed files with 36 additions and 0 deletions

View file

@ -27,9 +27,14 @@ final class PhabricatorProjectMembersAddController
$copy = pht('Parent projects and milestones do not support adding '.
'members. You can add members directly to any non-parent subproject.');
$subprojects_uri = "/project/subprojects/{$id}/";
return $this->newDialog()
->setTitle(pht('Unsupported Project'))
->appendParagraph($copy)
->setSubmitURI($subprojects_uri)
->addSubmitButton(pht('See Subprojects'))
->setDisableWorkflowOnSubmit(true)
->addCancelButton($done_uri);
}

View file

@ -38,9 +38,14 @@ final class PhabricatorProjectUpdateController
$copy = pht('Parent projects and milestones do not support adding '.
'members. You can add members directly to any non-parent subproject.');
$subprojects_uri = "/project/subprojects/{$id}/";
return $this->newDialog()
->setTitle(pht('Unsupported Project'))
->appendParagraph($copy)
->setSubmitURI($subprojects_uri)
->addSubmitButton(pht('See Subprojects'))
->setDisableWorkflowOnSubmit(true)
->addCancelButton($done_uri);
}

View file

@ -51,6 +51,15 @@ final class AphrontDialogView
return $this->isStandalone;
}
/**
* Set the URI associated to the Submit Button
*
* If you want a normal link and not any form submission,
* see also: setDisableWorkflowOnSubmit(false).
*
* @param string $uri
* @return self
*/
public function setSubmitURI($uri) {
$this->submitURI = $uri;
return $this;
@ -92,6 +101,15 @@ final class AphrontDialogView
return $this->resizeX;
}
/**
* Add a Submit Button and specify its text
*
* If you want to associate an URI for this Button,
* see also: setSubmitURI().
*
* @param string $text Text shown for that button
* @return self
*/
public function addSubmitButton($text = null) {
if (!$text) {
$text = pht('Okay');
@ -228,6 +246,14 @@ final class AphrontDialogView
return $this->appendChild($form->buildLayoutView());
}
/**
* Enable or Disable a Workflow on Submit
*
* For example, if your Submit Button should be a normal link,
* without activating any Workflow, you can set false.
* @param bool $disable_workflow_on_submit
* @return self
*/
public function setDisableWorkflowOnSubmit($disable_workflow_on_submit) {
$this->disableWorkflowOnSubmit = $disable_workflow_on_submit;
return $this;