diff --git a/CHANGELOG.rst b/CHANGELOG.rst index cbcfcaf1a519d473f12578d8ab6da25bca1dbd44..2b1fdba16ea390c857c3107bafc3fbdcc571d7aa 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -9,6 +9,10 @@ and this project adheres to `Semantic Versioning`_. Unreleased ---------- +Changes +~~~~~~~ +* The frontend is now able to display headings in the main toolbar. + Fixed ~~~~~ diff --git a/aleksis/core/frontend/components/app/App.vue b/aleksis/core/frontend/components/app/App.vue index b6919fbe8353c305cc88141e0bbcdd095bd4231c..6fcf3986af676dd2faab228e2eb3b1349625aed5 100644 --- a/aleksis/core/frontend/components/app/App.vue +++ b/aleksis/core/frontend/components/app/App.vue @@ -25,7 +25,7 @@ class="white--text text-decoration-none" @click="$router.push({ name: 'dashboard' })" > - {{ systemProperties.sitePreferences.generalTitle }} + {{ $root.toolbarTitle }} </v-toolbar-title> <v-progress-linear diff --git a/aleksis/core/frontend/components/authorized_oauth_applications/AuthorizedApplications.vue b/aleksis/core/frontend/components/authorized_oauth_applications/AuthorizedApplications.vue index bbf35c8e7f3c2f9e71479c03feb86799b3328d7f..55e100ddf773e342033a7f691089c6e5d7940936 100644 --- a/aleksis/core/frontend/components/authorized_oauth_applications/AuthorizedApplications.vue +++ b/aleksis/core/frontend/components/authorized_oauth_applications/AuthorizedApplications.vue @@ -1,6 +1,5 @@ <template> <div> - <h1 class="mb-4">{{ $t("oauth.authorized_application.title") }}</h1> <div v-if="$apollo.queries.accessTokens.loading"> <v-skeleton-loader type="card"></v-skeleton-loader> </div> diff --git a/aleksis/core/frontend/components/two_factor/TwoFactor.vue b/aleksis/core/frontend/components/two_factor/TwoFactor.vue index b6c023a55ffa3d9cf467d88109b46d78cf630ab0..96df63ebd882fa413538abb4ae3f68b5445aa966 100644 --- a/aleksis/core/frontend/components/two_factor/TwoFactor.vue +++ b/aleksis/core/frontend/components/two_factor/TwoFactor.vue @@ -1,6 +1,5 @@ <template> <div> - <h1 class="mb-4">{{ $t("accounts.two_factor.title") }}</h1> <div v-if="$apollo.queries.twoFactor.loading"> <v-skeleton-loader type="card,card"></v-skeleton-loader> </div> diff --git a/aleksis/core/frontend/index.js b/aleksis/core/frontend/index.js index 1159dac97830c29b127986f57923914907f44e61..11d1a1db0fe3b51703f63a6a668d96aac02f8374 100644 --- a/aleksis/core/frontend/index.js +++ b/aleksis/core/frontend/index.js @@ -71,6 +71,7 @@ const app = new Vue({ backgroundActive: true, invalidation: false, snackbarItems: [], + toolbarTitle: "AlekSIS®", permissions: [], }), computed: { diff --git a/aleksis/core/frontend/plugins/aleksis.js b/aleksis/core/frontend/plugins/aleksis.js index 7eb36c27bd2320ee39dc9604318f57e02d7d22be..c129aac331c51c1135203ed633a6fd3fccbc942f 100644 --- a/aleksis/core/frontend/plugins/aleksis.js +++ b/aleksis/core/frontend/plugins/aleksis.js @@ -105,6 +105,33 @@ AleksisVue.install = function (Vue) { document.title = newTitle; }; + /** + * Set the toolbar title visible on the page. + * + * This will automatically add the base title discovered at app loading time. + * + * @param {string} title Specific title to set, or null. + * @param {Object} route Route to discover title from, or null. + */ + Vue.prototype.$setToolBarTitle = function (title, route) { + let newTitle; + + if (title) { + newTitle = title; + } else { + if (!route) { + route = this.$route; + } + if (route.meta.toolbarTitle) { + newTitle = this.$t(route.meta.toolbarTitle); + } + } + + newTitle = newTitle || Vue.$pageBaseTitle; + console.debug(`Setting toolbar title: ${newTitle}`); + this.$root.toolbarTitle = newTitle; + }; + /** * Load i18n messages from all known AlekSIS apps. */ @@ -160,6 +187,7 @@ AleksisVue.install = function (Vue) { this.$router.afterEach((to, from, next) => { console.debug("Setting new page title due to route change"); vm.$setPageTitle(null, to); + vm.$setToolBarTitle(null, to); }); // eslint-disable-next-line no-unused-vars diff --git a/aleksis/core/frontend/routes.js b/aleksis/core/frontend/routes.js index a69cff3eeb33eaf0117e62479c95ea6007fd7589..2af742809548f5f2f70e9c13a1b7091e6d8145c5 100644 --- a/aleksis/core/frontend/routes.js +++ b/aleksis/core/frontend/routes.js @@ -735,6 +735,7 @@ const routes = [ meta: { inAccountMenu: true, titleKey: "accounts.two_factor.menu_title", + toolbarTitle: "accounts.two_factor.title", icon: "mdi-two-factor-authentication", permission: "core.manage_2fa_rule", }, @@ -929,6 +930,7 @@ const routes = [ meta: { inAccountMenu: true, titleKey: "oauth.authorized_application.menu_title", + toolbarTitle: "oauth.authorized_application.title", icon: "mdi-gesture-tap-hold", permission: "core.manage_authorized_tokens_rule", },