fix showing search results

This commit is contained in:
Jonas Heinrich 2020-11-10 17:45:12 +01:00
parent c15932c590
commit f4ac135246
3 changed files with 17 additions and 3 deletions

View File

@ -64,12 +64,12 @@ class SearchProvider implements IProvider {
$body = $response->getBody(); $body = $response->getBody();
$parsed = json_decode($body, true); $parsed = json_decode($body, true);
$result = array_map(function (array $result) { $result = array_map(function (array $result) use ($term) {
return new SearchResultEntry( return new SearchResultEntry(
$result['favicon'], $result['favicon'],
$result['name'], $result['name'],
str_replace(",",", ",$result['tags']), str_replace(",",", ",$result['tags']),
'#/search/virus', $this->url->linkToRouteAbsolute('radio.page.index') . 'search/'.$term.'#/search/'.$term,
'icon-radio' 'icon-radio'
); );
}, $parsed); }, $parsed);

View File

@ -25,7 +25,11 @@
v-if="isSearch" v-if="isSearch"
:to="{ name: 'SEARCH' }" :to="{ name: 'SEARCH' }"
icon="icon-search" icon="icon-search"
:title="t('radio', 'Search')" /> :title="t('radio', 'Search')">
<AppNavigationCounter slot="counter" :highlighted="true">
99+
</AppNavigationCounter>
</AppNavigationItem>
</template> </template>
<template #footer> <template #footer>
<Player <Player
@ -37,6 +41,7 @@
<script> <script>
import AppNavigation from '@nextcloud/vue/dist/Components/AppNavigation' import AppNavigation from '@nextcloud/vue/dist/Components/AppNavigation'
import AppNavigationItem from '@nextcloud/vue/dist/Components/AppNavigationItem' import AppNavigationItem from '@nextcloud/vue/dist/Components/AppNavigationItem'
import AppNavigationCounter from '@nextcloud/vue/dist/Components/AppNavigationCounter'
import Player from './Player' import Player from './Player'
export default { export default {
@ -44,6 +49,7 @@ export default {
components: { components: {
AppNavigation, AppNavigation,
AppNavigationItem, AppNavigationItem,
AppNavigationCounter,
Player, Player,
}, },
computed: { computed: {

View File

@ -47,6 +47,13 @@ const router = new Router({
}) })
router.beforeEach((to, from, next) => { router.beforeEach((to, from, next) => {
if (to.hash) {
const hashPath = to.hash.substr(1)
next(hashPath)
return
}
if (to.name) { if (to.name) {
store.dispatch('setMenuState', to.name) store.dispatch('setMenuState', to.name)
next() next()
@ -60,6 +67,7 @@ router.beforeEach((to, from, next) => {
next({ name: value }) next({ name: value })
}) })
} }
}) })
export default router export default router