client/general: add title to every page
This commit is contained in:
parent
394e51ed21
commit
2a39ec165d
|
@ -9,6 +9,7 @@ class LoginController {
|
||||||
constructor() {
|
constructor() {
|
||||||
api.forget();
|
api.forget();
|
||||||
topNavigation.activate('login');
|
topNavigation.activate('login');
|
||||||
|
topNavigation.setTitle('Login');
|
||||||
|
|
||||||
this._loginView = new LoginView();
|
this._loginView = new LoginView();
|
||||||
this._loginView.addEventListener('submit', e => this._evtLogin(e));
|
this._loginView.addEventListener('submit', e => this._evtLogin(e));
|
||||||
|
|
|
@ -12,6 +12,7 @@ const fields = ['id', 'comments', 'commentCount', 'thumbnailUrl'];
|
||||||
class CommentsController {
|
class CommentsController {
|
||||||
constructor(ctx) {
|
constructor(ctx) {
|
||||||
topNavigation.activate('comments');
|
topNavigation.activate('comments');
|
||||||
|
topNavigation.setTitle('Listing comments');
|
||||||
|
|
||||||
this._pageController = new PageController({
|
this._pageController = new PageController({
|
||||||
parameters: ctx.parameters,
|
parameters: ctx.parameters,
|
||||||
|
|
|
@ -6,6 +6,7 @@ const HelpView = require('../views/help_view.js');
|
||||||
class HelpController {
|
class HelpController {
|
||||||
constructor(section, subsection) {
|
constructor(section, subsection) {
|
||||||
topNavigation.activate('help');
|
topNavigation.activate('help');
|
||||||
|
topNavigation.setTitle('Help');
|
||||||
this._helpView = new HelpView(section, subsection);
|
this._helpView = new HelpView(section, subsection);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@ const topNavigation = require('../models/top_navigation.js');
|
||||||
class HistoryController {
|
class HistoryController {
|
||||||
constructor() {
|
constructor() {
|
||||||
topNavigation.activate('');
|
topNavigation.activate('');
|
||||||
|
topNavigation.setTitle('History');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,7 @@ const HomeView = require('../views/home_view.js');
|
||||||
class HomeController {
|
class HomeController {
|
||||||
constructor() {
|
constructor() {
|
||||||
topNavigation.activate('home');
|
topNavigation.activate('home');
|
||||||
|
topNavigation.setTitle('Home');
|
||||||
|
|
||||||
this._homeView = new HomeView({
|
this._homeView = new HomeView({
|
||||||
name: config.name,
|
name: config.name,
|
||||||
|
|
|
@ -6,6 +6,7 @@ const NotFoundView = require('../views/not_found_view.js');
|
||||||
class NotFoundController {
|
class NotFoundController {
|
||||||
constructor(path) {
|
constructor(path) {
|
||||||
topNavigation.activate('');
|
topNavigation.activate('');
|
||||||
|
topNavigation.setTitle('Not found');
|
||||||
this._notFoundView = new NotFoundView(path);
|
this._notFoundView = new NotFoundView(path);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -8,6 +8,7 @@ const PasswordResetView = require('../views/password_reset_view.js');
|
||||||
class PasswordResetController {
|
class PasswordResetController {
|
||||||
constructor() {
|
constructor() {
|
||||||
topNavigation.activate('login');
|
topNavigation.activate('login');
|
||||||
|
topNavigation.setTitle('Password reminder');
|
||||||
|
|
||||||
this._passwordResetView = new PasswordResetView();
|
this._passwordResetView = new PasswordResetView();
|
||||||
this._passwordResetView.addEventListener(
|
this._passwordResetView.addEventListener(
|
||||||
|
|
|
@ -14,6 +14,7 @@ const EmptyView = require('../views/empty_view.js');
|
||||||
class PostController {
|
class PostController {
|
||||||
constructor(id, editMode, ctx) {
|
constructor(id, editMode, ctx) {
|
||||||
topNavigation.activate('posts');
|
topNavigation.activate('posts');
|
||||||
|
topNavigation.setTitle('Post #' + id.toString());
|
||||||
|
|
||||||
let parameters = ctx.parameters;
|
let parameters = ctx.parameters;
|
||||||
Promise.all([
|
Promise.all([
|
||||||
|
|
|
@ -16,6 +16,7 @@ const fields = [
|
||||||
class PostListController {
|
class PostListController {
|
||||||
constructor(ctx) {
|
constructor(ctx) {
|
||||||
topNavigation.activate('posts');
|
topNavigation.activate('posts');
|
||||||
|
topNavigation.setTitle('Listing posts');
|
||||||
|
|
||||||
this._ctx = ctx;
|
this._ctx = ctx;
|
||||||
this._pageController = new PageController({
|
this._pageController = new PageController({
|
||||||
|
|
|
@ -6,6 +6,7 @@ const EmptyView = require('../views/empty_view.js');
|
||||||
class PostUploadController {
|
class PostUploadController {
|
||||||
constructor() {
|
constructor() {
|
||||||
topNavigation.activate('upload');
|
topNavigation.activate('upload');
|
||||||
|
topNavigation.setTitle('Upload');
|
||||||
this._emptyView = new EmptyView();
|
this._emptyView = new EmptyView();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,7 @@ const SettingsView = require('../views/settings_view.js');
|
||||||
class SettingsController {
|
class SettingsController {
|
||||||
constructor() {
|
constructor() {
|
||||||
topNavigation.activate('settings');
|
topNavigation.activate('settings');
|
||||||
|
topNavigation.setTitle('Browsing settings');
|
||||||
this._view = new SettingsView({
|
this._view = new SettingsView({
|
||||||
settings: settings.get(),
|
settings: settings.get(),
|
||||||
});
|
});
|
||||||
|
|
|
@ -10,6 +10,7 @@ const EmptyView = require('../views/empty_view.js');
|
||||||
class TagCategoriesController {
|
class TagCategoriesController {
|
||||||
constructor() {
|
constructor() {
|
||||||
topNavigation.activate('tags');
|
topNavigation.activate('tags');
|
||||||
|
topNavigation.setTitle('Listing tags');
|
||||||
TagCategoryList.get().then(response => {
|
TagCategoryList.get().then(response => {
|
||||||
this._tagCategories = response.results;
|
this._tagCategories = response.results;
|
||||||
this._view = new TagCategoriesView({
|
this._view = new TagCategoriesView({
|
||||||
|
|
|
@ -12,6 +12,7 @@ class TagController {
|
||||||
constructor(ctx, section) {
|
constructor(ctx, section) {
|
||||||
Tag.get(ctx.parameters.name).then(tag => {
|
Tag.get(ctx.parameters.name).then(tag => {
|
||||||
topNavigation.activate('tags');
|
topNavigation.activate('tags');
|
||||||
|
topNavigation.setTitle('Tag #' + tag);
|
||||||
|
|
||||||
this._name = ctx.parameters.name;
|
this._name = ctx.parameters.name;
|
||||||
tag.addEventListener('change', e => this._evtSaved(e));
|
tag.addEventListener('change', e => this._evtSaved(e));
|
||||||
|
|
|
@ -14,6 +14,7 @@ const fields = [
|
||||||
class TagListController {
|
class TagListController {
|
||||||
constructor(ctx) {
|
constructor(ctx) {
|
||||||
topNavigation.activate('tags');
|
topNavigation.activate('tags');
|
||||||
|
topNavigation.setTitle('Listing tags');
|
||||||
|
|
||||||
this._pageController = new PageController({
|
this._pageController = new PageController({
|
||||||
parameters: ctx.parameters,
|
parameters: ctx.parameters,
|
||||||
|
|
|
@ -11,6 +11,7 @@ const EmptyView = require('../views/empty_view.js');
|
||||||
|
|
||||||
class UserController {
|
class UserController {
|
||||||
constructor(ctx, section) {
|
constructor(ctx, section) {
|
||||||
|
topNavigation.setTitle('User ' + ctx.parameters.name);
|
||||||
User.get(ctx.parameters.name).then(user => {
|
User.get(ctx.parameters.name).then(user => {
|
||||||
const isLoggedIn = api.isLoggedIn(user);
|
const isLoggedIn = api.isLoggedIn(user);
|
||||||
const infix = isLoggedIn ? 'self' : 'any';
|
const infix = isLoggedIn ? 'self' : 'any';
|
||||||
|
|
|
@ -11,6 +11,7 @@ const UsersPageView = require('../views/users_page_view.js');
|
||||||
class UserListController {
|
class UserListController {
|
||||||
constructor(ctx) {
|
constructor(ctx) {
|
||||||
topNavigation.activate('users');
|
topNavigation.activate('users');
|
||||||
|
topNavigation.setTitle('Listing users');
|
||||||
|
|
||||||
this._pageController = new PageController({
|
this._pageController = new PageController({
|
||||||
parameters: ctx.parameters,
|
parameters: ctx.parameters,
|
||||||
|
|
|
@ -9,6 +9,7 @@ const RegistrationView = require('../views/registration_view.js');
|
||||||
class UserRegistrationController {
|
class UserRegistrationController {
|
||||||
constructor() {
|
constructor() {
|
||||||
topNavigation.activate('register');
|
topNavigation.activate('register');
|
||||||
|
topNavigation.setTitle('Registration');
|
||||||
this._view = new RegistrationView();
|
this._view = new RegistrationView();
|
||||||
this._view.addEventListener('submit', e => this._evtRegister(e));
|
this._view.addEventListener('submit', e => this._evtRegister(e));
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
const config = require('../config.js');
|
||||||
const events = require('../events.js');
|
const events = require('../events.js');
|
||||||
|
|
||||||
class TopNavigationItem {
|
class TopNavigationItem {
|
||||||
|
@ -51,6 +52,10 @@ class TopNavigation extends events.EventTarget {
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setTitle(title) {
|
||||||
|
document.title = config.name + (title ? (' – ' + title) : '');
|
||||||
|
}
|
||||||
|
|
||||||
showAll() {
|
showAll() {
|
||||||
for (let item of this._items) {
|
for (let item of this._items) {
|
||||||
item.available = true;
|
item.available = true;
|
||||||
|
|
Loading…
Reference in New Issue