Client: add titles to all pages
authorChocobozzz <florian.bigard@gmail.com>
Fri, 4 Nov 2016 16:25:26 +0000 (17:25 +0100)
committerChocobozzz <florian.bigard@gmail.com>
Fri, 4 Nov 2016 16:25:26 +0000 (17:25 +0100)
client/package.json
client/src/app/account/account.routes.ts
client/src/app/admin/friends/friends.routes.ts
client/src/app/admin/requests/requests.routes.ts
client/src/app/admin/users/users.routes.ts
client/src/app/app.component.ts
client/src/app/app.module.ts
client/src/app/login/login.routes.ts
client/src/app/videos/videos.routes.ts

index ab15d1ba350e19e04991c0ae82873f6f042e2539..4049967ab96694a048333a65f5451bf705a18d67 100644 (file)
@@ -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",
index e348c6ebed9a22b689a7cfd230906fa76e7878cf..c382a6deb40e300ecf96a53a9258b201d5c52f40 100644 (file)
@@ -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'
+      }
+    }
+  }
 ];
index 7fdef68f90585eb361f85c5882b63f3188c298b4..a9a06539b55ecf507cf4c81a392823b038ef7b04 100644 (file)
@@ -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'
+            }
+          }
         }
       ]
     }
index 78221a9ff1b53b47cf3f715de1eda655bb78bb04..70fbf41c3c02929f80747f24dcc631dbe6ef423d 100644 (file)
@@ -15,7 +15,12 @@ export const RequestsRoutes: Routes = [
         },
         {
           path: 'stats',
-          component: RequestStatsComponent
+          component: RequestStatsComponent,
+          data: {
+            meta: {
+              titleSuffix: ' - Request stats'
+            }
+          }
         }
       ]
     }
index eb71bd0ae0b6801cb0dc55e3e8e485e5ffa21629..92e3e43e30b0ffb59849b3143b139a18be51bd75 100644 (file)
@@ -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'
+            }
+          }
         }
       ]
     }
index 01d3f5deb3afb9c99a060aff9774011c004976b3..ce4fc04fffc85c4e9adb58b5b28902fab7abba64 100644 (file)
@@ -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
   ) {}
 
index 939af6309ed1a522d5257884c4ae0bca9e35f93f..e40b66c5f1286e47ff807b8aa6cf3a05ebf0d7a7 100644 (file)
@@ -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,
index 4f56d5eb217224d1007b5eec46679c24ccc93c6a..2f63af5e2de7c3471bf17335e755091110cdb779 100644 (file)
@@ -1,5 +1,13 @@
 import { LoginComponent } from './login.component';
 
 export const LoginRoutes = [
-  { path: 'login', component: LoginComponent }
+  {
+    path: 'login',
+    component: LoginComponent,
+    data: {
+      meta: {
+        titleSuffix: ' - Login'
+      }
+    }
+  }
 ];
index 074f96596e1a81e5feeb806e98877fc244cecfee..ab68fbe0cbdaee9fbbd378086fe9b25d9e867b1e 100644 (file)
@@ -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',