From 4dd79296e81c1bc9fc77ae41c4a6321986068532 Mon Sep 17 00:00:00 2001 From: GabrielMeyer Date: Wed, 21 Aug 2019 09:03:07 +0200 Subject: [PATCH] Fixes directories as attachments - Directories are not available anymore. --- .../agenda-content-object-form.component.html | 2 +- .../attachment-control.component.html | 9 ++------ .../attachment-control.component.ts | 11 ++++++---- .../extension-field.component.html | 2 +- .../media-upload-content.component.html | 4 ++-- .../search-value-selector.component.spec.ts | 2 +- .../search-value-selector.component.ts | 10 ++++----- .../list-of-speakers.component.html | 9 ++++++-- .../assignment-detail.component.html | 22 ++++++++++++++----- .../history-list/history-list.component.html | 2 +- .../mediafile-list.component.html | 6 ++--- ...motion-comment-section-list.component.html | 9 +++----- .../manage-submitters.component.html | 2 +- .../motion-detail.component.html | 8 +++---- .../topic-detail/topic-detail.component.html | 7 ++++-- 15 files changed, 59 insertions(+), 46 deletions(-) diff --git a/client/src/app/shared/components/agenda-content-object-form/agenda-content-object-form.component.html b/client/src/app/shared/components/agenda-content-object-form/agenda-content-object-form.component.html index bd59f1a30..d0a41560d 100644 --- a/client/src/app/shared/components/agenda-content-object-form/agenda-content-object-form.component.html +++ b/client/src/app/shared/components/agenda-content-object-form/agenda-content-object-form.component.html @@ -28,7 +28,7 @@ [multiple]="false" [includeNone]="true" listname="{{ 'Parent agenda item' | translate }}" - [InputListValues]="itemObserver" + [inputListValues]="itemObserver" > diff --git a/client/src/app/shared/components/attachment-control/attachment-control.component.html b/client/src/app/shared/components/attachment-control/attachment-control.component.html index 8d0c05b39..65b22b0eb 100644 --- a/client/src/app/shared/components/attachment-control/attachment-control.component.html +++ b/client/src/app/shared/components/attachment-control/attachment-control.component.html @@ -5,14 +5,9 @@ [multiple]="true" listname="{{ 'Attachments' | translate }}" [formControl]="controlName" - [InputListValues]="mediaFileList" + [inputListValues]="mediaFileList" > - diff --git a/client/src/app/shared/components/attachment-control/attachment-control.component.ts b/client/src/app/shared/components/attachment-control/attachment-control.component.ts index 5df19c9b4..66a6e4be2 100644 --- a/client/src/app/shared/components/attachment-control/attachment-control.component.ts +++ b/client/src/app/shared/components/attachment-control/attachment-control.component.ts @@ -2,7 +2,8 @@ import { Component, EventEmitter, Input, OnInit, Output, TemplateRef } from '@an import { ControlValueAccessor, FormControl } from '@angular/forms'; import { MatDialog } from '@angular/material'; -import { BehaviorSubject } from 'rxjs'; +import { Observable } from 'rxjs'; +import { map } from 'rxjs/operators'; import { MediafileRepositoryService } from 'app/core/repositories/mediafiles/mediafile-repository.service'; import { mediumDialogSettings } from 'app/shared/utils/dialog-settings'; @@ -29,7 +30,7 @@ export class AttachmentControlComponent implements OnInit, ControlValueAccessor /** * The file list that is necessary for the `SearchValueSelector` */ - public mediaFileList: BehaviorSubject = new BehaviorSubject([]); + public mediaFileList: Observable; /** * Default constructor @@ -43,7 +44,9 @@ export class AttachmentControlComponent implements OnInit, ControlValueAccessor * On init method */ public ngOnInit(): void { - this.mediaFileList = this.mediaService.getViewModelListBehaviorSubject(); + this.mediaFileList = this.mediaService + .getViewModelListObservable() + .pipe(map(files => files.filter(file => !file.is_directory))); } /** @@ -52,7 +55,7 @@ export class AttachmentControlComponent implements OnInit, ControlValueAccessor * @param dialog the dialog to open */ public openUploadDialog(dialog: TemplateRef): void { - this.dialogService.open(dialog, mediumDialogSettings); + this.dialogService.open(dialog, { ...mediumDialogSettings, disableClose: false }); } /** diff --git a/client/src/app/shared/components/extension-field/extension-field.component.html b/client/src/app/shared/components/extension-field/extension-field.component.html index b584f6349..1c8850c5b 100644 --- a/client/src/app/shared/components/extension-field/extension-field.component.html +++ b/client/src/app/shared/components/extension-field/extension-field.component.html @@ -43,7 +43,7 @@ ngDefaultControl [formControl]="extensionFieldForm.get('list')" [fullWidth]="true" - [InputListValues]="searchList" + [inputListValues]="searchList" [listname]="searchListLabel" > diff --git a/client/src/app/shared/components/media-upload-content/media-upload-content.component.html b/client/src/app/shared/components/media-upload-content/media-upload-content.component.html index 369456873..d6bdae870 100644 --- a/client/src/app/shared/components/media-upload-content/media-upload-content.component.html +++ b/client/src/app/shared/components/media-upload-content/media-upload-content.component.html @@ -21,7 +21,7 @@ [includeNone]="true" [noneTitle]="'Base folder'" listname="{{ 'Parent directory' | translate }}" - [InputListValues]="directoryBehaviorSubject" + [inputListValues]="directoryBehaviorSubject" > @@ -72,7 +72,7 @@ [formControl]="file.form.get('access_groups_id')" [multiple]="true" listname="{{ 'Access groups' | translate }}" - [InputListValues]="groupsBehaviorSubject" + [inputListValues]="groupsBehaviorSubject" > diff --git a/client/src/app/shared/components/search-value-selector/search-value-selector.component.spec.ts b/client/src/app/shared/components/search-value-selector/search-value-selector.component.spec.ts index bdfa2788a..ac15cebd3 100644 --- a/client/src/app/shared/components/search-value-selector/search-value-selector.component.spec.ts +++ b/client/src/app/shared/components/search-value-selector/search-value-selector.component.spec.ts @@ -40,7 +40,7 @@ describe('SearchValueSelectorComponent', () => { subjectList.push(new EmptySelectable()); } const subject: BehaviorSubject = new BehaviorSubject(subjectList); - hostComponent.searchValueSelectorComponent.InputListValues = subject; + hostComponent.searchValueSelectorComponent.inputListValues = subject; const formBuilder: FormBuilder = TestBed.get(FormBuilder); const formGroup = formBuilder.group({ diff --git a/client/src/app/shared/components/search-value-selector/search-value-selector.component.ts b/client/src/app/shared/components/search-value-selector/search-value-selector.component.ts index 0f5a6b0c5..f59084fcf 100644 --- a/client/src/app/shared/components/search-value-selector/search-value-selector.component.ts +++ b/client/src/app/shared/components/search-value-selector/search-value-selector.component.ts @@ -3,7 +3,7 @@ import { FormControl } from '@angular/forms'; import { MatSelect } from '@angular/material'; import { TranslateService } from '@ngx-translate/core'; -import { BehaviorSubject, Subscription } from 'rxjs'; +import { Observable, Subscription } from 'rxjs'; import { auditTime } from 'rxjs/operators'; import { Selectable } from '../selectable'; @@ -79,7 +79,7 @@ export class SearchValueSelectorComponent implements OnDestroy { * changes its values. */ @Input() - public set InputListValues(value: BehaviorSubject) { + public set inputListValues(value: Observable) { if (!value) { return; } @@ -91,9 +91,9 @@ export class SearchValueSelectorComponent implements OnDestroy { this._inputListSubscription = value.pipe(auditTime(10)).subscribe(items => { this.selectableItems = items; if (this.formControl) { - items.length === 0 - ? this.formControl.disable({ emitEvent: false }) - : this.formControl.enable({ emitEvent: false }); + !!items && items.length > 0 + ? this.formControl.enable({ emitEvent: false }) + : this.formControl.disable({ emitEvent: false }); } }); } diff --git a/client/src/app/site/agenda/components/list-of-speakers/list-of-speakers.component.html b/client/src/app/site/agenda/components/list-of-speakers/list-of-speakers.component.html index c3b13751e..1d624cb5a 100644 --- a/client/src/app/site/agenda/components/list-of-speakers/list-of-speakers.component.html +++ b/client/src/app/site/agenda/components/list-of-speakers/list-of-speakers.component.html @@ -128,7 +128,7 @@ ngDefaultControl [formControl]="addSpeakerForm.get('user_id')" listname="{{ 'Select or search new speaker ...' | translate }}" - [InputListValues]="filteredUsers" + [inputListValues]="filteredUsers" > @@ -136,7 +136,12 @@
- diff --git a/client/src/app/site/assignments/components/assignment-detail/assignment-detail.component.html b/client/src/app/site/assignments/components/assignment-detail/assignment-detail.component.html index d0e024ee3..58451f916 100644 --- a/client/src/app/site/assignments/components/assignment-detail/assignment-detail.component.html +++ b/client/src/app/site/assignments/components/assignment-detail/assignment-detail.component.html @@ -199,7 +199,7 @@ [formControl]="candidatesForm.get('userId')" [multiple]="false" listname="{{ 'Select a new candidate' | translate }}" - [InputListValues]="filteredCandidates" + [inputListValues]="filteredCandidates" >
@@ -263,16 +263,22 @@ [multiple]="true" [includeNone]="true" listname="{{ 'Tags' | translate }}" - [InputListValues]="tagsObserver" + [inputListValues]="tagsObserver" >
- +
- +
@@ -296,8 +302,12 @@ type="number" required /> - {{ 'This field is required.' | translate }} - {{ 'The number has to be greater than 0.' | translate }} + {{ + 'This field is required.' | translate + }} + {{ + 'The number has to be greater than 0.' | translate + }}
diff --git a/client/src/app/site/history/components/history-list/history-list.component.html b/client/src/app/site/history/components/history-list/history-list.component.html index c791ab67d..f92137f09 100644 --- a/client/src/app/site/history/components/history-list/history-list.component.html +++ b/client/src/app/site/history/components/history-list/history-list.component.html @@ -20,7 +20,7 @@ [multiple]="false" [includeNone]="false" listname="{{ 'Motion' | translate }}" - [InputListValues]="collectionObserver" + [inputListValues]="collectionObserver" > 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 e50345a3b..a7b7fbebb 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 @@ -273,7 +273,7 @@ [formControl]="fileEditForm.get('access_groups_id')" [multiple]="true" listname="{{ 'Access groups' | translate }}" - [InputListValues]="groupsBehaviorSubject" + [inputListValues]="groupsBehaviorSubject" > @@ -308,7 +308,7 @@ [formControl]="newDirectoryForm.get('access_groups_id')" [multiple]="true" listname="{{ 'Access groups' | translate }}" - [InputListValues]="groupsBehaviorSubject" + [inputListValues]="groupsBehaviorSubject" > @@ -335,7 +335,7 @@ [includeNone]="true" [noneTitle]="'Base folder'" listname="{{ 'Parent directory' | translate }}" - [InputListValues]="filteredDirectoryBehaviorSubject" + [inputListValues]="filteredDirectoryBehaviorSubject" >
diff --git a/client/src/app/site/motions/modules/motion-comment-section/components/motion-comment-section-list/motion-comment-section-list.component.html b/client/src/app/site/motions/modules/motion-comment-section/components/motion-comment-section-list/motion-comment-section-list.component.html index 0367f3fca..14888740f 100644 --- a/client/src/app/site/motions/modules/motion-comment-section/components/motion-comment-section-list/motion-comment-section-list.component.html +++ b/client/src/app/site/motions/modules/motion-comment-section/components/motion-comment-section-list/motion-comment-section-list.component.html @@ -14,10 +14,7 @@
- +
@@ -95,7 +92,7 @@ [formControl]="commentFieldForm.get('read_groups_id')" [multiple]="true" listname="Groups with read permissions" - [InputListValues]="groups" + [inputListValues]="groups" >

@@ -104,7 +101,7 @@ [formControl]="commentFieldForm.get('write_groups_id')" [multiple]="true" listname="Groups with write permissions" - [InputListValues]="groups" + [inputListValues]="groups" >

diff --git a/client/src/app/site/motions/modules/motion-detail/components/manage-submitters/manage-submitters.component.html b/client/src/app/site/motions/modules/motion-detail/components/manage-submitters/manage-submitters.component.html index b181f2c84..3de4f4af5 100644 --- a/client/src/app/site/motions/modules/motion-detail/components/manage-submitters/manage-submitters.component.html +++ b/client/src/app/site/motions/modules/motion-detail/components/manage-submitters/manage-submitters.component.html @@ -39,7 +39,7 @@ ngDefaultControl [formControl]="addSubmitterForm.get('userId')" listname="{{ 'Select or search new submitter ...' | translate }}" - [InputListValues]="users" + [inputListValues]="users" > diff --git a/client/src/app/site/motions/modules/motion-detail/components/motion-detail/motion-detail.component.html b/client/src/app/site/motions/modules/motion-detail/components/motion-detail/motion-detail.component.html index 9ab256f1a..efd94271c 100644 --- a/client/src/app/site/motions/modules/motion-detail/components/motion-detail/motion-detail.component.html +++ b/client/src/app/site/motions/modules/motion-detail/components/motion-detail/motion-detail.component.html @@ -613,7 +613,7 @@ [formControl]="contentForm.get('submitters_id')" [multiple]="true" listname="{{ 'Submitters' | translate }}" - [InputListValues]="submitterObserver" + [inputListValues]="submitterObserver" >
@@ -800,7 +800,7 @@ [formControl]="contentForm.get('category_id')" [includeNone]="true" listname="{{ 'Category' | translate }}" - [InputListValues]="categoryObserver" + [inputListValues]="categoryObserver" > @@ -835,7 +835,7 @@ [formControl]="contentForm.get('supporters_id')" [multiple]="true" listname="{{ 'Supporters' | translate }}" - [InputListValues]="supporterObserver" + [inputListValues]="supporterObserver" > @@ -847,7 +847,7 @@ ngDefaultControl [formControl]="contentForm.get('workflow_id')" listname="{{ 'Workflow' | translate }}" - [InputListValues]="workflowObserver" + [inputListValues]="workflowObserver" > diff --git a/client/src/app/site/topics/components/topic-detail/topic-detail.component.html b/client/src/app/site/topics/components/topic-detail/topic-detail.component.html index 79f8168b9..888c3cbb4 100644 --- a/client/src/app/site/topics/components/topic-detail/topic-detail.component.html +++ b/client/src/app/site/topics/components/topic-detail/topic-detail.component.html @@ -69,7 +69,10 @@ - +
@@ -90,7 +93,7 @@ [formControl]="topicForm.get('agenda_parent_id')" [includeNone]="true" listname="{{ 'Parent agenda item' | translate }}" - [InputListValues]="itemObserver" + [inputListValues]="itemObserver" >