mirror of https://github.com/Chocobozzz/PeerTube
Fix action dropdown with query params
parent
02cb75c7e8
commit
d50e8d1aee
|
@ -26,7 +26,7 @@
|
|||
|
||||
<a
|
||||
*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>
|
||||
</a>
|
||||
|
|
|
@ -48,6 +48,12 @@ export class ActionDropdownComponent<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 {
|
||||
return actions.some(a => {
|
||||
if (Array.isArray(a)) return this.areActionsDisplayed(a, entry)
|
||||
|
|
Loading…
Reference in New Issue