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:
		| @@ -20,7 +20,7 @@ const routes: Routes = [ | |||||||
|     {path: 'documents', component: DocumentListComponent }, |     {path: 'documents', component: DocumentListComponent }, | ||||||
|     {path: 'view/:id', component: DocumentListComponent }, |     {path: 'view/:id', component: DocumentListComponent }, | ||||||
|     {path: 'search', component: SearchComponent }, |     {path: 'search', component: SearchComponent }, | ||||||
|     {path: 'documents/:id', component: DocumentDetailComponent, canDeactivate: [DirtyFormGuard] }, |     {path: 'documents/:id', component: DocumentDetailComponent }, | ||||||
|  |  | ||||||
|     {path: 'tags', component: TagListComponent }, |     {path: 'tags', component: TagListComponent }, | ||||||
|     {path: 'documenttypes', component: DocumentTypeListComponent }, |     {path: 'documenttypes', component: DocumentTypeListComponent }, | ||||||
|   | |||||||
| @@ -38,7 +38,7 @@ | |||||||
|         </svg> <span class="d-none d-lg-inline" i18n>More like this</span> |         </svg> <span class="d-none d-lg-inline" i18n>More like this</span> | ||||||
|     </button> |     </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"> |         <svg class="buttonicon" fill="currentColor"> | ||||||
|             <use xlink:href="assets/bootstrap-icons.svg#x" /> |             <use xlink:href="assets/bootstrap-icons.svg#x" /> | ||||||
|         </svg> <span class="d-none d-lg-inline" i18n>Close</span> |         </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() { |   close() { | ||||||
|     this.openDocumentService.closeDocument(this.document) |     this.openDocumentService.closeDocument(this.document) | ||||||
|     if (this.documentListViewService.savedViewId) { |     if (this.documentListViewService.savedViewId) { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Michael Shamoon
					Michael Shamoon