From b58c69a1edcf63b6339576b5b431dbf7dea2c625 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 4 Nov 2016 17:25:26 +0100 Subject: [PATCH] Client: add titles to all pages --- client/package.json | 1 + client/src/app/account/account.routes.ts | 10 +++++++++- client/src/app/admin/friends/friends.routes.ts | 14 ++++++++++++-- .../src/app/admin/requests/requests.routes.ts | 7 ++++++- client/src/app/admin/users/users.routes.ts | 14 ++++++++++++-- client/src/app/app.component.ts | 2 ++ client/src/app/app.module.ts | 18 +++++++++++++++++- client/src/app/login/login.routes.ts | 10 +++++++++- client/src/app/videos/videos.routes.ts | 14 ++++++++++++-- 9 files changed, 80 insertions(+), 10 deletions(-) diff --git a/client/package.json b/client/package.json index ab15d1ba3..4049967ab 100644 --- a/client/package.json +++ b/client/package.json @@ -53,6 +53,7 @@ "json-loader": "^0.5.4", "ng2-bootstrap": "1.1.16", "ng2-file-upload": "^1.1.0", + "ng2-meta": "github:chocobozzz/ng2-meta", "node-sass": "^3.10.0", "normalize.css": "^5.0.0", "raw-loader": "^0.5.1", diff --git a/client/src/app/account/account.routes.ts b/client/src/app/account/account.routes.ts index e348c6ebe..c382a6deb 100644 --- a/client/src/app/account/account.routes.ts +++ b/client/src/app/account/account.routes.ts @@ -1,5 +1,13 @@ import { AccountComponent } from './account.component'; export const AccountRoutes = [ - { path: 'account', component: AccountComponent } + { + path: 'account', + component: AccountComponent, + data: { + meta: { + titleSuffix: ' - My account' + } + } + } ]; diff --git a/client/src/app/admin/friends/friends.routes.ts b/client/src/app/admin/friends/friends.routes.ts index 7fdef68f9..a9a06539b 100644 --- a/client/src/app/admin/friends/friends.routes.ts +++ b/client/src/app/admin/friends/friends.routes.ts @@ -16,11 +16,21 @@ export const FriendsRoutes: Routes = [ }, { path: 'list', - component: FriendListComponent + component: FriendListComponent, + data: { + meta: { + titleSuffix: ' - Friends list' + } + } }, { path: 'add', - component: FriendAddComponent + component: FriendAddComponent, + data: { + meta: { + titleSuffix: ' - Add friends' + } + } } ] } diff --git a/client/src/app/admin/requests/requests.routes.ts b/client/src/app/admin/requests/requests.routes.ts index 78221a9ff..70fbf41c3 100644 --- a/client/src/app/admin/requests/requests.routes.ts +++ b/client/src/app/admin/requests/requests.routes.ts @@ -15,7 +15,12 @@ export const RequestsRoutes: Routes = [ }, { path: 'stats', - component: RequestStatsComponent + component: RequestStatsComponent, + data: { + meta: { + titleSuffix: ' - Request stats' + } + } } ] } diff --git a/client/src/app/admin/users/users.routes.ts b/client/src/app/admin/users/users.routes.ts index eb71bd0ae..92e3e43e3 100644 --- a/client/src/app/admin/users/users.routes.ts +++ b/client/src/app/admin/users/users.routes.ts @@ -16,11 +16,21 @@ export const UsersRoutes: Routes = [ }, { path: 'list', - component: UserListComponent + component: UserListComponent, + data: { + meta: { + titleSuffix: ' - Users list' + } + } }, { path: 'add', - component: UserAddComponent + component: UserAddComponent, + data: { + meta: { + titleSuffix: ' - Add a user' + } + } } ] } diff --git a/client/src/app/app.component.ts b/client/src/app/app.component.ts index 01d3f5deb..ce4fc04ff 100644 --- a/client/src/app/app.component.ts +++ b/client/src/app/app.component.ts @@ -1,6 +1,7 @@ import { Component, ViewContainerRef } from '@angular/core'; import { Router } from '@angular/router'; +import { MetaService } from 'ng2-meta'; @Component({ selector: 'my-app', templateUrl: './app.component.html', @@ -10,6 +11,7 @@ import { Router } from '@angular/router'; export class AppComponent { constructor( private router: Router, + private metaService: MetaService, viewContainerRef: ViewContainerRef ) {} diff --git a/client/src/app/app.module.ts b/client/src/app/app.module.ts index 939af6309..e40b66c5f 100644 --- a/client/src/app/app.module.ts +++ b/client/src/app/app.module.ts @@ -6,12 +6,16 @@ import { RouterModule } from '@angular/router'; import { removeNgStyles, createNewHosts } from '@angularclass/hmr'; import { BytesPipe } from 'angular-pipes/src/math/bytes.pipe'; + import { DropdownModule } from 'ng2-bootstrap/components/dropdown'; import { ProgressbarModule } from 'ng2-bootstrap/components/progressbar'; import { PaginationModule } from 'ng2-bootstrap/components/pagination'; import { ModalModule } from 'ng2-bootstrap/components/modal'; + import { FileUploadModule } from 'ng2-file-upload/ng2-file-upload'; +import { MetaConfig, MetaModule } from 'ng2-meta'; + /* * Platform and Environment providers/directives/pipes */ @@ -52,6 +56,15 @@ import { WebTorrentService } from './videos'; +const metaConfig: MetaConfig = { + //Append a title suffix such as a site name to all titles + //Defaults to false + useTitleSuffix: true, + defaults: { + title: 'PeerTube' + } +}; + // Application wide providers const APP_PROVIDERS = [ AppState, @@ -117,7 +130,10 @@ const APP_PROVIDERS = [ ProgressbarModule, PaginationModule, ModalModule, - FileUploadModule + + FileUploadModule, + + MetaModule.forRoot(metaConfig) ], providers: [ // expose our Services and Providers into Angular's dependency injection ENV_PROVIDERS, diff --git a/client/src/app/login/login.routes.ts b/client/src/app/login/login.routes.ts index 4f56d5eb2..2f63af5e2 100644 --- a/client/src/app/login/login.routes.ts +++ b/client/src/app/login/login.routes.ts @@ -1,5 +1,13 @@ import { LoginComponent } from './login.component'; export const LoginRoutes = [ - { path: 'login', component: LoginComponent } + { + path: 'login', + component: LoginComponent, + data: { + meta: { + titleSuffix: ' - Login' + } + } + } ]; diff --git a/client/src/app/videos/videos.routes.ts b/client/src/app/videos/videos.routes.ts index 074f96596..ab68fbe0c 100644 --- a/client/src/app/videos/videos.routes.ts +++ b/client/src/app/videos/videos.routes.ts @@ -12,11 +12,21 @@ export const VideosRoutes: Routes = [ children: [ { path: 'list', - component: VideoListComponent + component: VideoListComponent, + data: { + meta: { + titleSuffix: ' - Videos list' + } + } }, { path: 'add', - component: VideoAddComponent + component: VideoAddComponent, + data: { + meta: { + titleSuffix: ' - Add a video' + } + } }, { path: 'watch/:id', -- 2.41.0