Fix video action dropdown
This commit is contained in:
parent
3ddb1ec555
commit
f238aec54f
|
@ -41,10 +41,4 @@ export class ActionDropdownComponent<T> {
|
||||||
areActionsDisplayed (actions: DropdownAction<T>[], entry: T) {
|
areActionsDisplayed (actions: DropdownAction<T>[], entry: T) {
|
||||||
return actions.some(a => a.isDisplayed === undefined || a.isDisplayed(entry))
|
return actions.some(a => a.isDisplayed === undefined || a.isDisplayed(entry))
|
||||||
}
|
}
|
||||||
|
|
||||||
handleClick (event: Event, action: DropdownAction<T>) {
|
|
||||||
event.preventDefault()
|
|
||||||
|
|
||||||
// action.handler(entry)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -188,19 +188,16 @@ export class VideoActionsDropdownComponent implements OnChanges {
|
||||||
}
|
}
|
||||||
|
|
||||||
private buildActions () {
|
private buildActions () {
|
||||||
this.videoActions = []
|
this.videoActions = [
|
||||||
|
[
|
||||||
if (this.authService.isLoggedIn()) {
|
|
||||||
this.videoActions.push([
|
|
||||||
{
|
{
|
||||||
label: this.i18n('Save to playlist'),
|
label: this.i18n('Save to playlist'),
|
||||||
handler: () => this.playlistDropdown.toggle(),
|
handler: () => this.playlistDropdown.toggle(),
|
||||||
isDisplayed: () => this.displayOptions.playlist,
|
isDisplayed: () => this.authService.isLoggedIn() && this.displayOptions.playlist,
|
||||||
iconName: 'playlist-add'
|
iconName: 'playlist-add'
|
||||||
}
|
}
|
||||||
])
|
],
|
||||||
|
[
|
||||||
this.videoActions.push([
|
|
||||||
{
|
{
|
||||||
label: this.i18n('Download'),
|
label: this.i18n('Download'),
|
||||||
handler: () => this.showDownloadModal(),
|
handler: () => this.showDownloadModal(),
|
||||||
|
@ -211,36 +208,35 @@ export class VideoActionsDropdownComponent implements OnChanges {
|
||||||
label: this.i18n('Update'),
|
label: this.i18n('Update'),
|
||||||
linkBuilder: ({ video }) => [ '/videos/update', video.uuid ],
|
linkBuilder: ({ video }) => [ '/videos/update', video.uuid ],
|
||||||
iconName: 'edit',
|
iconName: 'edit',
|
||||||
isDisplayed: () => this.displayOptions.update && this.isVideoUpdatable()
|
isDisplayed: () => this.authService.isLoggedIn() && this.displayOptions.update && this.isVideoUpdatable()
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: this.i18n('Blacklist'),
|
label: this.i18n('Blacklist'),
|
||||||
handler: () => this.showBlacklistModal(),
|
handler: () => this.showBlacklistModal(),
|
||||||
iconName: 'no',
|
iconName: 'no',
|
||||||
isDisplayed: () => this.displayOptions.blacklist && this.isVideoBlacklistable()
|
isDisplayed: () => this.authService.isLoggedIn() && this.displayOptions.blacklist && this.isVideoBlacklistable()
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: this.i18n('Unblacklist'),
|
label: this.i18n('Unblacklist'),
|
||||||
handler: () => this.unblacklistVideo(),
|
handler: () => this.unblacklistVideo(),
|
||||||
iconName: 'undo',
|
iconName: 'undo',
|
||||||
isDisplayed: () => this.displayOptions.blacklist && this.isVideoUnblacklistable()
|
isDisplayed: () => this.authService.isLoggedIn() && this.displayOptions.blacklist && this.isVideoUnblacklistable()
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: this.i18n('Delete'),
|
label: this.i18n('Delete'),
|
||||||
handler: () => this.removeVideo(),
|
handler: () => this.removeVideo(),
|
||||||
isDisplayed: () => this.displayOptions.delete && this.isVideoRemovable(),
|
isDisplayed: () => this.authService.isLoggedIn() && this.displayOptions.delete && this.isVideoRemovable(),
|
||||||
iconName: 'delete'
|
iconName: 'delete'
|
||||||
}
|
}
|
||||||
])
|
],
|
||||||
|
[
|
||||||
this.videoActions.push([
|
|
||||||
{
|
{
|
||||||
label: this.i18n('Report'),
|
label: this.i18n('Report'),
|
||||||
handler: () => this.showReportModal(),
|
handler: () => this.showReportModal(),
|
||||||
isDisplayed: () => this.displayOptions.report,
|
isDisplayed: () => this.authService.isLoggedIn() && this.displayOptions.report,
|
||||||
iconName: 'alert'
|
iconName: 'alert'
|
||||||
}
|
}
|
||||||
])
|
]
|
||||||
}
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue