From f96e68496f184a1d5e1ef35d7853e5b42ee17291 Mon Sep 17 00:00:00 2001 From: matthieu Date: Fri, 9 Oct 2020 16:10:58 +0200 Subject: [PATCH] fix #1083 --- .../form/dynamic-form/dynamic-form.component.html | 1 + .../app/GN2CommonModule/form/media/media-form-definition.ts | 2 +- .../src/app/GN2CommonModule/form/media/media.component.ts | 6 +++++- .../app/GN2CommonModule/form/media/medias.component.html | 1 + .../src/app/GN2CommonModule/form/media/medias.component.ts | 3 +++ 5 files changed, 11 insertions(+), 2 deletions(-) diff --git a/frontend/src/app/GN2CommonModule/form/dynamic-form/dynamic-form.component.html b/frontend/src/app/GN2CommonModule/form/dynamic-form/dynamic-form.component.html index 965acd47b1..17ac7a19db 100644 --- a/frontend/src/app/GN2CommonModule/form/dynamic-form/dynamic-form.component.html +++ b/frontend/src/app/GN2CommonModule/form/dynamic-form/dynamic-form.component.html @@ -231,6 +231,7 @@ [sizeMax]="appConfig.MEDIAS.MEDIAS_SIZE_MAX" [default]="formDefComp.default || {}" [details]="formDefComp.details" + [hideDetailsFields]="formDefComp.hide_details_fields" > diff --git a/frontend/src/app/GN2CommonModule/form/media/media-form-definition.ts b/frontend/src/app/GN2CommonModule/form/media/media-form-definition.ts index a2792fda25..08963f1cfd 100644 --- a/frontend/src/app/GN2CommonModule/form/media/media-form-definition.ts +++ b/frontend/src/app/GN2CommonModule/form/media/media-form-definition.ts @@ -45,7 +45,7 @@ export const mediaFormDefinitionsDict = { attribut_label: 'Avancé', definition: "Afficher plus d'options pour le formulaire", value: true, - hidden: ({ meta }) => !(meta.details && meta.details.length) + hidden: ({ meta }) => !(meta.details && meta.details.length) || meta.hideDetailsFields }, id_nomenclature_media_type: { attribut_label: 'Type de média', diff --git a/frontend/src/app/GN2CommonModule/form/media/media.component.ts b/frontend/src/app/GN2CommonModule/form/media/media.component.ts index b4fdd08f23..f9143be246 100644 --- a/frontend/src/app/GN2CommonModule/form/media/media.component.ts +++ b/frontend/src/app/GN2CommonModule/form/media/media.component.ts @@ -42,6 +42,9 @@ export class MediaComponent implements OnInit { @Input() details = []; + /* fix #1083 Cacher les champs présents dans details */ + @Input() hideDetailsFields : boolean = false; + constructor( private _formBuilder: FormBuilder, public ms: MediaService, @@ -54,7 +57,8 @@ export class MediaComponent implements OnInit { mediaFormDefinitionsDict, { nomenclatures: this.ms.metaNomenclatures(), - details: this.details + details: this.details, + hideDetailsFields: this.hideDetailsFields } ); diff --git a/frontend/src/app/GN2CommonModule/form/media/medias.component.html b/frontend/src/app/GN2CommonModule/form/media/medias.component.html index 654320f5e7..b893ac9f8d 100644 --- a/frontend/src/app/GN2CommonModule/form/media/medias.component.html +++ b/frontend/src/app/GN2CommonModule/form/media/medias.component.html @@ -74,6 +74,7 @@ [sizeMax]="sizeMax" [default]="default" [details]="details" + [hideDetailsFields]="hideDetailsFields" > diff --git a/frontend/src/app/GN2CommonModule/form/media/medias.component.ts b/frontend/src/app/GN2CommonModule/form/media/medias.component.ts index fbd51e942d..64304c83ca 100644 --- a/frontend/src/app/GN2CommonModule/form/media/medias.component.ts +++ b/frontend/src/app/GN2CommonModule/form/media/medias.component.ts @@ -31,6 +31,9 @@ export class MediasComponent implements OnInit { @Input() disabled = false; @Input() disabledTxt: string; + /* fix #1083 Cacher les champs présents dans details */ + @Input() hideDetailsFields : boolean = false; + public bInitialized: boolean; constructor(public ms: MediaService) {}