mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-08-12 00:19:48 +00:00
Feature: Enhanced templating for filename format (#7836)
Co-authored-by: shamoon <4887959+shamoon@users.noreply.github.com>
This commit is contained in:
@@ -38,7 +38,7 @@
|
||||
<th scope="col" class="fw-normal d-none d-sm-table-cell" pngxSortable="matching_algorithm" [currentSortField]="sortField" [currentSortReverse]="sortReverse" (sort)="onSort($event)" i18n>Matching</th>
|
||||
<th scope="col" class="fw-normal" pngxSortable="document_count" [currentSortField]="sortField" [currentSortReverse]="sortReverse" (sort)="onSort($event)" i18n>Document count</th>
|
||||
@for (column of extraColumns; track column) {
|
||||
<th scope="col" class="fw-normal" pngxSortable="{{column.key}}" [currentSortField]="sortField" [currentSortReverse]="sortReverse" (sort)="onSort($event)">{{column.name}}</th>
|
||||
<th scope="col" class="fw-normal" [ngClass]="{ 'd-none d-sm-table-cell' : column.hideOnMobile }" pngxSortable="{{column.key}}" [currentSortField]="sortField" [currentSortReverse]="sortReverse" (sort)="onSort($event)">{{column.name}}</th>
|
||||
}
|
||||
<th scope="col" class="fw-normal" i18n>Actions</th>
|
||||
</tr>
|
||||
@@ -64,7 +64,7 @@
|
||||
<td scope="row" class="d-none d-sm-table-cell">{{ getMatching(object) }}</td>
|
||||
<td scope="row">{{ object.document_count }}</td>
|
||||
@for (column of extraColumns; track column) {
|
||||
<td scope="row">
|
||||
<td scope="row" [ngClass]="{ 'd-none d-sm-table-cell' : column.hideOnMobile }">
|
||||
@if (column.rendersHtml) {
|
||||
<div [innerHtml]="column.valueFn.call(null, object) | safeHtml"></div>
|
||||
} @else {
|
||||
|
@@ -44,6 +44,8 @@ export interface ManagementListColumn {
|
||||
valueFn: any
|
||||
|
||||
rendersHtml?: boolean
|
||||
|
||||
hideOnMobile?: boolean
|
||||
}
|
||||
|
||||
@Directive()
|
||||
|
@@ -11,6 +11,8 @@ import { PageHeaderComponent } from '../../common/page-header/page-header.compon
|
||||
import { StoragePathListComponent } from './storage-path-list.component'
|
||||
import { NgxBootstrapIconsModule, allIcons } from 'ngx-bootstrap-icons'
|
||||
import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http'
|
||||
import { SafeHtmlPipe } from 'src/app/pipes/safehtml.pipe'
|
||||
import { StoragePath } from 'src/app/data/storage-path'
|
||||
|
||||
describe('StoragePathListComponent', () => {
|
||||
let component: StoragePathListComponent
|
||||
@@ -24,6 +26,7 @@ describe('StoragePathListComponent', () => {
|
||||
SortableDirective,
|
||||
PageHeaderComponent,
|
||||
IfPermissionsDirective,
|
||||
SafeHtmlPipe,
|
||||
],
|
||||
imports: [
|
||||
NgbPaginationModule,
|
||||
@@ -71,4 +74,15 @@ describe('StoragePathListComponent', () => {
|
||||
'Do you really want to delete the storage path "StoragePath1"?'
|
||||
)
|
||||
})
|
||||
|
||||
it('should truncate path if necessary', () => {
|
||||
const path: StoragePath = {
|
||||
id: 1,
|
||||
name: 'StoragePath1',
|
||||
path: 'a'.repeat(100),
|
||||
}
|
||||
expect(component.extraColumns[0].valueFn(path)).toEqual(
|
||||
`<code>${'a'.repeat(49)}...</code>`
|
||||
)
|
||||
})
|
||||
})
|
||||
|
@@ -40,8 +40,10 @@ export class StoragePathListComponent extends ManagementListComponent<StoragePat
|
||||
{
|
||||
key: 'path',
|
||||
name: $localize`Path`,
|
||||
rendersHtml: true,
|
||||
hideOnMobile: true,
|
||||
valueFn: (c: StoragePath) => {
|
||||
return c.path
|
||||
return `<code>${c.path?.slice(0, 49)}${c.path?.length > 50 ? '...' : ''}</code>`
|
||||
},
|
||||
},
|
||||
]
|
||||
|
Reference in New Issue
Block a user