mirror of
				https://github.com/paperless-ngx/paperless-ngx.git
				synced 2025-10-30 03:56:23 -05:00 
			
		
		
		
	feat: return to previous view after editing document (#8879)
This commit is contained in:
		| @@ -169,7 +169,9 @@ export class TasksComponent | ||||
|  | ||||
|   dismissAndGo(task: PaperlessTask) { | ||||
|     this.dismissTask(task) | ||||
|     this.router.navigate(['documents', task.related_document]) | ||||
|     this.router.navigate(['documents', task.related_document, 'details'], { | ||||
|       state: { previousUrl: this.router.url }, | ||||
|     }) | ||||
|   } | ||||
|  | ||||
|   expandTask(task: PaperlessTask) { | ||||
|   | ||||
| @@ -254,6 +254,7 @@ export class DocumentDetailComponent | ||||
|  | ||||
|   DocumentDetailNavIDs = DocumentDetailNavIDs | ||||
|   activeNavID: number | ||||
|   previousUrl: string | ||||
|  | ||||
|   constructor( | ||||
|     private documentsService: DocumentService, | ||||
| @@ -275,6 +276,9 @@ export class DocumentDetailComponent | ||||
|     private hotKeyService: HotKeyService | ||||
|   ) { | ||||
|     super() | ||||
|  | ||||
|     let previousUrl = router.getCurrentNavigation()?.extras?.state?.previousUrl | ||||
|     this.previousUrl = previousUrl ? previousUrl : '/' | ||||
|   } | ||||
|  | ||||
|   titleKeyUp(event) { | ||||
| @@ -889,7 +893,7 @@ export class DocumentDetailComponent | ||||
|             this.documentListViewService.activeSavedViewId, | ||||
|           ]) | ||||
|         } else { | ||||
|           this.router.navigate(['documents']) | ||||
|           this.router.navigateByUrl(this.previousUrl) | ||||
|         } | ||||
|       }) | ||||
|   } | ||||
|   | ||||
| @@ -140,7 +140,7 @@ | ||||
|       <div class="d-flex justify-content-between align-items-center"> | ||||
|         <div class="btn-group w-100"> | ||||
|           @if (document) { | ||||
|             <a routerLink="/documents/{{document.id}}" class="btn btn-sm btn-outline-secondary" title="Open" i18n-title *pngxIfPermissions="{ action: PermissionAction.Change, type: PermissionType.Document }" i18n-title> | ||||
|             <a (click)="openDocumentDetail(document.id)"  class="btn btn-sm btn-outline-secondary" title="Open" i18n-title *pngxIfPermissions="{ action: PermissionAction.Change, type: PermissionType.Document }" i18n-title> | ||||
|               <i-bs name="file-earmark-richtext"></i-bs> | ||||
|             </a> | ||||
|             <pngx-preview-popup [document]="document" #popupPreview> | ||||
|   | ||||
| @@ -7,7 +7,7 @@ import { | ||||
|   Output, | ||||
|   ViewChild, | ||||
| } from '@angular/core' | ||||
| import { RouterModule } from '@angular/router' | ||||
| import { Router, RouterModule } from '@angular/router' | ||||
| import { | ||||
|   NgbProgressbarModule, | ||||
|   NgbTooltipModule, | ||||
| @@ -67,7 +67,8 @@ export class DocumentCardSmallComponent | ||||
|  | ||||
|   constructor( | ||||
|     private documentService: DocumentService, | ||||
|     public settingsService: SettingsService | ||||
|     public settingsService: SettingsService, | ||||
|     private router: Router | ||||
|   ) { | ||||
|     super() | ||||
|   } | ||||
| @@ -123,6 +124,12 @@ export class DocumentCardSmallComponent | ||||
|     return this.documentService.getDownloadUrl(this.document.id) | ||||
|   } | ||||
|  | ||||
|   openDocumentDetail(documentId) { | ||||
|     this.router.navigate(['/documents', documentId, 'details'], { | ||||
|       state: { previousUrl: this.router.url }, | ||||
|     }) | ||||
|   } | ||||
|  | ||||
|   get tagIDs() { | ||||
|     const limit = this.document.notes.length > 0 ? 6 : 7 | ||||
|     if (this.document.tags.length > limit) { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Alisan Stoll
					Alisan Stoll