diff --git a/client/src/app/site/mediafiles/components/mediafile-list/mediafile-list.component.html b/client/src/app/site/mediafiles/components/mediafile-list/mediafile-list.component.html index fdd9da0c4..f340f48e3 100644 --- a/client/src/app/site/mediafiles/components/mediafile-list/mediafile-list.component.html +++ b/client/src/app/site/mediafiles/components/mediafile-list/mediafile-list.component.html @@ -42,14 +42,17 @@ mat-button [matMenuTriggerFor]="singleMediafileMenu" [matMenuTriggerData]="{ mediafile: directory }" - *ngIf="last" + *ngIf="last && showFileMenu(directory)" > {{ directory.title }} + + {{ directory.title }} + - + - +
@@ -110,12 +120,13 @@
- +
@@ -136,7 +147,7 @@ -
+
-
+
- - - +
+ + + +
diff --git a/client/src/app/site/mediafiles/components/mediafile-list/mediafile-list.component.scss b/client/src/app/site/mediafiles/components/mediafile-list/mediafile-list.component.scss index 730676629..a8bbe98b9 100644 --- a/client/src/app/site/mediafiles/components/mediafile-list/mediafile-list.component.scss +++ b/client/src/app/site/mediafiles/components/mediafile-list/mediafile-list.component.scss @@ -24,6 +24,10 @@ height: $size; } + .fake-folder { + padding: 0 16px; + } + .folder-text { font-size: 16px; font-weight: 500; diff --git a/client/src/app/site/mediafiles/components/mediafile-list/mediafile-list.component.ts b/client/src/app/site/mediafiles/components/mediafile-list/mediafile-list.component.ts index a537a476f..4f3031a74 100644 --- a/client/src/app/site/mediafiles/components/mediafile-list/mediafile-list.component.ts +++ b/client/src/app/site/mediafiles/components/mediafile-list/mediafile-list.component.ts @@ -70,6 +70,17 @@ export class MediafileListComponent extends BaseViewComponent implements OnInit, return this.operator.hasPerms('mediafiles.can_manage'); } + /** + * Determine if the file menu should generally be accessible, according to the users permission + */ + public get canAccessFileMenu(): boolean { + return ( + this.operator.hasPerms('core.can_manage_projector') || + this.operator.hasPerms('agenda.can_see_list_of_speakers') || + this.canEdit + ); + } + /** * The form to edit Files */ @@ -82,6 +93,22 @@ export class MediafileListComponent extends BaseViewComponent implements OnInit, @ViewChild('fileEditDialog', { static: true }) public fileEditDialog: TemplateRef; + /** + * Determine generally hidden columns + */ + public get hiddenColumns(): string[] { + const hidden = []; + if (!this.canEdit) { + hidden.push('info'); + } + + if (!this.canAccessFileMenu) { + hidden.push('menu'); + } + + return hidden; + } + /** * Create the column set */ @@ -194,6 +221,19 @@ export class MediafileListComponent extends BaseViewComponent implements OnInit, this.clearSubscriptions(); } + /** + * Determine if the given file has any extra option to show. + * @param file the file to check + * @returns wether the extra menu should be accessible + */ + public showFileMenu(file: ViewMediafile): boolean { + return ( + this.operator.hasPerms('agenda.can_see_list_of_speakers') || + (file.isProjectable() && this.operator.hasPerms('core.can_manage_projector')) || + this.canEdit + ); + } + public getDateFromTimestamp(timestamp: string): string { return new Date(timestamp).toLocaleString(this.translate.currentLang); }