mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2026-10-19 14:28:14 +00:00
Compare commits
8
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
46e0f189dd | ||
|
|
31a801135e | ||
|
|
569205bfbb | ||
|
|
3ffbc09b45 | ||
|
|
4a0a7ccee7 | ||
|
|
9eb6619c7a | ||
|
|
a28642a1eb | ||
|
|
55934aea2b |
No files matched your search
+3
-1
@@ -1,5 +1,7 @@
|
|||||||
@if (!accordion) {
|
@if (!accordion) {
|
||||||
<h5 i18n>Permissions</h5>
|
@if (title?.length > 0) {
|
||||||
|
<h5>{{title}}</h5>
|
||||||
|
}
|
||||||
<ng-container [ngTemplateOutlet]="permissionsForm"></ng-container>
|
<ng-container [ngTemplateOutlet]="permissionsForm"></ng-container>
|
||||||
}
|
}
|
||||||
@if (accordion) {
|
@if (accordion) {
|
||||||
|
|||||||
+3
@@ -59,6 +59,9 @@ export class PermissionsFormComponent
|
|||||||
@Input()
|
@Input()
|
||||||
accordion: boolean = false
|
accordion: boolean = false
|
||||||
|
|
||||||
|
@Input()
|
||||||
|
title: string = $localize`Permissions`
|
||||||
|
|
||||||
form = new FormGroup({
|
form = new FormGroup({
|
||||||
owner: new FormControl(null),
|
owner: new FormControl(null),
|
||||||
set_permissions: new FormGroup({
|
set_permissions: new FormGroup({
|
||||||
|
|||||||
@@ -3,13 +3,13 @@
|
|||||||
<h3 class="d-flex align-items-center mb-2 mb-md-1" style="line-height: 1.4">
|
<h3 class="d-flex align-items-center mb-2 mb-md-1" style="line-height: 1.4">
|
||||||
<span class="text-truncate">{{title()}}</span>
|
<span class="text-truncate">{{title()}}</span>
|
||||||
@if (id()) {
|
@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()) {
|
@if (copied()) {
|
||||||
<i-bs width="1em" height="1em" name="clipboard-check" class="me-1"></i-bs><ng-container i18n>Copied!</ng-container>
|
<i-bs width="1em" height="1em" name="clipboard-check" class="me-1"></i-bs><ng-container i18n>Copied!</ng-container>
|
||||||
} @else {
|
} @else {
|
||||||
ID: {{id()}}
|
ID: {{id()}}
|
||||||
}
|
}
|
||||||
</span>
|
</button>
|
||||||
}
|
}
|
||||||
@if (subTitle()) {
|
@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>
|
<span class="page-subtitle h6 mb-0 mt-1 fw-normal ms-md-3 text-truncate" style="line-height: 1.4">{{subTitle()}}</span>
|
||||||
|
|||||||
@@ -43,6 +43,13 @@ describe('PageHeaderComponent', () => {
|
|||||||
expect(titleSpy).toHaveBeenCalledWith(`Foo Bar - ${environment.appTitle}`)
|
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', () => {
|
it('should copy id to clipboard, reset after 3 seconds', () => {
|
||||||
jest.useFakeTimers()
|
jest.useFakeTimers()
|
||||||
fixture.componentRef.setInput('id', 42)
|
fixture.componentRef.setInput('id', 42)
|
||||||
|
|||||||
@@ -27,7 +27,10 @@ export class PageHeaderComponent {
|
|||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
effect(() => {
|
effect(() => {
|
||||||
this.titleService.setTitle(`${this.title()} - ${environment.appTitle}`)
|
const title = this.title()
|
||||||
|
this.titleService.setTitle(
|
||||||
|
title ? `${title} - ${environment.appTitle}` : environment.appTitle
|
||||||
|
)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,25 +1,4 @@
|
|||||||
<pngx-page-header [title]="title()" [id]="documentId()">
|
<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>
|
<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>
|
<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>
|
</button>
|
||||||
@@ -34,7 +13,7 @@
|
|||||||
(versionsUpdated)="onVersionsUpdated($event)"
|
(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>
|
<button (click)="download()" class="btn btn-sm btn-outline-primary" [disabled]="downloading()" aria-label="Download" i18n-aria-label>
|
||||||
@if (downloading()) {
|
@if (downloading()) {
|
||||||
<div class="spinner-border spinner-border-sm" role="status"></div>
|
<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>
|
<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>
|
<i-bs name="send"></i-bs><div class="d-none d-sm-inline ms-1"><ng-container i18n>Send</ng-container></div>
|
||||||
</button>
|
</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 }">
|
<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>
|
<i-bs name="link" class="me-1"></i-bs><span i18n>Share Links</span>
|
||||||
</button>
|
</button>
|
||||||
@@ -113,8 +92,8 @@
|
|||||||
|
|
||||||
<form [formGroup]='documentForm' (ngSubmit)="save()">
|
<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-toolbar mb-1 pb-3 gap-2 row-gap-2 border-bottom">
|
||||||
<div class="btn-group me-auto">
|
<div class="btn-group">
|
||||||
<button type="button" class="btn btn-sm btn-outline-secondary" i18n-title title="Close" (click)="close()">
|
<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>
|
<i-bs width="1.2em" height="1.2em" name="x"></i-bs>
|
||||||
</button>
|
</button>
|
||||||
@@ -127,8 +106,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<ng-container *pngxIfPermissions="{ action: PermissionAction.Change, type: PermissionType.Document }">
|
<ng-container *pngxIfPermissions="{ action: PermissionAction.Change, type: PermissionType.Document }">
|
||||||
<div class="d-flex gap-2">
|
<div class="btn-group ms-3">
|
||||||
<div class="btn-group">
|
|
||||||
<pngx-suggestions-dropdown *pngxIfPermissions="{ action: PermissionAction.Change, type: PermissionType.Document }"
|
<pngx-suggestions-dropdown *pngxIfPermissions="{ action: PermissionAction.Change, type: PermissionType.Document }"
|
||||||
[disabled]="!userCanEdit || suggestionsLoading()"
|
[disabled]="!userCanEdit || suggestionsLoading()"
|
||||||
[loading]="suggestionsLoading()"
|
[loading]="suggestionsLoading()"
|
||||||
@@ -151,19 +129,7 @@
|
|||||||
</pngx-suggestions-dropdown>
|
</pngx-suggestions-dropdown>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="btn-group">
|
<div class="ms-auto">
|
||||||
<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>
|
|
||||||
|
|
||||||
<div class="ps-3">
|
|
||||||
<ng-container *ngTemplateOutlet="saveButtons"></ng-container>
|
<ng-container *ngTemplateOutlet="saveButtons"></ng-container>
|
||||||
</div>
|
</div>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
@@ -290,9 +256,21 @@
|
|||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="d-flex justify-content-end border-top pt-3">
|
<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>
|
<ng-container *ngTemplateOutlet="saveButtons"></ng-container>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
</ng-template>
|
</ng-template>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
@@ -328,9 +306,9 @@
|
|||||||
<td i18n>Original filename</td>
|
<td i18n>Original filename</td>
|
||||||
<td>{{metadata()?.original_filename}}</td>
|
<td>{{metadata()?.original_filename}}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr class="align-middle">
|
||||||
<td i18n>Original SHA256 checksum</td>
|
<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>
|
||||||
<tr>
|
<tr>
|
||||||
<td i18n>Original file size</td>
|
<td i18n>Original file size</td>
|
||||||
@@ -341,9 +319,9 @@
|
|||||||
<td>{{metadata()?.original_mime_type}}</td>
|
<td>{{metadata()?.original_mime_type}}</td>
|
||||||
</tr>
|
</tr>
|
||||||
@if (metadata()?.has_archive_version) {
|
@if (metadata()?.has_archive_version) {
|
||||||
<tr>
|
<tr class="align-middle">
|
||||||
<td i18n>Archive SHA256 checksum</td>
|
<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>
|
</tr>
|
||||||
}
|
}
|
||||||
@if (metadata()?.has_archive_version) {
|
@if (metadata()?.has_archive_version) {
|
||||||
@@ -408,7 +386,7 @@
|
|||||||
<a ngbNavLink i18n>Permissions</a>
|
<a ngbNavLink i18n>Permissions</a>
|
||||||
<ng-template ngbNavContent>
|
<ng-template ngbNavContent>
|
||||||
<div class="mb-3">
|
<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>
|
</div>
|
||||||
</ng-template>
|
</ng-template>
|
||||||
</li>
|
</li>
|
||||||
@@ -499,6 +477,29 @@
|
|||||||
(loadError)="onError($event)"
|
(loadError)="onError($event)"
|
||||||
(afterLoadComplete)="pdfPreviewLoaded($event)">
|
(afterLoadComplete)="pdfPreviewLoaded($event)">
|
||||||
</pngx-pdf-viewer>
|
</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>
|
</div>
|
||||||
} @else {
|
} @else {
|
||||||
<object [data]="previewUrl() | safeUrl" class="preview-sticky" width="100%"></object>
|
<object [data]="previewUrl() | safeUrl" class="preview-sticky" width="100%"></object>
|
||||||
|
|||||||
Reference in new issue
Block a user