Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F2685760
D25066.1734704333.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Advanced/Developer...
View Handle
View Hovercard
Size
4 KB
Referenced Files
None
Subscribers
None
D25066.1734704333.diff
View Options
diff --git a/src/applications/project/controller/PhabricatorProjectColumnEditController.php b/src/applications/project/controller/PhabricatorProjectColumnEditController.php
--- a/src/applications/project/controller/PhabricatorProjectColumnEditController.php
+++ b/src/applications/project/controller/PhabricatorProjectColumnEditController.php
@@ -45,16 +45,31 @@
$e_name = null;
$e_limit = null;
+ $e_milestone_name = null;
+ // Project's Column fields.
$v_limit = $column->getPointLimit();
$v_name = $column->getName();
+ // a Milestones is not really a Column, you know.
+ $milestone = null;
+ if ($column->getProxy()) {
+ $milestone = $column->getProxy();
+ }
+
+ // Milestone name field.
+ $v_milestone_name = null;
+ if ($milestone) {
+ $v_milestone_name = $milestone->getName();
+ }
+
$validation_exception = null;
$view_uri = $project->getWorkboardURI();
if ($request->isFormPost()) {
$v_name = $request->getStr('name');
$v_limit = $request->getStr('limit');
+ $v_milestone_name = $request->getStr('milestone.name');
if ($is_new) {
$column->setProjectPHID($project->getPHID());
@@ -74,38 +89,89 @@
}
$xactions = array();
+ $xactions_milestone = array();
$type_name = PhabricatorProjectColumnNameTransaction::TRANSACTIONTYPE;
$type_limit = PhabricatorProjectColumnLimitTransaction::TRANSACTIONTYPE;
-
- if (!$column->getProxy()) {
+ $type_project_name = PhabricatorProjectNameTransaction::TRANSACTIONTYPE;
+
+ if ($milestone) {
+ // Milestone name
+ $xactions_milestone[] = id(new PhabricatorProjectTransaction())
+ ->setTransactionType($type_project_name)
+ ->setNewValue($v_milestone_name);
+ } else {
+ // Column name
$xactions[] = id(new PhabricatorProjectColumnTransaction())
->setTransactionType($type_name)
->setNewValue($v_name);
}
+ // Column Points
$xactions[] = id(new PhabricatorProjectColumnTransaction())
->setTransactionType($type_limit)
->setNewValue($v_limit);
+ // Be pessimist.
+ $great_success = false;
+
+ // Let's start saving the Column-related stuff
+ // kind of, "first the ladies"
try {
$editor = id(new PhabricatorProjectColumnTransactionEditor())
->setActor($viewer)
->setContinueOnNoEffect(true)
->setContentSourceFromRequest($request)
->applyTransactions($column, $xactions);
- return id(new AphrontRedirectResponse())->setURI($view_uri);
+ $great_success = true;
} catch (PhabricatorApplicationTransactionValidationException $ex) {
$e_name = $ex->getShortMessage($type_name);
$e_limit = $ex->getShortMessage($type_limit);
$validation_exception = $ex;
}
+
+ // Try to save also the Milestone-related stuff.
+ // Only if good things happened, obviously.
+ if ($milestone && $xactions_milestone && $great_success) {
+
+ // Be pessimist, again.
+ $great_success = false;
+
+ try {
+ $editor = id(new PhabricatorProjectTransactionEditor())
+ ->setActor($viewer)
+ ->setContinueOnNoEffect(true)
+ ->setContentSourceFromRequest($request)
+ ->applyTransactions($milestone, $xactions_milestone);
+
+ // Wonderful!
+ $great_success = true;
+ } catch (PhabricatorApplicationTransactionValidationException $ex) {
+ $e_milestone_name = $ex->getShortMessage($type_project_name);
+ $validation_exception = $ex;
+ }
+ }
+
+ // I never expected to get this far. Time to go home.
+ if ($great_success) {
+ return id(new AphrontRedirectResponse())->setURI($view_uri);
+ }
+
}
$form = id(new AphrontFormView())
->setUser($request->getUser());
- if (!$column->getProxy()) {
+ if ($milestone) {
+ // Milestone name field
+ $form->appendChild(
+ id(new AphrontFormTextControl())
+ ->setValue($v_milestone_name)
+ ->setLabel(pht('Milestone Name'))
+ ->setName('milestone.name')
+ ->setError($e_milestone_name));
+ } else {
+ // Project Column name field
$form->appendChild(
id(new AphrontFormTextControl())
->setValue($v_name)
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Dec 20, 14:18 (21 h, 34 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1017227
Default Alt Text
D25066.1734704333.diff (4 KB)
Attached To
Mode
D25066: Workboard: Milestone Name easily editable (instead of surfing 3 pages)
Attached
Detach File
Event Timeline
Log In to Comment