let OpenDocumentsService handle nav

This commit is contained in:
Michael Shamoon
2022-05-15 23:25:46 -07:00
parent d0f70c8f18
commit c1fb277f25
10 changed files with 38 additions and 65 deletions

View File

@@ -37,7 +37,7 @@
<use xlink:href="assets/bootstrap-icons.svg#diagram-3"/>
</svg>&nbsp;<span class="d-none d-md-inline" i18n>More like this</span>
</a>
<a (click)="clickEdit()" class="btn btn-sm btn-outline-secondary">
<a (click)="openDocumentsService.openDocument(document)" class="btn btn-sm btn-outline-secondary">
<svg class="sidebaricon" fill="currentColor" class="sidebaricon">
<use xlink:href="assets/bootstrap-icons.svg#pencil"/>
</svg>&nbsp;<span class="d-none d-md-inline" i18n>Edit</span>

View File

@@ -14,8 +14,6 @@ import {
} from 'src/app/services/settings.service'
import { NgbPopover } from '@ng-bootstrap/ng-bootstrap'
import { OpenDocumentsService } from 'src/app/services/open-documents.service'
import { Router } from '@angular/router'
import { first } from 'rxjs'
@Component({
selector: 'app-document-card-large',
@@ -29,8 +27,7 @@ export class DocumentCardLargeComponent implements OnInit {
constructor(
private documentService: DocumentService,
private settingsService: SettingsService,
private openDocumentsService: OpenDocumentsService,
private router: Router
public openDocumentsService: OpenDocumentsService
) {}
@Input()
@@ -121,13 +118,4 @@ export class DocumentCardLargeComponent implements OnInit {
get contentTrimmed() {
return this.document.content.substr(0, 500)
}
clickEdit() {
this.openDocumentsService
.openDocument(this.document)
.pipe(first())
.subscribe((open) => {
if (open) this.router.navigate(['documents', this.document.id])
})
}
}