starting to implement search page

This commit is contained in:
Jonas Heinrich 2020-11-05 09:51:48 +01:00
parent a6fc70ac1b
commit d016d6fb16
4 changed files with 83 additions and 17 deletions

View File

@ -27,21 +27,80 @@ return [
'station_api' => ['url' => '/api/0.1/stations'] 'station_api' => ['url' => '/api/0.1/stations']
], ],
'routes' => [ 'routes' => [
// Web page templates // Web page templates
['name' => 'page#index', 'url' => '/', 'verb' => 'GET'], [
['name' => 'page#index', 'url' => '/top', 'verb' => 'GET', 'postfix' => 'top'], 'name' => 'page#index',
['name' => 'page#index', 'url' => '/recent', 'verb' => 'GET', 'postfix' => 'recent'], 'url' => '/',
['name' => 'page#index', 'url' => '/new', 'verb' => 'GET', 'postfix' => 'new'], 'verb' => 'GET'
['name' => 'page#index', 'url' => '/favorites', 'verb' => 'GET', 'postfix' => 'favorites'], ],
['name' => 'page#index', 'url' => '/categories', 'verb' => 'GET', 'postfix' => 'categories'], [
['name' => 'page#index', 'url' => '/search', 'verb' => 'GET', 'postfix' => 'search'], 'name' => 'page#index',
'url' => '/top',
'verb' => 'GET',
'postfix' => 'top'
],
[
'name' => 'page#index',
'url' => '/recent',
'verb' => 'GET',
'postfix' => 'recent'
],
[
'name' => 'page#index',
'url' => '/new',
'verb' => 'GET',
'postfix' => 'new'
],
[
'name' => 'page#index',
'url' => '/favorites',
'verb' => 'GET',
'postfix' => 'favorites'
],
[
'name' => 'page#index',
'url' => '/categories',
'verb' => 'GET',
'postfix' => 'categories'
],
[
'name' => 'page#index',
'url' => '/search/{query}',
'verb' => 'GET',
'postfix' => 'search',
'requirements' => ['query' => '.+'],
],
// Settings // Settings
['name' => 'settings#set_menu_state', 'url' => '/settings/menuState', 'verb' => 'POST'], [
['name' => 'settings#get_menu_state', 'url' => '/settings/menuState', 'verb' => 'GET'], 'name' => 'settings#set_menu_state',
['name' => 'settings#set_volume_state', 'url' => '/settings/volumeState', 'verb' => 'POST'], 'url' => '/settings/menuState',
['name' => 'settings#get_volume_state', 'url' => '/settings/volumeState', 'verb' => 'GET'], 'verb' => 'POST'
],
[
'name' => 'settings#get_menu_state',
'url' => '/settings/menuState',
'verb' => 'GET'
],
[
'name' => 'settings#set_volume_state',
'url' => '/settings/volumeState',
'verb' => 'POST'
],
[
'name' => 'settings#get_volume_state',
'url' => '/settings/volumeState',
'verb' => 'GET'
],
// Api // Api
['name' => 'station_api#preflighted_cors', 'url' => '/api/0.1/{path}', [
'verb' => 'OPTIONS', 'requirements' => ['path' => '.+']] 'name' => 'station_api#preflighted_cors',
'url' => '/api/0.1/{path}',
'verb' => 'OPTIONS',
'requirements' => ['path' => '.+']
]
] ]
]; ];

View File

@ -75,6 +75,7 @@ export default {
}, },
created() { created() {
this.loadSettings() this.loadSettings()
console.log('my route ', this.$route.name)
}, },
mounted() { mounted() {
this.loadStations() this.loadStations()

View File

@ -22,6 +22,7 @@
icon="icon-files-dark" icon="icon-files-dark"
:title="t('radio', 'Categories')" /> :title="t('radio', 'Categories')" />
<AppNavigationItem <AppNavigationItem
v-if="isSearch"
:to="{ name: 'SEARCH' }" :to="{ name: 'SEARCH' }"
icon="icon-search" icon="icon-search"
:title="t('radio', 'Search')" /> :title="t('radio', 'Search')" />
@ -45,5 +46,10 @@ export default {
AppNavigationItem, AppNavigationItem,
Player, Player,
}, },
computed: {
isSearch() {
return this.$route.name === 'SEARCH'
},
},
} }
</script> </script>

View File

@ -39,7 +39,7 @@ const router = new Router({
name: 'CATEGORIES', name: 'CATEGORIES',
}, },
{ {
path: '/search', path: '/search/:query',
component: Main, component: Main,
name: 'SEARCH', name: 'SEARCH',
}, },