more fixes regarding empty titles

This commit is contained in:
jonaswinkler 2020-12-16 16:44:54 +01:00
parent dec17a3b9b
commit 8e339789fa
5 changed files with 9 additions and 6 deletions
src-ui/src/app

@ -119,7 +119,8 @@ import { MetadataCollapseComponent } from './components/document-detail/metadata
useClass: CsrfInterceptor,
multi: true
},
FilterPipe
FilterPipe,
DocumentTitlePipe
],
bootstrap: [AppComponent]
})

@ -65,7 +65,7 @@
<svg class="sidebaricon" fill="currentColor">
<use xlink:href="assets/bootstrap-icons.svg#file-text"/>
</svg>
{{d.title}}
{{d.title | documentTitle}}
</a>
</li>
<li class="nav-item w-100" *ngIf="openDocuments.length > 1">

@ -13,7 +13,7 @@
<tbody>
<tr *ngFor="let doc of documents" routerLink="/documents/{{doc.id}}">
<td>{{doc.created | date}}</td>
<td>{{doc.title}}<app-tag [tag]="t" *ngFor="let t of doc.tags$ | async" class="ml-1"></app-tag>
<td>{{doc.title | documentTitle}}<app-tag [tag]="t" *ngFor="let t of doc.tags$ | async" class="ml-1"></app-tag>
</tr>
</tbody>
</table>

@ -6,6 +6,7 @@ import { PaperlessCorrespondent } from 'src/app/data/paperless-correspondent';
import { PaperlessDocument } from 'src/app/data/paperless-document';
import { PaperlessDocumentMetadata } from 'src/app/data/paperless-document-metadata';
import { PaperlessDocumentType } from 'src/app/data/paperless-document-type';
import { DocumentTitlePipe } from 'src/app/pipes/document-title.pipe';
import { DocumentListViewService } from 'src/app/services/document-list-view.service';
import { OpenDocumentsService } from 'src/app/services/open-documents.service';
import { CorrespondentService } from 'src/app/services/rest/correspondent.service';
@ -54,7 +55,8 @@ export class DocumentDetailComponent implements OnInit {
private router: Router,
private modalService: NgbModal,
private openDocumentService: OpenDocumentsService,
private documentListViewService: DocumentListViewService) { }
private documentListViewService: DocumentListViewService,
private documentTitlePipe: DocumentTitlePipe) { }
getContentType() {
return this.metadata?.has_archive_version ? 'application/pdf' : this.metadata?.original_mime_type
@ -90,7 +92,7 @@ export class DocumentDetailComponent implements OnInit {
this.documentsService.getMetadata(doc.id).subscribe(result => {
this.metadata = result
})
this.title = doc.title
this.title = this.documentTitlePipe.transform(doc.title)
this.documentForm.patchValue(doc)
}

@ -5,7 +5,7 @@ import { Pipe, PipeTransform } from '@angular/core';
})
export class DocumentTitlePipe implements PipeTransform {
transform(value: string): unknown {
transform(value: string): string {
if (value) {
return value
} else {