@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator

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

+36
+5
src/applications/project/controller/PhabricatorProjectMembersAddController.php
··· 27 27 $copy = pht('Parent projects and milestones do not support adding '. 28 28 'members. You can add members directly to any non-parent subproject.'); 29 29 30 + $subprojects_uri = "/project/subprojects/{$id}/"; 31 + 30 32 return $this->newDialog() 31 33 ->setTitle(pht('Unsupported Project')) 32 34 ->appendParagraph($copy) 35 + ->setSubmitURI($subprojects_uri) 36 + ->addSubmitButton(pht('See Subprojects')) 37 + ->setDisableWorkflowOnSubmit(true) 33 38 ->addCancelButton($done_uri); 34 39 } 35 40
+5
src/applications/project/controller/PhabricatorProjectUpdateController.php
··· 38 38 $copy = pht('Parent projects and milestones do not support adding '. 39 39 'members. You can add members directly to any non-parent subproject.'); 40 40 41 + $subprojects_uri = "/project/subprojects/{$id}/"; 42 + 41 43 return $this->newDialog() 42 44 ->setTitle(pht('Unsupported Project')) 43 45 ->appendParagraph($copy) 46 + ->setSubmitURI($subprojects_uri) 47 + ->addSubmitButton(pht('See Subprojects')) 48 + ->setDisableWorkflowOnSubmit(true) 44 49 ->addCancelButton($done_uri); 45 50 } 46 51
+26
src/view/AphrontDialogView.php
··· 51 51 return $this->isStandalone; 52 52 } 53 53 54 + /** 55 + * Set the URI associated to the Submit Button 56 + * 57 + * If you want a normal link and not any form submission, 58 + * see also: setDisableWorkflowOnSubmit(false). 59 + * 60 + * @param string $uri 61 + * @return self 62 + */ 54 63 public function setSubmitURI($uri) { 55 64 $this->submitURI = $uri; 56 65 return $this; ··· 92 101 return $this->resizeX; 93 102 } 94 103 104 + /** 105 + * Add a Submit Button and specify its text 106 + * 107 + * If you want to associate an URI for this Button, 108 + * see also: setSubmitURI(). 109 + * 110 + * @param string $text Text shown for that button 111 + * @return self 112 + */ 95 113 public function addSubmitButton($text = null) { 96 114 if (!$text) { 97 115 $text = pht('Okay'); ··· 228 246 return $this->appendChild($form->buildLayoutView()); 229 247 } 230 248 249 + /** 250 + * Enable or Disable a Workflow on Submit 251 + * 252 + * For example, if your Submit Button should be a normal link, 253 + * without activating any Workflow, you can set false. 254 + * @param bool $disable_workflow_on_submit 255 + * @return self 256 + */ 231 257 public function setDisableWorkflowOnSubmit($disable_workflow_on_submit) { 232 258 $this->disableWorkflowOnSubmit = $disable_workflow_on_submit; 233 259 return $this;