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']
],
'routes' => [
// Web page templates
['name' => 'page#index', 'url' => '/', 'verb' => 'GET'],
['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', 'verb' => 'GET', 'postfix' => 'search'],
// Settings
['name' => 'settings#set_menu_state', 'url' => '/settings/menuState', '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
['name' => 'station_api#preflighted_cors', 'url' => '/api/0.1/{path}',
'verb' => 'OPTIONS', 'requirements' => ['path' => '.+']]
// Web page templates
[
'name' => 'page#index',
'url' => '/',
'verb' => 'GET'
],
[
'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
[
'name' => 'settings#set_menu_state',
'url' => '/settings/menuState',
'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
[
'name' => 'station_api#preflighted_cors',
'url' => '/api/0.1/{path}',
'verb' => 'OPTIONS',
'requirements' => ['path' => '.+']
]
]
];

View File

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

View File

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

View File

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