TT#39754 Global: Implement dynamic page title

Change-Id: Ice88aaffb810daf422294601c0d66ff87c003fdd
changes/84/22384/1
Hans-Peter Herzog 7 years ago
parent 9c1f6ae2e5
commit 63b943336d

@ -5,7 +5,7 @@
<meta name="format-detection" content="telephone=no"> <meta name="format-detection" content="telephone=no">
<meta name="msapplication-tap-highlight" content="no"> <meta name="msapplication-tap-highlight" content="no">
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width"> <meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width">
<title>Sipwise Customer Self Care</title> <title></title>
<link rel="icon" href="statics/favicon.ico" type="image/x-icon"> <link rel="icon" href="statics/favicon.ico" type="image/x-icon">
</head> </head>
<body> <body>

@ -1,5 +1,5 @@
{ {
"title": "Customer Self-Care Portal", "title": "CSC",
"rtcEngineDisconnected": "You can not start a call. Service ist currently unavailable.", "rtcEngineDisconnected": "You can not start a call. Service ist currently unavailable.",
"startCall": "Call", "startCall": "Call",
"startAudioCall": "Audio Only", "startAudioCall": "Audio Only",
@ -58,7 +58,7 @@
}, },
"pages": { "pages": {
"login": { "login": {
"title": "Customer Self-Care Portal", "title": "Subscriber Sign In",
"button": "Sign In", "button": "Sign In",
"error": "Wrong username or password", "error": "Wrong username or password",
"username": "Username", "username": "Username",

@ -1,8 +1,10 @@
import _ from 'lodash'
import Vue from 'vue' import Vue from 'vue'
import VueRouter from 'vue-router' import VueRouter from 'vue-router'
import { store } from './store' import { store } from './store'
import routes from './routes' import routes from './routes'
import { i18n } from './i18n'
Vue.use(VueRouter); Vue.use(VueRouter);
@ -10,6 +12,20 @@ var router = new VueRouter({
routes: routes routes: routes
}); });
router.beforeEach((to, from, next) => {
let mainTitle = i18n.t('title');
let title = _.get(to, 'meta.title', '');
let subTitle = _.get(to, 'meta.subtitle', '');
if(mainTitle !== '') {
title = mainTitle + ' - ' + title;
}
if(subTitle !== '') {
title = title + " - " + subTitle;
}
document.title = title;
next();
});
router.beforeEach((to, from, next) => { router.beforeEach((to, from, next) => {
if (!store.getters['user/isLogged'] && to.path !== '/login') { if (!store.getters['user/isLogged'] && to.path !== '/login') {
next({ next({

@ -120,7 +120,10 @@ export default [
}, },
{ {
path: '/login', path: '/login',
component: Login component: Login,
meta: {
title: i18n.t('pages.login.title')
}
}, },
{ {
path: '/', path: '/',

Loading…
Cancel
Save