mirror of https://github.com/Chocobozzz/PeerTube
Fix action dropdown with query params
parent
02cb75c7e8
commit
d50e8d1aee
|
@ -26,7 +26,7 @@
|
||||||
|
|
||||||
<a
|
<a
|
||||||
*ngIf="action.linkBuilder && !action.isHeader" [ngClass]="{ 'with-icon': !!action.iconName }"
|
*ngIf="action.linkBuilder && !action.isHeader" [ngClass]="{ 'with-icon': !!action.iconName }"
|
||||||
class="dropdown-item" [routerLink]="action.linkBuilder(entry)" [queryParams]="action.queryParamsBuilder(entry)" [title]="action.title || ''"
|
class="dropdown-item" [routerLink]="action.linkBuilder(entry)" [queryParams]="getQueryParams(action, entry)" [title]="action.title || ''"
|
||||||
>
|
>
|
||||||
<ng-container *ngTemplateOutlet="templateActionLabel; context:{ $implicit: action }"></ng-container>
|
<ng-container *ngTemplateOutlet="templateActionLabel; context:{ $implicit: action }"></ng-container>
|
||||||
</a>
|
</a>
|
||||||
|
|
|
@ -48,6 +48,12 @@ export class ActionDropdownComponent<T> {
|
||||||
return [ this.actions as DropdownAction<T>[] ]
|
return [ this.actions as DropdownAction<T>[] ]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getQueryParams (action: DropdownAction<T>, entry: T) {
|
||||||
|
if (action.queryParamsBuilder) return action.queryParamsBuilder(entry)
|
||||||
|
|
||||||
|
return {}
|
||||||
|
}
|
||||||
|
|
||||||
areActionsDisplayed (actions: Array<DropdownAction<T> | DropdownAction<T>[]>, entry: T): boolean {
|
areActionsDisplayed (actions: Array<DropdownAction<T> | DropdownAction<T>[]>, entry: T): boolean {
|
||||||
return actions.some(a => {
|
return actions.some(a => {
|
||||||
if (Array.isArray(a)) return this.areActionsDisplayed(a, entry)
|
if (Array.isArray(a)) return this.areActionsDisplayed(a, entry)
|
||||||
|
|
Loading…
Reference in New Issue