aboutsummaryrefslogtreecommitdiff
path: root/src/client/util/DocumentManager.ts
diff options
context:
space:
mode:
authormadelinegr <monika_hedman@brown.edu>2019-06-12 22:45:20 -0400
committermadelinegr <monika_hedman@brown.edu>2019-06-12 22:45:20 -0400
commit09e40959ec0d47ae3bff2e9f1797ea2b0cbc1034 (patch)
tree0bf827c0393086ac62f57b69827c3a26bb477650 /src/client/util/DocumentManager.ts
parent95dbea8f51b0f5835d6caf9adf2cecdfb51d35f7 (diff)
end of day 6/12
Diffstat (limited to 'src/client/util/DocumentManager.ts')
-rw-r--r--src/client/util/DocumentManager.ts26
1 files changed, 25 insertions, 1 deletions
diff --git a/src/client/util/DocumentManager.ts b/src/client/util/DocumentManager.ts
index 76ca4b99b..40928ecae 100644
--- a/src/client/util/DocumentManager.ts
+++ b/src/client/util/DocumentManager.ts
@@ -30,12 +30,36 @@ 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;
let passes = preferredCollection ? [preferredCollection, undefined] : [undefined];
- for(let i = 0; i < passes.length; i++) {
+ for (let i = 0; i < passes.length; i++) {
DocumentManager.Instance.DocumentViews.map(view => {
if (view.props.Document[Id] === id && (!passes[i] || view.props.ContainingCollectionView === preferredCollection)) {
toReturn = view;