Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14044425
D15262.id36827.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
4 KB
Referenced Files
None
Subscribers
None
D15262.id36827.diff
View Options
diff --git a/src/applications/project/engine/PhabricatorProjectEditEngine.php b/src/applications/project/engine/PhabricatorProjectEditEngine.php
--- a/src/applications/project/engine/PhabricatorProjectEditEngine.php
+++ b/src/applications/project/engine/PhabricatorProjectEditEngine.php
@@ -43,17 +43,7 @@
}
protected function newEditableObject() {
- $project = PhabricatorProject::initializeNewProject($this->getViewer());
-
- $milestone = $this->getMilestoneProject();
- if ($milestone) {
- $default_name = pht(
- 'Milestone %s',
- new PhutilNumber($milestone->loadNextMilestoneNumber()));
- $project->setName($default_name);
- }
-
- return $project;
+ return PhabricatorProject::initializeNewProject($this->getViewer());
}
protected function newObjectQuery() {
@@ -139,6 +129,7 @@
array(
'parent',
'milestone',
+ 'milestone.previous',
'name',
'std:project:internal:description',
'icon',
@@ -166,8 +157,26 @@
$parent_phid = null;
}
+ $previous_milestone_phid = null;
if ($milestone) {
$milestone_phid = $milestone->getPHID();
+
+ // Load the current milestone so we can show the user a hint about what
+ // it was called, so they don't have to remember if the next one should
+ // be "Sprint 287" or "Sprint 278".
+
+ $number = ($milestone->loadNextMilestoneNumber() - 1);
+ if ($number > 0) {
+ $previous_milestone = id(new PhabricatorProjectQuery())
+ ->setViewer($this->getViewer())
+ ->withParentProjectPHIDs(array($milestone->getPHID()))
+ ->withIsMilestone(true)
+ ->withMilestoneNumberBetween($number, $number)
+ ->executeOne();
+ if ($previous_milestone) {
+ $previous_milestone_phid = $previous_milestone->getPHID();
+ }
+ }
} else {
$milestone_phid = null;
}
@@ -203,6 +212,14 @@
->setIsDefaultable(false)
->setIsLockable(false)
->setIsLocked(true),
+ id(new PhabricatorHandlesEditField())
+ ->setKey('milestone.previous')
+ ->setLabel(pht('Previous Milestone'))
+ ->setSingleValue($previous_milestone_phid)
+ ->setIsReorderable(false)
+ ->setIsDefaultable(false)
+ ->setIsLockable(false)
+ ->setIsLocked(true),
id(new PhabricatorTextEditField())
->setKey('name')
->setLabel(pht('Name'))
diff --git a/src/applications/project/query/PhabricatorProjectQuery.php b/src/applications/project/query/PhabricatorProjectQuery.php
--- a/src/applications/project/query/PhabricatorProjectQuery.php
+++ b/src/applications/project/query/PhabricatorProjectQuery.php
@@ -20,6 +20,8 @@
private $hasSubprojects;
private $minDepth;
private $maxDepth;
+ private $minMilestoneNumber;
+ private $maxMilestoneNumber;
private $status = 'status-any';
const STATUS_ANY = 'status-any';
@@ -111,6 +113,12 @@
return $this;
}
+ public function withMilestoneNumberBetween($min, $max) {
+ $this->minMilestoneNumber = $min;
+ $this->maxMilestoneNumber = $max;
+ return $this;
+ }
+
public function needMembers($need_members) {
$this->needMembers = $need_members;
return $this;
@@ -494,6 +502,7 @@
}
}
+
if ($this->hasSubprojects !== null) {
$where[] = qsprintf(
$conn,
@@ -515,6 +524,20 @@
$this->maxDepth);
}
+ if ($this->minMilestoneNumber !== null) {
+ $where[] = qsprintf(
+ $conn,
+ 'milestoneNumber >= %d',
+ $this->minMilestoneNumber);
+ }
+
+ if ($this->maxMilestoneNumber !== null) {
+ $where[] = qsprintf(
+ $conn,
+ 'milestoneNumber <= %d',
+ $this->maxMilestoneNumber);
+ }
+
return $where;
}
diff --git a/src/applications/transactions/storage/PhabricatorEditEngineConfiguration.php b/src/applications/transactions/storage/PhabricatorEditEngineConfiguration.php
--- a/src/applications/transactions/storage/PhabricatorEditEngineConfiguration.php
+++ b/src/applications/transactions/storage/PhabricatorEditEngineConfiguration.php
@@ -175,8 +175,20 @@
}
private function reorderFields(array $fields) {
+ // Fields which can not be reordered are fixed in order at the top of the
+ // form. These are used to show instructions or contextual information.
+
+ $fixed = array();
+ foreach ($fields as $key => $field) {
+ if (!$field->getIsReorderable()) {
+ $fixed[$key] = $field;
+ }
+ }
+
$keys = $this->getFieldOrder();
- $fields = array_select_keys($fields, $keys) + $fields;
+
+ $fields = $fixed + array_select_keys($fields, $keys) + $fields;
+
return $fields;
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Nov 13, 4:08 PM (5 d, 8 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6724376
Default Alt Text
D15262.id36827.diff (4 KB)
Attached To
Mode
D15262: Don't autoname milestones, but do show the previous milestone name as a hint
Attached
Detach File
Event Timeline
Log In to Comment