mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-04-09 09:58:20 -05:00
refactored metadata views
This commit is contained in:
parent
5bea5e75c0
commit
3089b049cf
@ -49,6 +49,7 @@ import { WelcomeWidgetComponent } from './components/dashboard/widgets/welcome-w
|
|||||||
import { YesNoPipe } from './pipes/yes-no.pipe';
|
import { YesNoPipe } from './pipes/yes-no.pipe';
|
||||||
import { FileSizePipe } from './pipes/file-size.pipe';
|
import { FileSizePipe } from './pipes/file-size.pipe';
|
||||||
import { DocumentTitlePipe } from './pipes/document-title.pipe';
|
import { DocumentTitlePipe } from './pipes/document-title.pipe';
|
||||||
|
import { MetadataCollapseComponent } from './components/document-detail/metadata-collapse/metadata-collapse.component';
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
declarations: [
|
declarations: [
|
||||||
@ -89,7 +90,8 @@ import { DocumentTitlePipe } from './pipes/document-title.pipe';
|
|||||||
WelcomeWidgetComponent,
|
WelcomeWidgetComponent,
|
||||||
YesNoPipe,
|
YesNoPipe,
|
||||||
FileSizePipe,
|
FileSizePipe,
|
||||||
DocumentTitlePipe
|
DocumentTitlePipe,
|
||||||
|
MetadataCollapseComponent
|
||||||
],
|
],
|
||||||
imports: [
|
imports: [
|
||||||
BrowserModule,
|
BrowserModule,
|
||||||
|
@ -110,53 +110,8 @@
|
|||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<h6 *ngIf="metadata?.original_metadata.length > 0">
|
<app-metadata-collapse title="Original document metadata" [metadata]="metadata.original_metadata" *ngIf="metadata?.original_metadata.length > 0"></app-metadata-collapse>
|
||||||
<button type="button" class="btn btn-outline-secondary btn-sm mr-2"
|
<app-metadata-collapse title="Archived document metadata" [metadata]="metadata.archive_metadata" *ngIf="metadata?.archive_metadata.length > 0"></app-metadata-collapse>
|
||||||
(click)="expandOriginalMetadata = !expandOriginalMetadata" aria-controls="collapseExample">
|
|
||||||
<svg class="buttonicon" fill="currentColor" *ngIf="!expandOriginalMetadata">
|
|
||||||
<use xlink:href="assets/bootstrap-icons.svg#caret-down" />
|
|
||||||
</svg>
|
|
||||||
<svg class="buttonicon" fill="currentColor" *ngIf="expandOriginalMetadata">
|
|
||||||
<use xlink:href="assets/bootstrap-icons.svg#caret-up" />
|
|
||||||
</svg>
|
|
||||||
</button>
|
|
||||||
Original document metadata
|
|
||||||
</h6>
|
|
||||||
|
|
||||||
<div #collapse="ngbCollapse" [(ngbCollapse)]="!expandOriginalMetadata">
|
|
||||||
<table class="table table-borderless">
|
|
||||||
<tbody>
|
|
||||||
<tr *ngFor="let m of metadata?.original_metadata">
|
|
||||||
<td>{{m.prefix}}:{{m.key}}</td>
|
|
||||||
<td>{{m.value}}</td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<h6 *ngIf="metadata?.has_archive_version && metadata?.archive_metadata.length > 0">
|
|
||||||
<button type="button" class="btn btn-outline-secondary btn-sm mr-2"
|
|
||||||
(click)="expandArchivedMetadata = !expandArchivedMetadata" aria-controls="collapseExample">
|
|
||||||
<svg class="buttonicon" fill="currentColor" *ngIf="!expandArchivedMetadata">
|
|
||||||
<use xlink:href="assets/bootstrap-icons.svg#caret-down" />
|
|
||||||
</svg>
|
|
||||||
<svg class="buttonicon" fill="currentColor" *ngIf="expandArchivedMetadata">
|
|
||||||
<use xlink:href="assets/bootstrap-icons.svg#caret-up" />
|
|
||||||
</svg>
|
|
||||||
</button>
|
|
||||||
Archived document metadata
|
|
||||||
</h6>
|
|
||||||
|
|
||||||
<div #collapse="ngbCollapse" [(ngbCollapse)]="!expandArchivedMetadata">
|
|
||||||
<table class="table table-borderless">
|
|
||||||
<tbody>
|
|
||||||
<tr *ngFor="let m of metadata?.archive_metadata">
|
|
||||||
<td>{{m.prefix}}:{{m.key}}</td>
|
|
||||||
<td>{{m.value}}</td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</ng-template>
|
</ng-template>
|
||||||
</li>
|
</li>
|
||||||
|
@ -0,0 +1,23 @@
|
|||||||
|
<h6>
|
||||||
|
<button type="button" class="btn btn-outline-secondary btn-sm mr-2"
|
||||||
|
(click)="expand = !expand">
|
||||||
|
<svg class="buttonicon" fill="currentColor" *ngIf="!expand">
|
||||||
|
<use xlink:href="assets/bootstrap-icons.svg#caret-down" />
|
||||||
|
</svg>
|
||||||
|
<svg class="buttonicon" fill="currentColor" *ngIf="expand">
|
||||||
|
<use xlink:href="assets/bootstrap-icons.svg#caret-up" />
|
||||||
|
</svg>
|
||||||
|
</button>
|
||||||
|
{{title}}
|
||||||
|
</h6>
|
||||||
|
|
||||||
|
<div #collapse="ngbCollapse" [(ngbCollapse)]="!expand">
|
||||||
|
<table class="table table-borderless">
|
||||||
|
<tbody>
|
||||||
|
<tr *ngFor="let m of metadata">
|
||||||
|
<td>{{m.prefix}}:{{m.key}}</td>
|
||||||
|
<td>{{m.value}}</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
@ -0,0 +1,25 @@
|
|||||||
|
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
|
import { MetadataCollapseComponent } from './metadata-collapse.component';
|
||||||
|
|
||||||
|
describe('MetadataCollapseComponent', () => {
|
||||||
|
let component: MetadataCollapseComponent;
|
||||||
|
let fixture: ComponentFixture<MetadataCollapseComponent>;
|
||||||
|
|
||||||
|
beforeEach(async () => {
|
||||||
|
await TestBed.configureTestingModule({
|
||||||
|
declarations: [ MetadataCollapseComponent ]
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
|
});
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
fixture = TestBed.createComponent(MetadataCollapseComponent);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create', () => {
|
||||||
|
expect(component).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
@ -0,0 +1,23 @@
|
|||||||
|
import { Component, Input, OnInit } from '@angular/core';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-metadata-collapse',
|
||||||
|
templateUrl: './metadata-collapse.component.html',
|
||||||
|
styleUrls: ['./metadata-collapse.component.scss']
|
||||||
|
})
|
||||||
|
export class MetadataCollapseComponent implements OnInit {
|
||||||
|
|
||||||
|
constructor() { }
|
||||||
|
|
||||||
|
expand = false
|
||||||
|
|
||||||
|
@Input()
|
||||||
|
metadata
|
||||||
|
|
||||||
|
@Input()
|
||||||
|
title = "Metadata"
|
||||||
|
|
||||||
|
ngOnInit(): void {
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user