]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/app/shared/buttons/action-dropdown.component.ts
Show default avatar on network error for comments
[github/Chocobozzz/PeerTube.git] / client / src / app / shared / buttons / action-dropdown.component.ts
index f5345831b86dd5827d28a11a14411347945ecdc1..5330ca220958e365e7541ffbba0bad207c09ca09 100644 (file)
@@ -23,7 +23,7 @@ export class ActionDropdownComponent<T> {
   @Input() actions: DropdownAction<T>[] | DropdownAction<T>[][] = []
   @Input() entry: T
 
-  @Input() placement = 'bottom-left'
+  @Input() placement = 'bottom-left auto'
 
   @Input() buttonSize: DropdownButtonSize = 'normal'
   @Input() buttonDirection: DropdownDirection = 'horizontal'
@@ -38,13 +38,11 @@ export class ActionDropdownComponent<T> {
     return [ this.actions ]
   }
 
-  areActionsDisplayed (actions: DropdownAction<T>[], entry: T) {
-    return actions.some(a => a.isDisplayed === undefined || a.isDisplayed(entry))
-  }
-
-  handleClick (event: Event, action: DropdownAction<T>) {
-    event.preventDefault()
+  areActionsDisplayed (actions: Array<DropdownAction<T> | DropdownAction<T>[]>, entry: T): boolean {
+    return actions.some(a => {
+      if (Array.isArray(a)) return this.areActionsDisplayed(a, entry)
 
-    // action.handler(entry)
+      return a.isDisplayed === undefined || a.isDisplayed(entry)
+    })
   }
 }