diff --git a/frontend/static/js/views/HomeView.js b/frontend/static/js/views/HomeView.js index 9f38a9a..6ff6b0e 100644 --- a/frontend/static/js/views/HomeView.js +++ b/frontend/static/js/views/HomeView.js @@ -3,7 +3,7 @@ import AbstractAuthenticatedView from "./abstracts/AbstractAuthenticatedView.js" export default class extends AbstractAuthenticatedView { constructor(params) { - super(params, lang.get('homeWindowTitle', 'Home')); + super(params, 'homeWindowTitle'); this.redirect_url = "/login" } diff --git a/frontend/static/js/views/PageNotFoundView.js b/frontend/static/js/views/PageNotFoundView.js index 2c021c0..01a8ef3 100644 --- a/frontend/static/js/views/PageNotFoundView.js +++ b/frontend/static/js/views/PageNotFoundView.js @@ -3,7 +3,7 @@ import { lang } from '../index.js' export default class extends AbstractView { constructor(params) { - super(params, lang.get('404WindowTitle', 'Not Found')); + super(params, '404WindowTitle'); } async getHtml() { diff --git a/frontend/static/js/views/Search.js b/frontend/static/js/views/Search.js index 487c906..9911f1a 100644 --- a/frontend/static/js/views/Search.js +++ b/frontend/static/js/views/Search.js @@ -4,7 +4,7 @@ import {Message} from "../api/chat/message.js" export default class extends AbstractView { constructor(params) { - super(params, lang.get('SearchWindowTitle', 'Search')); + super(params, 'SearchWindowTitle'); } async wait_get_online_users() { diff --git a/frontend/static/js/views/abstracts/AbstractAuthenticatedView.js b/frontend/static/js/views/abstracts/AbstractAuthenticatedView.js index b519f3a..d5b52df 100644 --- a/frontend/static/js/views/abstracts/AbstractAuthenticatedView.js +++ b/frontend/static/js/views/abstracts/AbstractAuthenticatedView.js @@ -2,8 +2,8 @@ import { client, navigateTo } from "../../index.js"; import AbstractRedirectView from "./AbstractRedirectView.js"; export default class extends AbstractRedirectView{ - constructor(params, title, uri = "/login") { - super(params, title, uri); + constructor(params, titleKey, uri = "/login") { + super(params, titleKey, uri); } async redirect() diff --git a/frontend/static/js/views/abstracts/AbstractNonAuthenticatedView.js b/frontend/static/js/views/abstracts/AbstractNonAuthenticatedView.js index c4936d2..07185ae 100644 --- a/frontend/static/js/views/abstracts/AbstractNonAuthenticatedView.js +++ b/frontend/static/js/views/abstracts/AbstractNonAuthenticatedView.js @@ -2,8 +2,8 @@ import { client, navigateTo } from "../../index.js"; import AbstractRedirectView from "./AbstractRedirectView.js"; export default class extends AbstractRedirectView{ - constructor(params, title, uri = "/home") { - super(params, title, uri); + constructor(params, titleKey, uri = "/home") { + super(params, titleKey, uri); } async redirect() diff --git a/frontend/static/js/views/abstracts/AbstractRedirectView.js b/frontend/static/js/views/abstracts/AbstractRedirectView.js index 713f3f3..4d84134 100644 --- a/frontend/static/js/views/abstracts/AbstractRedirectView.js +++ b/frontend/static/js/views/abstracts/AbstractRedirectView.js @@ -2,9 +2,9 @@ import { navigateTo } from "../../index.js"; import AbstractView from "./AbstractView.js"; export default class extends AbstractView{ - constructor(params, title, uri) + constructor(params, titleKey, uri) { - super(params, title); + super(params, titleKey); this.redirect_url = uri; } diff --git a/frontend/static/js/views/abstracts/AbstractView.js b/frontend/static/js/views/abstracts/AbstractView.js index a488d80..4868d62 100644 --- a/frontend/static/js/views/abstracts/AbstractView.js +++ b/frontend/static/js/views/abstracts/AbstractView.js @@ -1,7 +1,9 @@ +import {lang} from '../../index.js' + export default class { - constructor(params, title) { + constructor(params, titleKey) { this.params = params; - this.title = title; + this.titleKey = titleKey; } async postInit() { @@ -11,7 +13,7 @@ export default class { } setTitle() { - document.title = this.title; + document.title = lang.get(this.titleKey, 'Bozo Pong'); } async getHtml() { diff --git a/frontend/static/js/views/accounts/AuthenticationView.js b/frontend/static/js/views/accounts/AuthenticationView.js index 595934e..5e457b4 100644 --- a/frontend/static/js/views/accounts/AuthenticationView.js +++ b/frontend/static/js/views/accounts/AuthenticationView.js @@ -1,4 +1,3 @@ - import { client, lang, navigateTo } from "../../index.js"; import { clear, fill_errors } from "../../utils/formUtils.js"; import AbstractNonAuthenticatedView from "../abstracts/AbstractNonAuthenticatedView.js"; @@ -7,7 +6,8 @@ export default class extends AbstractNonAuthenticatedView { constructor(params, lastUrlBeforeLogin = '/home') { - super(params, lang.get('loginWindowTitle', 'Login'), lastUrlBeforeLogin); + super(params, 'loginWindowTitle', lastUrlBeforeLogin); + this.redirect_url = lastUrlBeforeLogin; this.current_mode = undefined } @@ -109,6 +109,9 @@ export default class extends AbstractNonAuthenticatedView let button_text = this.current_mode === "register" ? "registerFormButton" : "loginFormButton"; button.innerText = lang.get(button_text, "ERROR LANG"); + + this.titleKey = this.current_mode === 'register' ? 'registerWindowTitle' : 'loginWindowTitle'; + this.setTitle(); } /** diff --git a/frontend/static/js/views/accounts/LogoutView.js b/frontend/static/js/views/accounts/LogoutView.js index 0f8b85e..18360a3 100644 --- a/frontend/static/js/views/accounts/LogoutView.js +++ b/frontend/static/js/views/accounts/LogoutView.js @@ -1,10 +1,10 @@ -import { client, lang, navigateTo } from "../../index.js"; +import { client, navigateTo } from "../../index.js"; import AbstractAuthenticatedView from "../abstracts/AbstractAuthenticatedView.js"; export default class extends AbstractAuthenticatedView { constructor(params, lastPageUrl = '/login') { - super(params, lang.get('logoutWindowTitle', 'Logout'), lastPageUrl); + super(params, 'logoutWindowTitle', lastPageUrl); this.lastPageUrl = lastPageUrl; }