mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-24 14:30:56 +01:00
Support sorting countdowns by end date
Summary: Fixes T5813, while I'm in here... Test Plan: Sorted stuff by end date. Reviewers: chad Reviewed By: chad Maniphest Tasks: T5813 Differential Revision: https://secure.phabricator.com/D15657
This commit is contained in:
parent
cdec319143
commit
0900ffe9cb
3 changed files with 48 additions and 11 deletions
|
@ -74,4 +74,35 @@ final class PhabricatorCountdownQuery
|
||||||
return 'PhabricatorCountdownApplication';
|
return 'PhabricatorCountdownApplication';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getBuiltinOrders() {
|
||||||
|
return array(
|
||||||
|
'ending' => array(
|
||||||
|
'vector' => array('-epoch', '-id'),
|
||||||
|
'name' => pht('End Date (Past to Future)'),
|
||||||
|
),
|
||||||
|
'unending' => array(
|
||||||
|
'vector' => array('epoch', 'id'),
|
||||||
|
'name' => pht('End Date (Future to Past)'),
|
||||||
|
),
|
||||||
|
) + parent::getBuiltinOrders();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getOrderableColumns() {
|
||||||
|
return array(
|
||||||
|
'epoch' => array(
|
||||||
|
'table' => $this->getPrimaryTableAlias(),
|
||||||
|
'column' => 'epoch',
|
||||||
|
'type' => 'int',
|
||||||
|
),
|
||||||
|
) + parent::getOrderableColumns();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function getPagingValueMap($cursor, array $keys) {
|
||||||
|
$countdown = $this->loadCursorObject($cursor);
|
||||||
|
return array(
|
||||||
|
'epoch' => $countdown->getEpoch(),
|
||||||
|
'id' => $countdown->getID(),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,20 +30,18 @@ final class PhabricatorCountdownSearchEngine
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function buildCustomSearchFields() {
|
protected function buildCustomSearchFields() {
|
||||||
|
|
||||||
return array(
|
return array(
|
||||||
id(new PhabricatorUsersSearchField())
|
id(new PhabricatorUsersSearchField())
|
||||||
->setLabel(pht('Authors'))
|
->setLabel(pht('Authors'))
|
||||||
->setKey('authorPHIDs')
|
->setKey('authorPHIDs')
|
||||||
->setAliases(array('author', 'authors')),
|
->setAliases(array('author', 'authors')),
|
||||||
|
id(new PhabricatorSearchCheckboxesField())
|
||||||
id(new PhabricatorSearchCheckboxesField())
|
->setKey('upcoming')
|
||||||
->setKey('upcoming')
|
->setOptions(
|
||||||
->setOptions(array(
|
array(
|
||||||
'upcoming' => pht('Show only upcoming countdowns.'),
|
'upcoming' => pht('Show only upcoming countdowns.'),
|
||||||
)),
|
)),
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getURI($path) {
|
protected function getURI($path) {
|
||||||
|
|
|
@ -46,6 +46,14 @@ final class PhabricatorCountdown extends PhabricatorCountdownDAO
|
||||||
'description' => 'text',
|
'description' => 'text',
|
||||||
'mailKey' => 'bytes20',
|
'mailKey' => 'bytes20',
|
||||||
),
|
),
|
||||||
|
self::CONFIG_KEY_SCHEMA => array(
|
||||||
|
'key_epoch' => array(
|
||||||
|
'columns' => array('epoch'),
|
||||||
|
),
|
||||||
|
'key_author' => array(
|
||||||
|
'columns' => array('authorPHID', 'epoch'),
|
||||||
|
),
|
||||||
|
),
|
||||||
) + parent::getConfiguration();
|
) + parent::getConfiguration();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue