mirror of
https://we.phorge.it/source/phorge.git
synced 2025-01-12 07:41:04 +01:00
Add a Phurl Typeahead
Summary: Adds a basic typeahead for Phurl Objects. Test Plan: http://local.phacility.com/typeahead/browse/PhabricatorPhurlURLDatasource/ Reviewers: epriestley Reviewed By: epriestley Subscribers: Korvin Differential Revision: https://secure.phabricator.com/D17339
This commit is contained in:
parent
29dc9e9ae1
commit
8b2880cfb7
2 changed files with 37 additions and 0 deletions
|
@ -3371,6 +3371,7 @@ phutil_register_library_map(array(
|
||||||
'PhabricatorPhurlURLAccessController' => 'applications/phurl/controller/PhabricatorPhurlURLAccessController.php',
|
'PhabricatorPhurlURLAccessController' => 'applications/phurl/controller/PhabricatorPhurlURLAccessController.php',
|
||||||
'PhabricatorPhurlURLCommentController' => 'applications/phurl/controller/PhabricatorPhurlURLCommentController.php',
|
'PhabricatorPhurlURLCommentController' => 'applications/phurl/controller/PhabricatorPhurlURLCommentController.php',
|
||||||
'PhabricatorPhurlURLCreateCapability' => 'applications/phurl/capability/PhabricatorPhurlURLCreateCapability.php',
|
'PhabricatorPhurlURLCreateCapability' => 'applications/phurl/capability/PhabricatorPhurlURLCreateCapability.php',
|
||||||
|
'PhabricatorPhurlURLDatasource' => 'applications/phurl/typeahead/PhabricatorPhurlURLDatasource.php',
|
||||||
'PhabricatorPhurlURLEditConduitAPIMethod' => 'applications/phurl/conduit/PhabricatorPhurlURLEditConduitAPIMethod.php',
|
'PhabricatorPhurlURLEditConduitAPIMethod' => 'applications/phurl/conduit/PhabricatorPhurlURLEditConduitAPIMethod.php',
|
||||||
'PhabricatorPhurlURLEditController' => 'applications/phurl/controller/PhabricatorPhurlURLEditController.php',
|
'PhabricatorPhurlURLEditController' => 'applications/phurl/controller/PhabricatorPhurlURLEditController.php',
|
||||||
'PhabricatorPhurlURLEditEngine' => 'applications/phurl/editor/PhabricatorPhurlURLEditEngine.php',
|
'PhabricatorPhurlURLEditEngine' => 'applications/phurl/editor/PhabricatorPhurlURLEditEngine.php',
|
||||||
|
@ -8521,6 +8522,7 @@ phutil_register_library_map(array(
|
||||||
'PhabricatorPhurlURLAccessController' => 'PhabricatorPhurlController',
|
'PhabricatorPhurlURLAccessController' => 'PhabricatorPhurlController',
|
||||||
'PhabricatorPhurlURLCommentController' => 'PhabricatorPhurlController',
|
'PhabricatorPhurlURLCommentController' => 'PhabricatorPhurlController',
|
||||||
'PhabricatorPhurlURLCreateCapability' => 'PhabricatorPolicyCapability',
|
'PhabricatorPhurlURLCreateCapability' => 'PhabricatorPolicyCapability',
|
||||||
|
'PhabricatorPhurlURLDatasource' => 'PhabricatorTypeaheadDatasource',
|
||||||
'PhabricatorPhurlURLEditConduitAPIMethod' => 'PhabricatorEditEngineAPIMethod',
|
'PhabricatorPhurlURLEditConduitAPIMethod' => 'PhabricatorEditEngineAPIMethod',
|
||||||
'PhabricatorPhurlURLEditController' => 'PhabricatorPhurlController',
|
'PhabricatorPhurlURLEditController' => 'PhabricatorPhurlController',
|
||||||
'PhabricatorPhurlURLEditEngine' => 'PhabricatorEditEngine',
|
'PhabricatorPhurlURLEditEngine' => 'PhabricatorEditEngine',
|
||||||
|
|
|
@ -0,0 +1,35 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
final class PhabricatorPhurlURLDatasource
|
||||||
|
extends PhabricatorTypeaheadDatasource {
|
||||||
|
|
||||||
|
public function getBrowseTitle() {
|
||||||
|
return pht('Browse Phurl URLs');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getPlaceholderText() {
|
||||||
|
return pht('Select a phurl...');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getDatasourceApplicationClass() {
|
||||||
|
return 'PhabricatorPhurlApplication';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function loadResults() {
|
||||||
|
$query = id(new PhabricatorPhurlURLQuery());
|
||||||
|
$urls = $this->executeQuery($query);
|
||||||
|
$results = array();
|
||||||
|
foreach ($urls as $url) {
|
||||||
|
$result = id(new PhabricatorTypeaheadResult())
|
||||||
|
->setDisplayName($url->getName())
|
||||||
|
->setName($url->getName()." ".$url->getAlias())
|
||||||
|
->setPHID($url->getPHID())
|
||||||
|
->addAttribute($url->getLongURL());
|
||||||
|
|
||||||
|
$results[] = $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->filterResultsAgainstTokens($results);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in a new issue