Skip to content
This repository has been archived by the owner on Feb 16, 2023. It is now read-only.

Commit

Permalink
Select first tab when switching out of mobile display
Browse files Browse the repository at this point in the history
  • Loading branch information
shamoon committed Dec 17, 2020
1 parent 08495de commit 88b39fa
Showing 1 changed file with 24 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Component, OnInit } from '@angular/core';
import { Component, OnInit, ViewChild, ElementRef } from '@angular/core';
import { FormControl, FormGroup } from '@angular/forms';
import { Title } from '@angular/platform-browser';
import { ActivatedRoute, Router } from '@angular/router';
import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
import { NgbModal, NgbNav } from '@ng-bootstrap/ng-bootstrap';
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';
Expand Down Expand Up @@ -48,8 +48,17 @@ export class DocumentDetailComponent implements OnInit {
tags: new FormControl([])
})

@ViewChild('nav') nav: NgbNav
@ViewChild('pdfPreview') set pdfPreview(element): void {
// this gets called when compontent added or removed from DOM
if (element && element.nativeElement.offsetParent !== null) { // its visible

setTimeout(()=> this.nav?.select(1));
}
}

constructor(
private documentsService: DocumentService,
private documentsService: DocumentService,
private route: ActivatedRoute,
private correspondentService: CorrespondentService,
private documentTypeService: DocumentTypeService,
Expand Down Expand Up @@ -128,7 +137,7 @@ export class DocumentDetailComponent implements OnInit {
}, error => {this.router.navigate(['404'])})
}

save() {
save() {
this.documentsService.update(this.document).subscribe(result => {
this.close()
})
Expand Down Expand Up @@ -160,7 +169,7 @@ export class DocumentDetailComponent implements OnInit {
modal.componentInstance.message2 = `The files for this document will be deleted permanently. This operation cannot be undone.`
modal.componentInstance.deleteClicked.subscribe(() => {
this.documentsService.delete(this.document).subscribe(() => {
modal.close()
modal.close()
this.close()
})
})
Expand All @@ -170,4 +179,14 @@ export class DocumentDetailComponent implements OnInit {
hasNext() {
return this.documentListViewService.hasNext(this.documentId)
}

previewCreated() {
console.log('Preview Created');

}

mobilePreviewCreated() {
console.log('Mobile Preview Created');

}
}

0 comments on commit 88b39fa

Please sign in to comment.