Skip to content

A community-supported supercharged document management system: scan, index and archive all your documents

Enhancement: doc details ux improvements (#14485)

shamoond76943d57c51
diff --git a/src-ui/src/app/components/common/input/permissions/permissions-form/permissions-form.component.html b/src-ui/src/app/components/common/input/permissions/permissions-form/permissions-form.component.html
index 3ba732dc5..1d715b6dc 100644
--- a/src-ui/src/app/components/common/input/permissions/permissions-form/permissions-form.component.html
+++ b/src-ui/src/app/components/common/input/permissions/permissions-form/permissions-form.component.html
@@ -1,5 +1,7 @@
@if (!accordion) {
- <h5 i18n>Permissions</h5>
+ @if (title?.length > 0) {
+ <h5>{{title}}</h5>
+ }
<ng-container [ngTemplateOutlet]="permissionsForm"></ng-container>
}
@if (accordion) {
diff --git a/src-ui/src/app/components/common/input/permissions/permissions-form/permissions-form.component.ts b/src-ui/src/app/components/common/input/permissions/permissions-form/permissions-form.component.ts
index 4da6c9ca9..c09f4aac6 100644
--- a/src-ui/src/app/components/common/input/permissions/permissions-form/permissions-form.component.ts
+++ b/src-ui/src/app/components/common/input/permissions/permissions-form/permissions-form.component.ts
@@ -59,6 +59,9 @@ export class PermissionsFormComponent
@Input()
accordion: boolean = false
+ @Input()
+ title: string = $localize`Permissions`
+
form = new FormGroup({
owner: new FormControl(null),
set_permissions: new FormGroup({
diff --git a/src-ui/src/app/components/common/page-header/page-header.component.html b/src-ui/src/app/components/common/page-header/page-header.component.html
index be0327e50..3be16747f 100644
--- a/src-ui/src/app/components/common/page-header/page-header.component.html
+++ b/src-ui/src/app/components/common/page-header/page-header.component.html
@@ -3,13 +3,13 @@
<h3 class="d-flex align-items-center mb-2 mb-md-1" style="line-height: 1.4">
<span class="text-truncate">{{title()}}</span>
@if (id()) {
- <span class="badge bg-primary text-primary-text-contrast ms-3 small fs-normal cursor-pointer" (click)="copyID()">
+ <button type="button" class="badge border-0 bg-primary text-primary-text-contrast ms-3 small fs-normal" (click)="copyID()" title="Copy ID" i18n-title>
@if (copied()) {
<i-bs width="1em" height="1em" name="clipboard-check" class="me-1"></i-bs><ng-container i18n>Copied!</ng-container>
} @else {
ID: {{id()}}
}
- </span>
+ </button>
}
@if (subTitle()) {
<span class="page-subtitle h6 mb-0 mt-1 fw-normal ms-md-3 text-truncate" style="line-height: 1.4">{{subTitle()}}</span>
diff --git a/src-ui/src/app/components/common/page-header/page-header.component.spec.ts b/src-ui/src/app/components/common/page-header/page-header.component.spec.ts
index 1bdcd4279..603dcd028 100644
--- a/src-ui/src/app/components/common/page-header/page-header.component.spec.ts
+++ b/src-ui/src/app/components/common/page-header/page-header.component.spec.ts
@@ -43,6 +43,13 @@ describe('PageHeaderComponent', () => {
expect(titleSpy).toHaveBeenCalledWith(`Foo Bar - ${environment.appTitle}`)
})
+ it('should set html title to just the app title until a title is available', () => {
+ const titleSpy = jest.spyOn(titleService, 'setTitle')
+ fixture.componentRef.setInput('title', undefined)
+ fixture.detectChanges()
+ expect(titleSpy).toHaveBeenCalledWith(environment.appTitle)
+ })
+
it('should copy id to clipboard, reset after 3 seconds', () => {
jest.useFakeTimers()
fixture.componentRef.setInput('id', 42)
diff --git a/src-ui/src/app/components/common/page-header/page-header.component.ts b/src-ui/src/app/components/common/page-header/page-header.component.ts
index 1f15ee378..a0a1cc364 100644
--- a/src-ui/src/app/components/common/page-header/page-header.component.ts
+++ b/src-ui/src/app/components/common/page-header/page-header.component.ts
@@ -27,7 +27,10 @@ export class PageHeaderComponent {
constructor() {
effect(() => {
- this.titleService.setTitle(`${this.title()} - ${environment.appTitle}`)
+ const title = this.title()
+ this.titleService.setTitle(
+ title ? `${title} - ${environment.appTitle}` : environment.appTitle
+ )
})
}
diff --git a/src-ui/src/app/components/document-detail/document-detail.component.html b/src-ui/src/app/components/document-detail/document-detail.component.html
index 184b623ab..3880e2bd3 100644
--- a/src-ui/src/app/components/document-detail/document-detail.component.html
+++ b/src-ui/src/app/components/document-detail/document-detail.component.html
@@ -1,25 +1,4 @@
<pngx-page-header [title]="title()" [id]="documentId()">
- @if (archiveContentRenderType === ContentRenderType.PDF && !useNativePdfViewer) {
- @if (previewNumPages()) {
- <div class="input-group input-group-sm ms-2 d-none d-md-flex">
- <div class="input-group-text" i18n>Page</div>
- <input class="form-control flex-grow-0 w-auto" type="number" min="1" [max]="previewNumPages()" [ngModel]="previewCurrentPage()" (ngModelChange)="previewCurrentPage.set($event)" />
- <div class="input-group-text" i18n>of {{previewNumPages()}}</div>
- </div>
- }
- <div class="input-group input-group-sm me-md-5 d-none d-md-flex">
- <button class="btn btn-outline-secondary" (click)="decreaseZoom()" i18n>-</button>
- <select class="form-select" (change)="setZoom($event.target.value)" [ngModel]="currentZoom">
- @for (setting of zoomSettings; track setting) {
- <option [value]="setting">
- {{ getZoomSettingTitle(setting) }}
- </option>
- }
- </select>
- <button class="btn btn-outline-secondary" (click)="increaseZoom()" i18n>+</button>
- </div>
- }
-
<button type="button" class="btn btn-sm btn-outline-danger me-md-4" (click)="delete()" [disabled]="!userIsOwner" *pngxIfPermissions="{ action: PermissionAction.Delete, type: PermissionType.Document }" aria-label="Delete" i18n-aria-label>
<i-bs width="1.2em" height="1.2em" name="trash"></i-bs><span class="d-none d-lg-inline ps-1" i18n>Delete</span>
</button>
@@ -34,7 +13,7 @@
(versionsUpdated)="onVersionsUpdated($event)"
/>
- <div class="btn-group">
+ <div class="btn-group ms-4">
<button (click)="download()" class="btn btn-sm btn-outline-primary" [disabled]="downloading()" aria-label="Download" i18n-aria-label>
@if (downloading()) {
<div class="spinner-border spinner-border-sm" role="status"></div>
@@ -94,7 +73,7 @@
<button class="btn btn-sm btn-outline-primary" id="sendDropdown" ngbDropdownToggle aria-label="Send" i18n-aria-label>
<i-bs name="send"></i-bs><div class="d-none d-sm-inline ms-1"><ng-container i18n>Send</ng-container></div>
</button>
- <div ngbDropdownMenu aria-labelledby="actionsDropdown" class="shadow">
+ <div ngbDropdownMenu aria-labelledby="sendDropdown" class="shadow">
<button ngbDropdownItem (click)="openShareLinks()" *pngxIfPermissions="{ action: PermissionAction.Add, type: PermissionType.ShareLink }">
<i-bs name="link" class="me-1"></i-bs><span i18n>Share Links</span>
</button>
@@ -113,8 +92,8 @@
<form [formGroup]='documentForm' (ngSubmit)="save()">
- <div class="btn-toolbar justify-content-end mb-1 pb-3 gap-2 row-gap-2 border-bottom">
- <div class="btn-group me-auto">
+ <div class="btn-toolbar mb-1 pb-3 gap-2 row-gap-2 border-bottom">
+ <div class="btn-group">
<button type="button" class="btn btn-sm btn-outline-secondary" i18n-title title="Close" (click)="close()">
<i-bs width="1.2em" height="1.2em" name="x"></i-bs>
</button>
@@ -127,43 +106,30 @@
</div>
<ng-container *pngxIfPermissions="{ action: PermissionAction.Change, type: PermissionType.Document }">
- <div class="d-flex gap-2">
- <div class="btn-group">
- <pngx-suggestions-dropdown *pngxIfPermissions="{ action: PermissionAction.Change, type: PermissionType.Document }"
- [disabled]="!userCanEdit || suggestionsLoading()"
- [loading]="suggestionsLoading()"
- [suggestions]="suggestions()"
- [aiEnabled]="aiEnabled"
- [source]="suggestionSource"
- [defaultSource]="defaultSuggestionSource"
- [fetchedSources]="fetchedSuggestionSources()"
- [appliedTags]="documentForm.value.tags"
- [appliedCorrespondent]="documentForm.value.correspondent"
- [appliedDocumentType]="documentForm.value.document_type"
- [appliedStoragePath]="documentForm.value.storage_path"
- [appliedTitle]="documentForm.value.title"
- [appliedCreated]="documentForm.value.created"
- (getSuggestions)="getSuggestions($event)"
- (sourceChange)="suggestionSourceOverride.set($event)"
- (addTag)="createTag($event)"
- (addDocumentType)="createDocumentType($event)"
- (addCorrespondent)="createCorrespondent($event)">
- </pngx-suggestions-dropdown>
- </div>
-
- <div class="btn-group">
- <pngx-custom-fields-dropdown
- *pngxIfPermissions="{ action: PermissionAction.View, type: PermissionType.CustomField }"
- [documentId]="documentId()"
- [disabled]="!userCanEdit"
- [existingFields]="document()?.custom_fields"
- (created)="refreshCustomFields()"
- (added)="addField($event)">
- </pngx-custom-fields-dropdown>
- </div>
+ <div class="btn-group ms-3">
+ <pngx-suggestions-dropdown *pngxIfPermissions="{ action: PermissionAction.Change, type: PermissionType.Document }"
+ [disabled]="!userCanEdit || suggestionsLoading()"
+ [loading]="suggestionsLoading()"
+ [suggestions]="suggestions()"
+ [aiEnabled]="aiEnabled"
+ [source]="suggestionSource"
+ [defaultSource]="defaultSuggestionSource"
+ [fetchedSources]="fetchedSuggestionSources()"
+ [appliedTags]="documentForm.value.tags"
+ [appliedCorrespondent]="documentForm.value.correspondent"
+ [appliedDocumentType]="documentForm.value.document_type"
+ [appliedStoragePath]="documentForm.value.storage_path"
+ [appliedTitle]="documentForm.value.title"
+ [appliedCreated]="documentForm.value.created"
+ (getSuggestions)="getSuggestions($event)"
+ (sourceChange)="suggestionSourceOverride.set($event)"
+ (addTag)="createTag($event)"
+ (addDocumentType)="createDocumentType($event)"
+ (addCorrespondent)="createCorrespondent($event)">
+ </pngx-suggestions-dropdown>
</div>
- <div class="ps-3">
+ <div class="ms-auto">
<ng-container *ngTemplateOutlet="saveButtons"></ng-container>
</div>
</ng-container>
@@ -290,8 +256,20 @@
}
</div>
- <div class="d-flex justify-content-end border-top pt-3">
- <ng-container *ngTemplateOutlet="saveButtons"></ng-container>
+ <div class="d-flex border-top pt-3">
+ <ng-container *pngxIfPermissions="{ action: PermissionAction.Change, type: PermissionType.Document }">
+ <pngx-custom-fields-dropdown
+ *pngxIfPermissions="{ action: PermissionAction.View, type: PermissionType.CustomField }"
+ [documentId]="documentId()"
+ [disabled]="!userCanEdit"
+ [existingFields]="document()?.custom_fields"
+ (created)="refreshCustomFields()"
+ (added)="addField($event)">
+ </pngx-custom-fields-dropdown>
+ </ng-container>
+ <div class="ms-auto">
+ <ng-container *ngTemplateOutlet="saveButtons"></ng-container>
+ </div>
</div>
</ng-template>
</li>
@@ -328,9 +306,9 @@
<td i18n>Original filename</td>
<td>{{metadata()?.original_filename}}</td>
</tr>
- <tr>
+ <tr class="align-middle">
<td i18n>Original SHA256 checksum</td>
- <td>{{metadata()?.original_checksum}}</td>
+ <td><span class="badge bg-light font-monospace text-wrap text-break text-start">{{metadata()?.original_checksum}}</span></td>
</tr>
<tr>
<td i18n>Original file size</td>
@@ -341,9 +319,9 @@
<td>{{metadata()?.original_mime_type}}</td>
</tr>
@if (metadata()?.has_archive_version) {
- <tr>
+ <tr class="align-middle">
<td i18n>Archive SHA256 checksum</td>
- <td>{{metadata()?.archive_checksum}}</td>
+ <td><span class="badge bg-light font-monospace text-wrap text-break text-start">{{metadata()?.archive_checksum}}</span></td>
</tr>
}
@if (metadata()?.has_archive_version) {
@@ -408,7 +386,7 @@
<a ngbNavLink i18n>Permissions</a>
<ng-template ngbNavContent>
<div class="mb-3">
- <pngx-permissions-form [users]="users()" formControlName="permissions_form"></pngx-permissions-form>
+ <pngx-permissions-form title="" [users]="users()" formControlName="permissions_form"></pngx-permissions-form>
</div>
</ng-template>
</li>
@@ -499,6 +477,29 @@
(loadError)="onError($event)"
(afterLoadComplete)="pdfPreviewLoaded($event)">
</pngx-pdf-viewer>
+ <div class="position-absolute bottom-0 start-50 translate-middle-x z-1 mb-3 d-flex gap-2 p-1 bg-body border rounded shadow">
+ @if (previewNumPages()) {
+ <div class="input-group input-group-sm w-auto flex-nowrap">
+ <input class="form-control flex-grow-0 w-auto" type="number" min="1" [max]="previewNumPages()" [ngModelOptions]="{standalone: true}" [ngModel]="previewCurrentPage()" (ngModelChange)="previewCurrentPage.set($event)" aria-label="Page" i18n-aria-label />
+ <div class="input-group-text" i18n>of {{previewNumPages()}}</div>
+ </div>
+ }
+ <div class="input-group input-group-sm w-auto flex-nowrap">
+ <button class="btn btn-outline-secondary" (click)="decreaseZoom()" aria-label="Zoom out" i18n-aria-label>
+ <i-bs width="1em" height="1em" name="dash"></i-bs>
+ </button>
+ <select class="form-select" (change)="setZoom($event.target.value)" [ngModelOptions]="{standalone: true}" [ngModel]="currentZoom" aria-label="Zoom" i18n-aria-label>
+ @for (setting of zoomSettings; track setting) {
+ <option [value]="setting">
+ {{ getZoomSettingTitle(setting) }}
+ </option>
+ }
+ </select>
+ <button class="btn btn-outline-secondary" (click)="increaseZoom()" aria-label="Zoom in" i18n-aria-label>
+ <i-bs width="1em" height="1em" name="plus"></i-bs>
+ </button>
+ </div>
+ </div>
</div>
} @else {
<object [data]="previewUrl() | safeUrl" class="preview-sticky" width="100%"></object>