From 63a58ccc38e2da9ed5a02fb3e650c9fb61ba1c2b Mon Sep 17 00:00:00 2001 From: jonaswinkler Date: Fri, 11 Dec 2020 14:30:59 +0100 Subject: [PATCH] a simple dialog that selects tags/correspondents/types --- src-ui/src/app/app.module.ts | 4 ++- .../select-dialog.component.html | 15 ++++++++ .../select-dialog.component.scss | 0 .../select-dialog.component.spec.ts | 25 ++++++++++++++ .../select-dialog/select-dialog.component.ts | 34 +++++++++++++++++++ 5 files changed, 77 insertions(+), 1 deletion(-) create mode 100644 src-ui/src/app/components/common/select-dialog/select-dialog.component.html create mode 100644 src-ui/src/app/components/common/select-dialog/select-dialog.component.scss create mode 100644 src-ui/src/app/components/common/select-dialog/select-dialog.component.spec.ts create mode 100644 src-ui/src/app/components/common/select-dialog/select-dialog.component.ts diff --git a/src-ui/src/app/app.module.ts b/src-ui/src/app/app.module.ts index ad12c9c47..af66993c6 100644 --- a/src-ui/src/app/app.module.ts +++ b/src-ui/src/app/app.module.ts @@ -48,6 +48,7 @@ import { WidgetFrameComponent } from './components/dashboard/widgets/widget-fram import { WelcomeWidgetComponent } from './components/dashboard/widgets/welcome-widget/welcome-widget.component'; import { YesNoPipe } from './pipes/yes-no.pipe'; import { FileSizePipe } from './pipes/file-size.pipe'; +import { SelectDialogComponent } from './components/common/select-dialog/select-dialog.component'; @NgModule({ declarations: [ @@ -88,7 +89,8 @@ import { FileSizePipe } from './pipes/file-size.pipe'; WidgetFrameComponent, WelcomeWidgetComponent, YesNoPipe, - FileSizePipe + FileSizePipe, + SelectDialogComponent ], imports: [ BrowserModule, diff --git a/src-ui/src/app/components/common/select-dialog/select-dialog.component.html b/src-ui/src/app/components/common/select-dialog/select-dialog.component.html new file mode 100644 index 000000000..8bde38d61 --- /dev/null +++ b/src-ui/src/app/components/common/select-dialog/select-dialog.component.html @@ -0,0 +1,15 @@ + + + \ No newline at end of file diff --git a/src-ui/src/app/components/common/select-dialog/select-dialog.component.scss b/src-ui/src/app/components/common/select-dialog/select-dialog.component.scss new file mode 100644 index 000000000..e69de29bb diff --git a/src-ui/src/app/components/common/select-dialog/select-dialog.component.spec.ts b/src-ui/src/app/components/common/select-dialog/select-dialog.component.spec.ts new file mode 100644 index 000000000..3810bcbea --- /dev/null +++ b/src-ui/src/app/components/common/select-dialog/select-dialog.component.spec.ts @@ -0,0 +1,25 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { SelectDialogComponent } from './select-dialog.component'; + +describe('SelectDialogComponent', () => { + let component: SelectDialogComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [ SelectDialogComponent ] + }) + .compileComponents(); + }); + + beforeEach(() => { + fixture = TestBed.createComponent(SelectDialogComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src-ui/src/app/components/common/select-dialog/select-dialog.component.ts b/src-ui/src/app/components/common/select-dialog/select-dialog.component.ts new file mode 100644 index 000000000..76b23491c --- /dev/null +++ b/src-ui/src/app/components/common/select-dialog/select-dialog.component.ts @@ -0,0 +1,34 @@ +import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core'; +import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; +import { ObjectWithId } from 'src/app/data/object-with-id'; + +@Component({ + selector: 'app-select-dialog', + templateUrl: './select-dialog.component.html', + styleUrls: ['./select-dialog.component.scss'] +}) + +export class SelectDialogComponent implements OnInit { + constructor(public activeModal: NgbActiveModal) { } + + @Output() + public selectClicked = new EventEmitter() + + @Input() + title = "Select" + + @Input() + message = "Please select an object" + + @Input() + objects: ObjectWithId[] = [] + + selected: number + + ngOnInit(): void { + } + + cancelClicked() { + this.activeModal.close() + } +}