diff options
-rw-r--r-- | lib/Controller/NavigationController.php | 14 | ||||
-rw-r--r-- | templates/navigate.php | 30 |
2 files changed, 32 insertions, 12 deletions
diff --git a/lib/Controller/NavigationController.php b/lib/Controller/NavigationController.php index da2977a..97a51e2 100644 --- a/lib/Controller/NavigationController.php +++ b/lib/Controller/NavigationController.php @@ -36,6 +36,7 @@ use OCA\FullTextSearch\Service\ConfigService; use OCA\FullTextSearch\Service\MiscService; use OCP\AppFramework\Controller; use OCP\AppFramework\Http\TemplateResponse; +use OCP\FullTextSearch\IFullTextSearchManager; use OCP\IConfig; use OCP\IRequest; @@ -51,6 +52,9 @@ class NavigationController extends Controller { /** @var IConfig */ private $config; + /** @var IFullTextSearchManager */ + private $fullTextSearchManager; + /** @var ConfigService */ private $configService; @@ -67,10 +71,12 @@ class NavigationController extends Controller { * @param MiscService $miscService */ public function __construct( - IRequest $request, IConfig $config, ConfigService $configService, MiscService $miscService + IRequest $request, IConfig $config, IFullTextSearchManager $fullTextSearchManager, + ConfigService $configService, MiscService $miscService ) { parent::__construct(Application::APP_NAME, $request); $this->config = $config; + $this->fullTextSearchManager = $fullTextSearchManager; $this->configService = $configService; $this->miscService = $miscService; } @@ -87,7 +93,11 @@ class NavigationController extends Controller { $themingName = $this->config->getAppValue('theming', 'name', 'Nextcloud'); - $data = ['themingName' => $themingName]; + $data = [ + 'themingName' => $themingName + ]; + + $this->fullTextSearchManager->addJavascriptAPI(); return new TemplateResponse(Application::APP_NAME, 'navigate', $data); } diff --git a/templates/navigate.php b/templates/navigate.php index daaa86b..e8eac1d 100644 --- a/templates/navigate.php +++ b/templates/navigate.php @@ -1,4 +1,7 @@ <?php +declare(strict_types=1); + + /** * FullTextSearch - Full text search framework for Nextcloud * @@ -24,11 +27,18 @@ * */ -use OCA\FullTextSearch\Api\v1\FullTextSearch; + use OCA\FullTextSearch\AppInfo\Application; +use OCP\FullTextSearch\IFullTextSearchManager; use OCP\Util; -FullTextSearch::addJavascriptAPI(); + +if (isset($_) && is_array($_) && array_key_exists('fullTextSearchManager', $_)) { + /** @var IFullTextSearchManager $fullTextSearchManager */ + $fullTextSearchManager = $_['fullTextSearchManager']; + $fullTextSearchManager->addJavascriptAPI(); +} + Util::addScript(Application::APP_NAME, 'navigate'); Util::addStyle(Application::APP_NAME, 'navigate'); @@ -37,14 +47,14 @@ Util::addStyle(Application::APP_NAME, 'navigate'); <div id="app-navigation"> <ul id="search_navigation"> <li style="height: 50px"> - <div id="search_header"> - <div> - <input id="search_input" - placeholder="<?php p( - $l->t('Search on %s', [$_['themingName']]) - ); ?>"> - </div> + <div id="search_header"> + <div> + <input id="search_input" + placeholder="<?php p( + $l->t('Search on %s', [$_['themingName']]) + ); ?>"> </div> + </div> </li> </ul> </div> @@ -70,4 +80,4 @@ Util::addStyle(Application::APP_NAME, 'navigate'); </div> </div> -</script>
\ No newline at end of file +</script> |