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 6b9bbce commit 8901914
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,14 +65,22 @@ 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 + '"]'))
}
},
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 8901914

Please sign in to comment.