diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index 9716e7180e..e3b6af7974 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -4059,6 +4059,7 @@ phutil_register_library_map(array( 'PhabricatorProjectColumnOrder' => 'applications/project/order/PhabricatorProjectColumnOrder.php', 'PhabricatorProjectColumnOwnerOrder' => 'applications/project/order/PhabricatorProjectColumnOwnerOrder.php', 'PhabricatorProjectColumnPHIDType' => 'applications/project/phid/PhabricatorProjectColumnPHIDType.php', + 'PhabricatorProjectColumnPointsOrder' => 'applications/project/order/PhabricatorProjectColumnPointsOrder.php', 'PhabricatorProjectColumnPosition' => 'applications/project/storage/PhabricatorProjectColumnPosition.php', 'PhabricatorProjectColumnPositionQuery' => 'applications/project/query/PhabricatorProjectColumnPositionQuery.php', 'PhabricatorProjectColumnPriorityOrder' => 'applications/project/order/PhabricatorProjectColumnPriorityOrder.php', @@ -10145,6 +10146,7 @@ phutil_register_library_map(array( 'PhabricatorProjectColumnOrder' => 'Phobject', 'PhabricatorProjectColumnOwnerOrder' => 'PhabricatorProjectColumnOrder', 'PhabricatorProjectColumnPHIDType' => 'PhabricatorPHIDType', + 'PhabricatorProjectColumnPointsOrder' => 'PhabricatorProjectColumnOrder', 'PhabricatorProjectColumnPosition' => array( 'PhabricatorProjectDAO', 'PhabricatorPolicyInterface', diff --git a/src/applications/project/controller/PhabricatorProjectBoardViewController.php b/src/applications/project/controller/PhabricatorProjectBoardViewController.php index 8784847f37..cc95958bf7 100644 --- a/src/applications/project/controller/PhabricatorProjectBoardViewController.php +++ b/src/applications/project/controller/PhabricatorProjectBoardViewController.php @@ -616,7 +616,7 @@ final class PhabricatorProjectBoardViewController $order_key = $this->sortKey; - $ordering_map = PhabricatorProjectColumnOrder::getAllOrders(); + $ordering_map = PhabricatorProjectColumnOrder::getEnabledOrders(); $ordering = id(clone $ordering_map[$order_key]) ->setViewer($viewer); @@ -635,6 +635,12 @@ final class PhabricatorProjectBoardViewController $order_maps[] = $ordering->toDictionary(); $properties = array(); + foreach ($all_tasks as $task) { + $properties[$task->getPHID()] = array( + 'points' => (double)$task->getPoints(), + 'status' => $task->getStatus(), + ); + } $behavior_config = array( 'moveURI' => $this->getApplicationURI('move/'.$project->getID().'/'), @@ -771,7 +777,7 @@ final class PhabricatorProjectBoardViewController } private function isValidSort($sort) { - $map = PhabricatorProjectColumnOrder::getAllOrders(); + $map = PhabricatorProjectColumnOrder::getEnabledOrders(); return isset($map[$sort]); } @@ -820,6 +826,9 @@ final class PhabricatorProjectBoardViewController $project, PhabricatorPolicyCapability::CAN_EDIT); + $items[] = id(new PhabricatorActionView()) + ->setType(PhabricatorActionView::TYPE_DIVIDER); + $items[] = id(new PhabricatorActionView()) ->setIcon('fa-floppy-o') ->setName(pht('Save as Default')) @@ -918,6 +927,9 @@ final class PhabricatorProjectBoardViewController $project, PhabricatorPolicyCapability::CAN_EDIT); + $items[] = id(new PhabricatorActionView()) + ->setType(PhabricatorActionView::TYPE_DIVIDER); + $items[] = id(new PhabricatorActionView()) ->setIcon('fa-floppy-o') ->setName(pht('Save as Default')) diff --git a/src/applications/project/order/PhabricatorProjectColumnCreatedOrder.php b/src/applications/project/order/PhabricatorProjectColumnCreatedOrder.php index 945445aecf..9fd2145886 100644 --- a/src/applications/project/order/PhabricatorProjectColumnCreatedOrder.php +++ b/src/applications/project/order/PhabricatorProjectColumnCreatedOrder.php @@ -21,10 +21,14 @@ final class PhabricatorProjectColumnCreatedOrder return false; } + public function getMenuOrder() { + return 3000; + } + protected function newSortVectorForObject($object) { return array( - (int)-$object->getDateCreated(), - (int)-$object->getID(), + -(int)$object->getDateCreated(), + -(int)$object->getID(), ); } diff --git a/src/applications/project/order/PhabricatorProjectColumnNaturalOrder.php b/src/applications/project/order/PhabricatorProjectColumnNaturalOrder.php index b21a554715..be67d28bcc 100644 --- a/src/applications/project/order/PhabricatorProjectColumnNaturalOrder.php +++ b/src/applications/project/order/PhabricatorProjectColumnNaturalOrder.php @@ -17,4 +17,8 @@ final class PhabricatorProjectColumnNaturalOrder return true; } + public function getMenuOrder() { + return 0; + } + } diff --git a/src/applications/project/order/PhabricatorProjectColumnOrder.php b/src/applications/project/order/PhabricatorProjectColumnOrder.php index f3a1ed86ca..c2da400fb2 100644 --- a/src/applications/project/order/PhabricatorProjectColumnOrder.php +++ b/src/applications/project/order/PhabricatorProjectColumnOrder.php @@ -22,9 +22,22 @@ abstract class PhabricatorProjectColumnOrder return id(new PhutilClassMapQuery()) ->setAncestorClass(__CLASS__) ->setUniqueMethod('getColumnOrderKey') + ->setSortMethod('getMenuOrder') ->execute(); } + final public static function getEnabledOrders() { + $map = self::getAllOrders(); + + foreach ($map as $key => $order) { + if (!$order->isEnabled()) { + unset($map[$key]); + } + } + + return $map; + } + final public static function getOrderByKey($key) { $map = self::getAllOrders(); @@ -71,6 +84,14 @@ abstract class PhabricatorProjectColumnOrder abstract public function getHasHeaders(); abstract public function getCanReorder(); + public function getMenuOrder() { + return 9000; + } + + public function isEnabled() { + return true; + } + protected function newColumnTransactions($object, array $header) { return array(); } diff --git a/src/applications/project/order/PhabricatorProjectColumnOwnerOrder.php b/src/applications/project/order/PhabricatorProjectColumnOwnerOrder.php index a41b78a11c..97ae0f24d4 100644 --- a/src/applications/project/order/PhabricatorProjectColumnOwnerOrder.php +++ b/src/applications/project/order/PhabricatorProjectColumnOwnerOrder.php @@ -21,6 +21,10 @@ final class PhabricatorProjectColumnOwnerOrder return true; } + public function getMenuOrder() { + return 2000; + } + protected function newHeaderKeyForObject($object) { return $this->newHeaderKeyForOwnerPHID($object->getOwnerPHID()); } diff --git a/src/applications/project/order/PhabricatorProjectColumnPointsOrder.php b/src/applications/project/order/PhabricatorProjectColumnPointsOrder.php new file mode 100644 index 0000000000..ad75f6135b --- /dev/null +++ b/src/applications/project/order/PhabricatorProjectColumnPointsOrder.php @@ -0,0 +1,50 @@ +getPoints(); + + // Put cards with no points on top. + $has_points = ($points !== null); + if (!$has_points) { + $overall_order = 0; + } else { + $overall_order = 1; + } + + return array( + $overall_order, + -(double)$points, + -(int)$object->getID(), + ); + } + +} diff --git a/src/applications/project/order/PhabricatorProjectColumnPriorityOrder.php b/src/applications/project/order/PhabricatorProjectColumnPriorityOrder.php index 64a5934e26..1a73145148 100644 --- a/src/applications/project/order/PhabricatorProjectColumnPriorityOrder.php +++ b/src/applications/project/order/PhabricatorProjectColumnPriorityOrder.php @@ -21,6 +21,10 @@ final class PhabricatorProjectColumnPriorityOrder return true; } + public function getMenuOrder() { + return 1000; + } + protected function newHeaderKeyForObject($object) { return $this->newHeaderKeyForPriority($object->getPriority()); } @@ -35,7 +39,7 @@ final class PhabricatorProjectColumnPriorityOrder private function newSortVectorForPriority($priority) { return array( - (int)-$priority, + -(int)$priority, ); }