mirror of
				https://github.com/paperless-ngx/paperless-ngx.git
				synced 2025-10-30 03:56:23 -05:00 
			
		
		
		
	a simple dialog that selects tags/correspondents/types
This commit is contained in:
		| @@ -48,6 +48,7 @@ import { WidgetFrameComponent } from './components/dashboard/widgets/widget-fram | |||||||
| import { WelcomeWidgetComponent } from './components/dashboard/widgets/welcome-widget/welcome-widget.component'; | import { WelcomeWidgetComponent } from './components/dashboard/widgets/welcome-widget/welcome-widget.component'; | ||||||
| import { YesNoPipe } from './pipes/yes-no.pipe'; | import { YesNoPipe } from './pipes/yes-no.pipe'; | ||||||
| import { FileSizePipe } from './pipes/file-size.pipe'; | import { FileSizePipe } from './pipes/file-size.pipe'; | ||||||
|  | import { SelectDialogComponent } from './components/common/select-dialog/select-dialog.component'; | ||||||
|  |  | ||||||
| @NgModule({ | @NgModule({ | ||||||
|   declarations: [ |   declarations: [ | ||||||
| @@ -88,7 +89,8 @@ import { FileSizePipe } from './pipes/file-size.pipe'; | |||||||
|     WidgetFrameComponent, |     WidgetFrameComponent, | ||||||
|     WelcomeWidgetComponent, |     WelcomeWidgetComponent, | ||||||
|     YesNoPipe, |     YesNoPipe, | ||||||
|     FileSizePipe |     FileSizePipe, | ||||||
|  |     SelectDialogComponent | ||||||
|   ], |   ], | ||||||
|   imports: [ |   imports: [ | ||||||
|     BrowserModule, |     BrowserModule, | ||||||
|   | |||||||
| @@ -0,0 +1,15 @@ | |||||||
|  | <div class="modal-header"> | ||||||
|  |   <h4 class="modal-title" id="modal-basic-title">{{title}}</h4> | ||||||
|  |   <button type="button" class="close" aria-label="Close" (click)="cancelClicked()"> | ||||||
|  |     <span aria-hidden="true">×</span> | ||||||
|  |   </button> | ||||||
|  | </div> | ||||||
|  | <div class="modal-body"> | ||||||
|  |  | ||||||
|  |   <app-input-select [items]="objects" [title]="message" [(ngModel)]="selected"></app-input-select> | ||||||
|  |  | ||||||
|  | </div> | ||||||
|  | <div class="modal-footer"> | ||||||
|  |   <button type="button" class="btn btn-outline-dark" (click)="cancelClicked()">Cancel</button> | ||||||
|  |   <button type="button" class="btn btn-primary" (click)="selectClicked.emit(selected)">Select</button> | ||||||
|  | </div> | ||||||
| @@ -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<SelectDialogComponent>; | ||||||
|  |  | ||||||
|  |   beforeEach(async () => { | ||||||
|  |     await TestBed.configureTestingModule({ | ||||||
|  |       declarations: [ SelectDialogComponent ] | ||||||
|  |     }) | ||||||
|  |     .compileComponents(); | ||||||
|  |   }); | ||||||
|  |  | ||||||
|  |   beforeEach(() => { | ||||||
|  |     fixture = TestBed.createComponent(SelectDialogComponent); | ||||||
|  |     component = fixture.componentInstance; | ||||||
|  |     fixture.detectChanges(); | ||||||
|  |   }); | ||||||
|  |  | ||||||
|  |   it('should create', () => { | ||||||
|  |     expect(component).toBeTruthy(); | ||||||
|  |   }); | ||||||
|  | }); | ||||||
| @@ -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() | ||||||
|  |   } | ||||||
|  | } | ||||||
		Reference in New Issue
	
	Block a user
	 jonaswinkler
					jonaswinkler