diff options
author | tschicke-brown <tyler_schicke@brown.edu> | 2019-06-26 22:39:33 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-06-26 22:39:33 -0400 |
commit | 79345d459a10de1a610bbeb62b503f05b42c1482 (patch) | |
tree | d5fb2629fd57b16bcf1649cb5ce0093065e80bfd /src/client/util/DocumentManager.ts | |
parent | 68a71ec1af52e1e23374c2062c9f809e5fc905d6 (diff) | |
parent | 212c8be0d974a76246193303408d647896ec232c (diff) |
Merge pull request #169 from browngraphicslab/searchUI
Basic searching
Diffstat (limited to 'src/client/util/DocumentManager.ts')
-rw-r--r-- | src/client/util/DocumentManager.ts | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/client/util/DocumentManager.ts b/src/client/util/DocumentManager.ts index 16b88b027..bc9724b98 100644 --- a/src/client/util/DocumentManager.ts +++ b/src/client/util/DocumentManager.ts @@ -30,6 +30,30 @@ export class DocumentManager { // this.DocumentViews = new Array<DocumentView>(); } + //gets all views + public getDocumentViewsById(id: string) { + let toReturn: DocumentView[] = []; + DocumentManager.Instance.DocumentViews.map(view => { + if (view.props.Document[Id] === id) { + toReturn.push(view); + } + }); + if (toReturn.length === 0) { + DocumentManager.Instance.DocumentViews.map(view => { + let doc = view.props.Document.proto; + if (doc && doc[Id]) { + if(doc[Id] === id) + {toReturn.push(view);} + } + }); + } + return toReturn; + } + + public getAllDocumentViews(doc: Doc){ + return this.getDocumentViewsById(doc[Id]); + } + public getDocumentViewById(id: string, preferredCollection?: CollectionView | CollectionPDFView | CollectionVideoView): DocumentView | null { let toReturn: DocumentView | null = null; |