diff --git a/resources/sql/autopatches/20140808.boardprop.1.sql b/resources/sql/autopatches/20140808.boardprop.1.sql new file mode 100644 index 0000000000..9325c148a4 --- /dev/null +++ b/resources/sql/autopatches/20140808.boardprop.1.sql @@ -0,0 +1,2 @@ +ALTER TABLE {$NAMESPACE}_project.project_column + ADD properties LONGTEXT NOT NULL COLLATE utf8_bin; diff --git a/resources/sql/autopatches/20140808.boardprop.2.sql b/resources/sql/autopatches/20140808.boardprop.2.sql new file mode 100644 index 0000000000..d7716898dd --- /dev/null +++ b/resources/sql/autopatches/20140808.boardprop.2.sql @@ -0,0 +1,2 @@ +UPDATE {$NAMESPACE}_project.project_column + SET properties = '{}' WHERE properties = ''; diff --git a/resources/sql/autopatches/20140808.boardprop.3.php b/resources/sql/autopatches/20140808.boardprop.3.php new file mode 100644 index 0000000000..116cc773a3 --- /dev/null +++ b/resources/sql/autopatches/20140808.boardprop.3.php @@ -0,0 +1,24 @@ +establishConnection('w'); + +foreach (new LiskMigrationIterator($table) as $column) { + $id = $column->getID(); + + echo "Adjusting column {$id}...\n"; + if ($column->getSequence() == 0) { + + $properties = $column->getProperties(); + $properties['isDefault'] = true; + + queryfx( + $conn_w, + 'UPDATE %T SET properties = %s WHERE id = %d', + $table->getTableName(), + json_encode($properties), + $id); + } +} + +echo "Done.\n"; diff --git a/src/applications/project/controller/PhabricatorProjectBoardImportController.php b/src/applications/project/controller/PhabricatorProjectBoardImportController.php index 75823b3308..4861582a20 100644 --- a/src/applications/project/controller/PhabricatorProjectBoardImportController.php +++ b/src/applications/project/controller/PhabricatorProjectBoardImportController.php @@ -60,6 +60,7 @@ final class PhabricatorProjectBoardImportController ->setSequence($import_column->getSequence()) ->setProjectPHID($project->getPHID()) ->setName($import_column->getName()) + ->setProperties($import_column->getProperties()) ->save(); } $table->saveTransaction(); diff --git a/src/applications/project/controller/PhabricatorProjectBoardReorderController.php b/src/applications/project/controller/PhabricatorProjectBoardReorderController.php index 0660f8428a..864b28911f 100644 --- a/src/applications/project/controller/PhabricatorProjectBoardReorderController.php +++ b/src/applications/project/controller/PhabricatorProjectBoardReorderController.php @@ -54,11 +54,9 @@ final class PhabricatorProjectBoardReorderController return new Aphront404Response(); } - // TODO: We could let you move the backlog column around if you really - // want, but for now we use sequence position 0 as magic. $target_column = $columns[$column_phid]; $new_sequence = $request->getInt('sequence'); - if ($target_column->isDefaultColumn() || $new_sequence < 1) { + if ($new_sequence < 0) { return new Aphront404Response(); } @@ -101,11 +99,6 @@ final class PhabricatorProjectBoardReorderController $list_id = celerity_generate_unique_node_id(); - $static_list = id(new PHUIObjectItemListView()) - ->setUser($viewer) - ->setFlush(true) - ->setStackable(true); - $list = id(new PHUIObjectItemListView()) ->setUser($viewer) ->setID($list_id) @@ -120,21 +113,15 @@ final class PhabricatorProjectBoardReorderController $item->setDisabled(true); } - if ($column->isDefaultColumn()) { - $item->setDisabled(true); - $static_list->addItem($item); - } else { - $item->setGrippable(true); - $item->addSigil('board-column'); - $item->setMetadata( - array( - 'columnPHID' => $column->getPHID(), - 'columnSequence' => $column->getSequence(), - )); - - $list->addItem($item); - } + $item->setGrippable(true); + $item->addSigil('board-column'); + $item->setMetadata( + array( + 'columnPHID' => $column->getPHID(), + 'columnSequence' => $column->getSequence(), + )); + $list->addItem($item); } Javelin::initBehavior( @@ -147,9 +134,7 @@ final class PhabricatorProjectBoardReorderController return $this->newDialog() ->setTitle(pht('Reorder Columns')) ->setWidth(AphrontDialogView::WIDTH_FORM) - ->appendParagraph(pht('This column can not be moved:')) - ->appendChild($static_list) - ->appendParagraph(pht('Drag and drop these columns to reorder them:')) + ->appendParagraph(pht('Drag and drop columns to reorder them.')) ->appendChild($list) ->addSubmitButton(pht('Done')); } diff --git a/src/applications/project/controller/PhabricatorProjectBoardViewController.php b/src/applications/project/controller/PhabricatorProjectBoardViewController.php index c670ef56cf..118593f39c 100644 --- a/src/applications/project/controller/PhabricatorProjectBoardViewController.php +++ b/src/applications/project/controller/PhabricatorProjectBoardViewController.php @@ -74,6 +74,7 @@ final class PhabricatorProjectBoardViewController $unguarded = AphrontWriteGuard::beginScopedUnguardedWrites(); $column = PhabricatorProjectColumn::initializeNewColumn($viewer) ->setSequence(0) + ->setProperty('isDefault', true) ->setProjectPHID($project->getPHID()) ->save(); $column->attachProject($project); diff --git a/src/applications/project/storage/PhabricatorProjectColumn.php b/src/applications/project/storage/PhabricatorProjectColumn.php index f602b7b217..eec88dbcbc 100644 --- a/src/applications/project/storage/PhabricatorProjectColumn.php +++ b/src/applications/project/storage/PhabricatorProjectColumn.php @@ -17,6 +17,7 @@ final class PhabricatorProjectColumn protected $status; protected $projectPHID; protected $sequence; + protected $properties = array(); private $project = self::ATTACHABLE; @@ -29,6 +30,9 @@ final class PhabricatorProjectColumn public function getConfiguration() { return array( self::CONFIG_AUX_PHID => true, + self::CONFIG_SERIALIZATION => array( + 'properties' => self::SERIALIZATION_JSON, + ), ) + parent::getConfiguration(); } @@ -47,7 +51,7 @@ final class PhabricatorProjectColumn } public function isDefaultColumn() { - return ($this->getSequence() == 0); + return (bool)$this->getProperty('isDefault'); } public function isHidden() { @@ -75,9 +79,19 @@ final class PhabricatorProjectColumn if ($this->isDefaultColumn()) { return PHUIActionHeaderView::HEADER_DARK_GREY; } + return PHUIActionHeaderView::HEADER_GREY; } + public function getProperty($key, $default = null) { + return idx($this->properties, $key, $default); + } + + public function setProperty($key, $value) { + $this->properties[$key] = $value; + return $this; + } + /* -( PhabricatorPolicyInterface )----------------------------------------- */ diff --git a/webroot/rsrc/js/application/projects/behavior-reorder-columns.js b/webroot/rsrc/js/application/projects/behavior-reorder-columns.js index 8b0a2c33fa..0125f4d0e3 100644 --- a/webroot/rsrc/js/application/projects/behavior-reorder-columns.js +++ b/webroot/rsrc/js/application/projects/behavior-reorder-columns.js @@ -37,7 +37,7 @@ JX.behavior('reorder-columns', function(config) { var parameters = { columnPHID: node_data.columnPHID, - sequence: (sequence === null) ? 1 : (parseInt(sequence, 10) + 1) + sequence: (sequence === null) ? 0 : (parseInt(sequence, 10) + 1) }; new JX.Workflow(config.reorderURI, parameters)