Skip to content

Commit

Permalink
enh(Contexts): set active navigation entry
Browse files Browse the repository at this point in the history
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
  • Loading branch information
blizzz committed Apr 30, 2024
1 parent b8c1a2c commit 2701178
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,15 @@ export default {
if (currentRoute.path.startsWith('/table/')) {
this.$store.commit('setActiveTableId', parseInt(currentRoute.params.tableId))
this.setPageTitle(this.$store.getters.activeTable.title)
this.switchActiveMenuEntry(document.querySelector('header .header-left .app-menu li[data-app-id="tables"]'))
} else if (currentRoute.path.startsWith('/view/')) {
this.$store.commit('setActiveViewId', parseInt(currentRoute.params.viewId))
this.setPageTitle(this.$store.getters.activeView.title)
this.switchActiveMenuEntry(document.querySelector('header .header-left .app-menu li[data-app-id="tables"]'))
} else if (currentRoute.path.startsWith('/application/')) {
this.$store.commit('setActiveContextId', parseInt(currentRoute.params.contextId))
this.setPageTitle(this.$store.getters.activeContext.name)
this.switchActiveMenuEntry(document.querySelector('header .header-left .app-menu li[data-app-id="tables_application_' + currentRoute.params.contextId + '"]'))
// move the focus away from nav bar (import for app-internal switch)
const appContent = document.getElementById('app-content-vue')
Expand All @@ -82,6 +85,11 @@ export default {
appContent.tabIndex = oldTabIndex
}
},
switchActiveMenuEntry(targetElement) {
const currentlyActive = document.querySelector('header .header-left .app-menu li.app-menu-entry__active')
currentlyActive.classList.remove('app-menu-entry__active')
targetElement.classList.add('app-menu-entry__active')
},
setPageTitle(title) {
if (this.defaultPageTitle === false) {
const appTitle = t('tables', 'Tables')
Expand Down

0 comments on commit 2701178

Please sign in to comment.