mirror of
				https://github.com/paperless-ngx/paperless-ngx.git
				synced 2025-10-30 03:56:23 -05:00 
			
		
		
		
	Dont warn on navigate for documents
This commit is contained in:
		| @@ -38,7 +38,7 @@ | ||||
|         </svg> <span class="d-none d-lg-inline" i18n>More like this</span> | ||||
|     </button> | ||||
|  | ||||
|     <button type="button" class="btn btn-sm btn-outline-primary" (click)="close()"> | ||||
|     <button type="button" class="btn btn-sm btn-outline-primary" (click)="maybeClose()"> | ||||
|         <svg class="buttonicon" fill="currentColor"> | ||||
|             <use xlink:href="assets/bootstrap-icons.svg#x" /> | ||||
|         </svg> <span class="d-none d-lg-inline" i18n>Close</span> | ||||
|   | ||||
| @@ -202,6 +202,26 @@ export class DocumentDetailComponent implements OnInit, DirtyComponent { | ||||
|     }) | ||||
|   } | ||||
|  | ||||
|   maybeClose() { | ||||
|     this.isDirty$.subscribe(dirty => { | ||||
|       if (dirty) { | ||||
|         let modal = this.modalService.open(ConfirmDialogComponent, {backdrop: 'static'}) | ||||
|         modal.componentInstance.title = $localize`Unsaved Changes` | ||||
|         modal.componentInstance.messageBold = $localize`You have unsaved changes.` | ||||
|         modal.componentInstance.message = $localize`Are you sure you want to leave?` | ||||
|         modal.componentInstance.btnClass = "btn-warning" | ||||
|         modal.componentInstance.btnCaption = $localize`Leave page` | ||||
|         modal.componentInstance.confirmClicked.subscribe(() => { | ||||
|           modal.componentInstance.buttonsEnabled = false | ||||
|           modal.close() | ||||
|           this.close() | ||||
|         }) | ||||
|       } else { | ||||
|         this.close() | ||||
|       } | ||||
|     }) | ||||
|   } | ||||
|  | ||||
|   close() { | ||||
|     this.openDocumentService.closeDocument(this.document) | ||||
|     if (this.documentListViewService.savedViewId) { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Michael Shamoon
					Michael Shamoon