diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2017-11-28 17:11:07 +0100 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2017-11-28 17:13:51 +0100 |
commit | a434c465455d63a3961e778abca82150186cf171 (patch) | |
tree | 0589c09e6de09da32aaca56c95fa715d344b0e4e | |
parent | 80958c78fdc733c02077a9d2200be0c3f5ee623e (diff) | |
download | PeerTube-a434c465455d63a3961e778abca82150186cf171.tar.gz PeerTube-a434c465455d63a3961e778abca82150186cf171.tar.zst PeerTube-a434c465455d63a3961e778abca82150186cf171.zip |
Change tab when changing follow url
-rw-r--r-- | client/src/app/+admin/follows/follows.component.ts | 17 | ||||
-rw-r--r-- | server/controllers/client.ts | 18 |
2 files changed, 24 insertions, 11 deletions
diff --git a/client/src/app/+admin/follows/follows.component.ts b/client/src/app/+admin/follows/follows.component.ts index 97422a41b..a1be82585 100644 --- a/client/src/app/+admin/follows/follows.component.ts +++ b/client/src/app/+admin/follows/follows.component.ts | |||
@@ -1,11 +1,12 @@ | |||
1 | import { AfterViewInit, Component, ViewChild } from '@angular/core' | 1 | import { AfterViewInit, Component, OnInit, ViewChild } from '@angular/core' |
2 | import { NavigationEnd, Router } from '@angular/router' | ||
2 | import { TabsetComponent } from 'ngx-bootstrap/tabs' | 3 | import { TabsetComponent } from 'ngx-bootstrap/tabs' |
3 | 4 | ||
4 | @Component({ | 5 | @Component({ |
5 | templateUrl: './follows.component.html', | 6 | templateUrl: './follows.component.html', |
6 | styleUrls: [ './follows.component.scss' ] | 7 | styleUrls: [ './follows.component.scss' ] |
7 | }) | 8 | }) |
8 | export class FollowsComponent implements AfterViewInit { | 9 | export class FollowsComponent implements OnInit, AfterViewInit { |
9 | @ViewChild('followsMenuTabs') followsMenuTabs: TabsetComponent | 10 | @ViewChild('followsMenuTabs') followsMenuTabs: TabsetComponent |
10 | 11 | ||
11 | links = [ | 12 | links = [ |
@@ -23,6 +24,18 @@ export class FollowsComponent implements AfterViewInit { | |||
23 | } | 24 | } |
24 | ] | 25 | ] |
25 | 26 | ||
27 | constructor (private router: Router) {} | ||
28 | |||
29 | ngOnInit () { | ||
30 | this.router.events.subscribe( | ||
31 | event => { | ||
32 | if (event instanceof NavigationEnd) { | ||
33 | this.updateActiveTab() | ||
34 | } | ||
35 | } | ||
36 | ) | ||
37 | } | ||
38 | |||
26 | ngAfterViewInit () { | 39 | ngAfterViewInit () { |
27 | // Avoid issue with change detector | 40 | // Avoid issue with change detector |
28 | setTimeout(() => this.updateActiveTab()) | 41 | setTimeout(() => this.updateActiveTab()) |
diff --git a/server/controllers/client.ts b/server/controllers/client.ts index 045a50ef0..64e5829ca 100644 --- a/server/controllers/client.ts +++ b/server/controllers/client.ts | |||
@@ -51,16 +51,16 @@ function addOpenGraphAndOEmbedTags (htmlStringPage: string, video: VideoInstance | |||
51 | const previewUrl = CONFIG.WEBSERVER.URL + STATIC_PATHS.PREVIEWS + video.getPreviewName() | 51 | const previewUrl = CONFIG.WEBSERVER.URL + STATIC_PATHS.PREVIEWS + video.getPreviewName() |
52 | const videoUrl = CONFIG.WEBSERVER.URL + '/videos/watch/' + video.uuid | 52 | const videoUrl = CONFIG.WEBSERVER.URL + '/videos/watch/' + video.uuid |
53 | 53 | ||
54 | const videoName = escapeHTML(video.name) | 54 | const videoNameEscaped = escapeHTML(video.name) |
55 | const videoDescription = escapeHTML(video.description) | 55 | const videoDescriptionEscaped = escapeHTML(video.description) |
56 | const embedUrl = CONFIG.WEBSERVER.URL + video.getEmbedPath() | 56 | const embedUrl = CONFIG.WEBSERVER.URL + video.getEmbedPath() |
57 | 57 | ||
58 | const openGraphMetaTags = { | 58 | const openGraphMetaTags = { |
59 | 'og:type': 'video', | 59 | 'og:type': 'video', |
60 | 'og:title': videoName, | 60 | 'og:title': videoNameEscaped, |
61 | 'og:image': previewUrl, | 61 | 'og:image': previewUrl, |
62 | 'og:url': videoUrl, | 62 | 'og:url': videoUrl, |
63 | 'og:description': videoDescription, | 63 | 'og:description': videoDescriptionEscaped, |
64 | 64 | ||
65 | 'og:video:url': embedUrl, | 65 | 'og:video:url': embedUrl, |
66 | 'og:video:secure_url': embedUrl, | 66 | 'og:video:secure_url': embedUrl, |
@@ -68,14 +68,14 @@ function addOpenGraphAndOEmbedTags (htmlStringPage: string, video: VideoInstance | |||
68 | 'og:video:width': EMBED_SIZE.width, | 68 | 'og:video:width': EMBED_SIZE.width, |
69 | 'og:video:height': EMBED_SIZE.height, | 69 | 'og:video:height': EMBED_SIZE.height, |
70 | 70 | ||
71 | 'name': videoName, | 71 | 'name': videoNameEscaped, |
72 | 'description': videoDescription, | 72 | 'description': videoDescriptionEscaped, |
73 | 'image': previewUrl, | 73 | 'image': previewUrl, |
74 | 74 | ||
75 | 'twitter:card': 'summary_large_image', | 75 | 'twitter:card': 'summary_large_image', |
76 | 'twitter:site': '@Chocobozzz', | 76 | 'twitter:site': '@Chocobozzz', |
77 | 'twitter:title': videoName, | 77 | 'twitter:title': videoNameEscaped, |
78 | 'twitter:description': videoDescription, | 78 | 'twitter:description': videoDescriptionEscaped, |
79 | 'twitter:image': previewUrl, | 79 | 'twitter:image': previewUrl, |
80 | 'twitter:player': embedUrl, | 80 | 'twitter:player': embedUrl, |
81 | 'twitter:player:width': EMBED_SIZE.width, | 81 | 'twitter:player:width': EMBED_SIZE.width, |
@@ -86,7 +86,7 @@ function addOpenGraphAndOEmbedTags (htmlStringPage: string, video: VideoInstance | |||
86 | { | 86 | { |
87 | type: 'application/json+oembed', | 87 | type: 'application/json+oembed', |
88 | href: CONFIG.WEBSERVER.URL + '/services/oembed?url=' + encodeURIComponent(videoUrl), | 88 | href: CONFIG.WEBSERVER.URL + '/services/oembed?url=' + encodeURIComponent(videoUrl), |
89 | title: videoName | 89 | title: videoNameEscaped |
90 | } | 90 | } |
91 | ] | 91 | ] |
92 | 92 | ||