diff options
author | Rigel Kent <sendmemail@rigelk.eu> | 2020-01-21 09:35:23 +0100 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2020-01-21 09:35:23 +0100 |
commit | aa0f19635ae4632e286de1599fc24f95f32a108c (patch) | |
tree | 347518feb2534da9466b169a48a6cead0e1f2999 /client/src/app | |
parent | a56053a2a49431aeddcf8bcdd804b2e0abb93621 (diff) | |
download | PeerTube-aa0f19635ae4632e286de1599fc24f95f32a108c.tar.gz PeerTube-aa0f19635ae4632e286de1599fc24f95f32a108c.tar.zst PeerTube-aa0f19635ae4632e286de1599fc24f95f32a108c.zip |
Add manage buttons for own channels and account, video counts (#2421)
* Add manage buttons for own channels and account, video counts
* Change manage button color and introduce secondary color
Diffstat (limited to 'client/src/app')
9 files changed, 58 insertions, 5 deletions
diff --git a/client/src/app/+accounts/accounts.component.html b/client/src/app/+accounts/accounts.component.html index 57498e98c..367258a06 100644 --- a/client/src/app/+accounts/accounts.component.html +++ b/client/src/app/+accounts/accounts.component.html | |||
@@ -25,15 +25,17 @@ | |||
25 | <my-user-moderation-dropdown | 25 | <my-user-moderation-dropdown |
26 | buttonSize="small" [account]="account" [user]="user" placement="bottom-right auto" | 26 | buttonSize="small" [account]="account" [user]="user" placement="bottom-right auto" |
27 | (userChanged)="onUserChanged()" (userDeleted)="onUserDeleted()" | 27 | (userChanged)="onUserChanged()" (userDeleted)="onUserDeleted()" |
28 | > | 28 | ></my-user-moderation-dropdown> |
29 | </my-user-moderation-dropdown> | ||
30 | </div> | 29 | </div> |
31 | <div class="actor-followers" i18n-title [title]="subscribersDisplayFor(account.followersCount) + ' to the account actor'"> | 30 | <div class="actor-followers" i18n-title [title]="subscribersDisplayFor(account.followersCount) + ' to the account actor'"> |
32 | {{ subscribersDisplayFor(naiveAggregatedSubscribers) }} | 31 | {{ subscribersDisplayFor(naiveAggregatedSubscribers) }} |
33 | </div> | 32 | </div> |
34 | </div> | 33 | </div> |
35 | 34 | ||
36 | <my-subscribe-button *ngIf="videoChannels" [account]="account" [videoChannels]="videoChannels"></my-subscribe-button> | 35 | <div class="right-buttons"> |
36 | <a *ngIf="isManageable" routerLink="/my-account" class="btn btn-outline-tertiary mr-2" i18n>Manage</a> | ||
37 | <my-subscribe-button *ngIf="videoChannels" [account]="account" [videoChannels]="videoChannels"></my-subscribe-button> | ||
38 | </div> | ||
37 | </div> | 39 | </div> |
38 | 40 | ||
39 | <div class="links"> | 41 | <div class="links"> |
diff --git a/client/src/app/+accounts/accounts.component.scss b/client/src/app/+accounts/accounts.component.scss index ab3aece54..a06f04055 100644 --- a/client/src/app/+accounts/accounts.component.scss +++ b/client/src/app/+accounts/accounts.component.scss | |||
@@ -9,10 +9,21 @@ | |||
9 | } | 9 | } |
10 | } | 10 | } |
11 | 11 | ||
12 | my-subscribe-button { | 12 | .right-buttons { |
13 | display: flex; | ||
13 | height: max-content; | 14 | height: max-content; |
14 | margin-left: auto; | 15 | margin-left: auto; |
15 | margin-top: 20px; | 16 | margin-top: 20px; |
17 | |||
18 | a { | ||
19 | @include peertube-button-outline; | ||
20 | height: auto; | ||
21 | line-height: 32px; | ||
22 | } | ||
23 | |||
24 | my-subscribe-button { | ||
25 | height: min-content; | ||
26 | } | ||
16 | } | 27 | } |
17 | 28 | ||
18 | my-user-moderation-dropdown, | 29 | my-user-moderation-dropdown, |
diff --git a/client/src/app/+accounts/accounts.component.ts b/client/src/app/+accounts/accounts.component.ts index da4a0b28e..3d486f084 100644 --- a/client/src/app/+accounts/accounts.component.ts +++ b/client/src/app/+accounts/accounts.component.ts | |||
@@ -65,6 +65,11 @@ export class AccountsComponent implements OnInit, OnDestroy { | |||
65 | ) | 65 | ) |
66 | } | 66 | } |
67 | 67 | ||
68 | get isManageable () { | ||
69 | if (!this.authService.isLoggedIn()) return false | ||
70 | return this.user.id === this.authService.getUser().id | ||
71 | } | ||
72 | |||
68 | onUserChanged () { | 73 | onUserChanged () { |
69 | this.getUserIfNeeded(this.account) | 74 | this.getUserIfNeeded(this.account) |
70 | } | 75 | } |
diff --git a/client/src/app/+my-account/my-account-video-playlists/my-account-video-playlists.component.html b/client/src/app/+my-account/my-account-video-playlists/my-account-video-playlists.component.html index 878772359..49bf834c4 100644 --- a/client/src/app/+my-account/my-account-video-playlists/my-account-video-playlists.component.html +++ b/client/src/app/+my-account/my-account-video-playlists/my-account-video-playlists.component.html | |||
@@ -1,3 +1,7 @@ | |||
1 | <div> | ||
2 | <h4 i18n>Playlists <span class="badge badge-secondary">{{ pagination.totalItems }}</span></h4> | ||
3 | </div> | ||
4 | |||
1 | <div class="video-playlists-header"> | 5 | <div class="video-playlists-header"> |
2 | <input type="text" placeholder="Search your playlists" i18n-placeholder [(ngModel)]="videoPlaylistsSearch" (ngModelChange)="onVideoPlaylistSearchChanged()" /> | 6 | <input type="text" placeholder="Search your playlists" i18n-placeholder [(ngModel)]="videoPlaylistsSearch" (ngModelChange)="onVideoPlaylistSearchChanged()" /> |
3 | 7 | ||
diff --git a/client/src/app/+my-account/my-account-videos/my-account-videos.component.html b/client/src/app/+my-account/my-account-videos/my-account-videos.component.html index a898cd938..7479c84f9 100644 --- a/client/src/app/+my-account/my-account-videos/my-account-videos.component.html +++ b/client/src/app/+my-account/my-account-videos/my-account-videos.component.html | |||
@@ -1,3 +1,7 @@ | |||
1 | <div> | ||
2 | <h4 i18n>Videos <span class="badge badge-secondary">{{ pagination.totalItems }}</span></h4> | ||
3 | </div> | ||
4 | |||
1 | <div class="videos-header"> | 5 | <div class="videos-header"> |
2 | <input type="text" placeholder="Search your videos" i18n-placeholder [(ngModel)]="videosSearch" (ngModelChange)="onVideosSearchChanged()" /> | 6 | <input type="text" placeholder="Search your videos" i18n-placeholder [(ngModel)]="videosSearch" (ngModelChange)="onVideosSearchChanged()" /> |
3 | </div> | 7 | </div> |
diff --git a/client/src/app/+my-account/my-account-videos/my-account-videos.component.ts b/client/src/app/+my-account/my-account-videos/my-account-videos.component.ts index dd4b25d08..831d5c5b0 100644 --- a/client/src/app/+my-account/my-account-videos/my-account-videos.component.ts +++ b/client/src/app/+my-account/my-account-videos/my-account-videos.component.ts | |||
@@ -86,6 +86,9 @@ export class MyAccountVideosComponent implements OnInit, DisableForReuseHook { | |||
86 | const newPagination = immutableAssign(this.pagination, { currentPage: page }) | 86 | const newPagination = immutableAssign(this.pagination, { currentPage: page }) |
87 | 87 | ||
88 | return this.videoService.getMyVideos(newPagination, sort, this.videosSearch) | 88 | return this.videoService.getMyVideos(newPagination, sort, this.videosSearch) |
89 | .pipe( | ||
90 | tap(res => this.pagination.totalItems = res.total) | ||
91 | ) | ||
89 | } | 92 | } |
90 | 93 | ||
91 | async deleteSelectedVideos () { | 94 | async deleteSelectedVideos () { |
diff --git a/client/src/app/+video-channels/video-channels.component.html b/client/src/app/+video-channels/video-channels.component.html index f4b944c59..8ab79526d 100644 --- a/client/src/app/+video-channels/video-channels.component.html +++ b/client/src/app/+video-channels/video-channels.component.html | |||
@@ -15,7 +15,10 @@ | |||
15 | </button> | 15 | </button> |
16 | </div> | 16 | </div> |
17 | 17 | ||
18 | <my-subscribe-button #subscribeButton [videoChannels]="[videoChannel]"></my-subscribe-button> | 18 | <div class="right-buttons"> |
19 | <a *ngIf="isManageable" [routerLink]="[ '/my-account/video-channels/update', videoChannel.nameWithHost ]" class="btn btn-outline-tertiary mr-2" i18n>Manage</a> | ||
20 | <my-subscribe-button #subscribeButton [videoChannels]="[videoChannel]"></my-subscribe-button> | ||
21 | </div> | ||
19 | </div> | 22 | </div> |
20 | <div i18n class="actor-followers">{{ videoChannel.followersCount }} subscribers</div> | 23 | <div i18n class="actor-followers">{{ videoChannel.followersCount }} subscribers</div> |
21 | 24 | ||
diff --git a/client/src/app/+video-channels/video-channels.component.scss b/client/src/app/+video-channels/video-channels.component.scss index d29575027..50b69e7ac 100644 --- a/client/src/app/+video-channels/video-channels.component.scss +++ b/client/src/app/+video-channels/video-channels.component.scss | |||
@@ -17,4 +17,20 @@ | |||
17 | margin-top: -2px; | 17 | margin-top: -2px; |
18 | } | 18 | } |
19 | } | 19 | } |
20 | } | ||
21 | |||
22 | .right-buttons { | ||
23 | display: flex; | ||
24 | height: max-content; | ||
25 | margin-left: auto; | ||
26 | margin-top: 20px; | ||
27 | |||
28 | a { | ||
29 | @include peertube-button-outline; | ||
30 | line-height: 1.8; | ||
31 | } | ||
32 | |||
33 | my-subscribe-button { | ||
34 | height: min-content; | ||
35 | } | ||
20 | } \ No newline at end of file | 36 | } \ No newline at end of file |
diff --git a/client/src/app/+video-channels/video-channels.component.ts b/client/src/app/+video-channels/video-channels.component.ts index 5ef46c58a..493a6d499 100644 --- a/client/src/app/+video-channels/video-channels.component.ts +++ b/client/src/app/+video-channels/video-channels.component.ts | |||
@@ -64,6 +64,11 @@ export class VideoChannelsComponent implements OnInit, OnDestroy { | |||
64 | return this.authService.isLoggedIn() | 64 | return this.authService.isLoggedIn() |
65 | } | 65 | } |
66 | 66 | ||
67 | get isManageable () { | ||
68 | if (!this.isUserLoggedIn()) return false | ||
69 | return this.videoChannel.ownerAccount.userId === this.authService.getUser().id | ||
70 | } | ||
71 | |||
67 | activateCopiedMessage () { | 72 | activateCopiedMessage () { |
68 | this.notifier.success(this.i18n('Username copied')) | 73 | this.notifier.success(this.i18n('Username copied')) |
69 | } | 74 | } |