navigation: show search results length badge

This commit is contained in:
Jonas Heinrich 2020-11-11 10:51:20 +01:00
parent 1cf223395a
commit f421548979
6 changed files with 24 additions and 15 deletions

View File

@ -68,10 +68,9 @@ return [
],
[
'name' => 'page#index',
'url' => '/search/{query}',
'url' => '/search',
'verb' => 'GET',
'postfix' => 'search',
'requirements' => ['query' => '.+'],
],
// Settings

View File

@ -23,3 +23,4 @@
@include icon-black-white('recent', 'radio', 1);
@include icon-black-white('radio', 'radio', 1);
@include icon-black-white('radio-trans', 'radio', 1);

View File

@ -69,8 +69,8 @@ class SearchProvider implements IProvider {
$result['favicon'],
$result['name'],
str_replace(",",", ",$result['tags']),
$this->url->linkToRouteAbsolute('radio.page.index') . 'search/'.$term.'#/search/'.$term,
'icon-radio'
$this->url->linkToRouteAbsolute('radio.page.index') . 'search#'.$term,
'icon-radio-trans'
);
}, $parsed);

View File

@ -1,6 +1,7 @@
<template>
<Content app-name="radio">
<Navigation />
<Navigation
:station-data="tableData" />
<AppContent>
<Breadcrumbs class="breadcrumbs">
<Breadcrumb title="Home" href="/" />
@ -192,7 +193,7 @@ export default {
let queryURI = queryBase
if (menuState === 'SEARCH') {
const searchQuery = vm.$route.params.query
const searchQuery = vm.$route.hash.substr(1)
queryURI = queryBase + '/byname/' + searchQuery
} else if (menuState === 'FAVORITES') {
queryURI = generateUrl('/apps/radio/api/favorites')

View File

@ -26,8 +26,10 @@
:to="{ name: 'SEARCH' }"
icon="icon-search"
:title="t('radio', 'Search')">
<AppNavigationCounter slot="counter" :highlighted="true">
99+
<AppNavigationCounter
slot="counter"
:highlighted="true">
{{ stationData.length }}
</AppNavigationCounter>
</AppNavigationItem>
</template>
@ -52,6 +54,12 @@ export default {
AppNavigationCounter,
Player,
},
props: {
stationData: {
type: Array,
default() { return [] },
},
},
computed: {
isSearch() {
return this.$route.name === 'SEARCH'
@ -59,3 +67,9 @@ export default {
},
}
</script>
<style>
.app-navigation-entry__utils {
margin-right: 10px;
}
</style>

View File

@ -39,7 +39,7 @@ const router = new Router({
name: 'CATEGORIES',
},
{
path: '/search/:query',
path: '/search',
component: Main,
name: 'SEARCH',
},
@ -48,12 +48,6 @@ const router = new Router({
router.beforeEach((to, from, next) => {
if (to.hash) {
const hashPath = to.hash.substr(1)
next(hashPath)
return
}
if (to.name) {
store.dispatch('setMenuState', to.name)
next()