diff options
author | Chocobozzz <me@florianbigard.com> | 2018-11-21 17:05:31 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-11-21 17:05:31 +0100 |
commit | f97c91f7ec4afc26ab790fbefa63d11b3060f40f (patch) | |
tree | d7548e28e0bb645cc0bdbc4620f868303444a194 /client/src/app/shared/buttons | |
parent | 9fa0ea41aaa511bed3aa179dacc312fad6170c21 (diff) | |
download | PeerTube-f97c91f7ec4afc26ab790fbefa63d11b3060f40f.tar.gz PeerTube-f97c91f7ec4afc26ab790fbefa63d11b3060f40f.tar.zst PeerTube-f97c91f7ec4afc26ab790fbefa63d11b3060f40f.zip |
Add separators in user moderation dropdown
Diffstat (limited to 'client/src/app/shared/buttons')
3 files changed, 25 insertions, 9 deletions
diff --git a/client/src/app/shared/buttons/action-dropdown.component.html b/client/src/app/shared/buttons/action-dropdown.component.html index 48230d6d8..90651f217 100644 --- a/client/src/app/shared/buttons/action-dropdown.component.html +++ b/client/src/app/shared/buttons/action-dropdown.component.html | |||
@@ -8,14 +8,20 @@ | |||
8 | </div> | 8 | </div> |
9 | 9 | ||
10 | <div ngbDropdownMenu class="dropdown-menu"> | 10 | <div ngbDropdownMenu class="dropdown-menu"> |
11 | <ng-container *ngFor="let action of actions"> | 11 | <ng-container *ngFor="let actions of getActions()"> |
12 | <ng-container *ngIf="action.isDisplayed === undefined || action.isDisplayed(entry) === true"> | ||
13 | <a *ngIf="action.linkBuilder" class="dropdown-item" [routerLink]="action.linkBuilder(entry)">{{ action.label }}</a> | ||
14 | 12 | ||
15 | <span *ngIf="!action.linkBuilder" class="custom-action dropdown-item" (click)="action.handler(entry)" role="button"> | 13 | <ng-container *ngFor="let action of actions"> |
16 | {{ action.label }} | 14 | <ng-container *ngIf="action.isDisplayed === undefined || action.isDisplayed(entry) === true"> |
17 | </span> | 15 | <a *ngIf="action.linkBuilder" class="dropdown-item" [routerLink]="action.linkBuilder(entry)">{{ action.label }}</a> |
16 | |||
17 | <span *ngIf="!action.linkBuilder" class="custom-action dropdown-item" (click)="action.handler(entry)" role="button"> | ||
18 | {{ action.label }} | ||
19 | </span> | ||
20 | </ng-container> | ||
18 | </ng-container> | 21 | </ng-container> |
22 | |||
23 | <div class="dropdown-divider"></div> | ||
24 | |||
19 | </ng-container> | 25 | </ng-container> |
20 | </div> | 26 | </div> |
21 | </div> \ No newline at end of file | 27 | </div> |
diff --git a/client/src/app/shared/buttons/action-dropdown.component.scss b/client/src/app/shared/buttons/action-dropdown.component.scss index 92c4d1d2c..a4fcceeee 100644 --- a/client/src/app/shared/buttons/action-dropdown.component.scss +++ b/client/src/app/shared/buttons/action-dropdown.component.scss | |||
@@ -1,6 +1,10 @@ | |||
1 | @import '_variables'; | 1 | @import '_variables'; |
2 | @import '_mixins'; | 2 | @import '_mixins'; |
3 | 3 | ||
4 | .dropdown-divider:last-child { | ||
5 | display: none; | ||
6 | } | ||
7 | |||
4 | .action-button { | 8 | .action-button { |
5 | @include peertube-button; | 9 | @include peertube-button; |
6 | 10 | ||
@@ -52,4 +56,4 @@ | |||
52 | width: 100%; | 56 | width: 100%; |
53 | } | 57 | } |
54 | } | 58 | } |
55 | } \ No newline at end of file | 59 | } |
diff --git a/client/src/app/shared/buttons/action-dropdown.component.ts b/client/src/app/shared/buttons/action-dropdown.component.ts index d8026ef41..275e2b51e 100644 --- a/client/src/app/shared/buttons/action-dropdown.component.ts +++ b/client/src/app/shared/buttons/action-dropdown.component.ts | |||
@@ -14,10 +14,16 @@ export type DropdownAction<T> = { | |||
14 | }) | 14 | }) |
15 | 15 | ||
16 | export class ActionDropdownComponent<T> { | 16 | export class ActionDropdownComponent<T> { |
17 | @Input() actions: DropdownAction<T>[] = [] | 17 | @Input() actions: DropdownAction<T>[] | DropdownAction<T>[][] = [] |
18 | @Input() entry: T | 18 | @Input() entry: T |
19 | @Input() placement = 'bottom-left' | 19 | @Input() placement = 'bottom-left' |
20 | @Input() buttonSize: 'normal' | 'small' = 'normal' | 20 | @Input() buttonSize: 'normal' | 'small' = 'normal' |
21 | @Input() label: string | 21 | @Input() label: string |
22 | @Input() theme: 'orange' | 'grey' = 'grey' | 22 | @Input() theme: 'orange' | 'grey' = 'grey' |
23 | |||
24 | getActions () { | ||
25 | if (this.actions.length !== 0 && Array.isArray(this.actions[0])) return this.actions | ||
26 | |||
27 | return [ this.actions ] | ||
28 | } | ||
23 | } | 29 | } |