aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/collections/CollectionBaseView.tsx
diff options
context:
space:
mode:
authorTyler Schicke <tyler_schicke@brown.edu>2019-04-08 22:45:22 -0400
committerTyler Schicke <tyler_schicke@brown.edu>2019-04-08 22:45:22 -0400
commit5e086920bf97297a02bcd38faea56454c2220279 (patch)
tree9b7fa3ec3df3a522b5676dc743afc17ef2b5cf09 /src/client/views/collections/CollectionBaseView.tsx
parentcecbafdd8e42b1fa021a54fe624c3cf68e8645bd (diff)
Enabled semi-colon and braces linter rule
Diffstat (limited to 'src/client/views/collections/CollectionBaseView.tsx')
-rw-r--r--src/client/views/collections/CollectionBaseView.tsx34
1 files changed, 20 insertions, 14 deletions
diff --git a/src/client/views/collections/CollectionBaseView.tsx b/src/client/views/collections/CollectionBaseView.tsx
index 7a5ab6e3c..32462a4c1 100644
--- a/src/client/views/collections/CollectionBaseView.tsx
+++ b/src/client/views/collections/CollectionBaseView.tsx
@@ -66,17 +66,20 @@ export class CollectionBaseView extends React.Component<CollectionViewProps> {
createsCycle(documentToAdd: Document, containerDocument: Document): boolean {
let data = documentToAdd.GetList<Document>(KeyStore.Data, []);
for (const doc of data) {
- if (this.createsCycle(doc, containerDocument))
+ if (this.createsCycle(doc, containerDocument)) {
return true;
+ }
}
let annots = documentToAdd.GetList<Document>(KeyStore.Annotations, []);
for (const annot of annots) {
- if (this.createsCycle(annot, containerDocument))
+ if (this.createsCycle(annot, containerDocument)) {
return true;
+ }
}
for (let containerProto: FieldValue<Document> = containerDocument; containerProto && containerProto !== FieldWaiting; containerProto = containerProto.GetPrototype()) {
- if (containerProto.Id === documentToAdd.Id)
+ if (containerProto.Id === documentToAdd.Id) {
return true;
+ }
}
return false;
}
@@ -91,20 +94,23 @@ export class CollectionBaseView extends React.Component<CollectionViewProps> {
}
if (props.Document.Get(props.fieldKey) instanceof Field) {
//TODO This won't create the field if it doesn't already exist
- const value = props.Document.GetData(props.fieldKey, ListField, new Array<Document>())
+ const value = props.Document.GetData(props.fieldKey, ListField, new Array<Document>());
if (!this.createsCycle(doc, props.Document)) {
- if (!value.some(v => v.Id === doc.Id) || allowDuplicates)
+ if (!value.some(v => v.Id === doc.Id) || allowDuplicates) {
value.push(doc);
+ }
}
- else
+ else {
return false;
+ }
} else {
let proto = props.Document.GetPrototype();
if (!proto || proto === FieldWaiting || !this.createsCycle(proto, doc)) {
props.Document.SetOnPrototype(props.fieldKey, new ListField([doc]));
}
- else
+ else {
return false;
+ }
}
return true;
}
@@ -113,7 +119,7 @@ export class CollectionBaseView extends React.Component<CollectionViewProps> {
removeDocument(doc: Document): boolean {
const props = this.props;
//TODO This won't create the field if it doesn't already exist
- const value = props.Document.GetData(props.fieldKey, ListField, new Array<Document>())
+ const value = props.Document.GetData(props.fieldKey, ListField, new Array<Document>());
let index = -1;
for (let i = 0; i < value.length; i++) {
if (value[i].Id === doc.Id) {
@@ -125,16 +131,16 @@ export class CollectionBaseView extends React.Component<CollectionViewProps> {
if (annotationOn === props.Document) {
doc.Set(KeyStore.AnnotationOn, undefined, true);
}
- })
+ });
if (index !== -1) {
- value.splice(index, 1)
+ value.splice(index, 1);
// SelectionManager.DeselectAll()
- ContextMenu.Instance.clearItems()
+ ContextMenu.Instance.clearItems();
return true;
}
- return false
+ return false;
}
@action.bound
@@ -155,12 +161,12 @@ export class CollectionBaseView extends React.Component<CollectionViewProps> {
moveDocument: this.moveDocument,
active: this.active,
onActiveChanged: this.onActiveChanged,
- }
+ };
return (
<div className={this.props.className || "collectionView-cont"} onContextMenu={this.props.onContextMenu} ref={this.props.contentRef}>
{this.props.children(this.collectionViewType, props)}
</div>
- )
+ );
}
} \ No newline at end of file