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