aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/collections/CollectionBaseView.tsx
diff options
context:
space:
mode:
authorBob Zeleznik <zzzman@gmail.com>2019-09-15 01:14:21 -0400
committerBob Zeleznik <zzzman@gmail.com>2019-09-15 01:14:21 -0400
commit827cee4d7ac4f1e761b141097d20671e7873bea8 (patch)
tree69e2bc77d25d12e081cf529585d11cdf641f46f0 /src/client/views/collections/CollectionBaseView.tsx
parentde6332ecbc01de40f46e820f7a0301822ec3e784 (diff)
changed moveDocument to move the draggedDoc -- its up to the caller to add the droppedDoc if it wants to. cleaned up some old code related to passing dataDoc along with doc's to drag and other functinos
Diffstat (limited to 'src/client/views/collections/CollectionBaseView.tsx')
-rw-r--r--src/client/views/collections/CollectionBaseView.tsx13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/client/views/collections/CollectionBaseView.tsx b/src/client/views/collections/CollectionBaseView.tsx
index b7036b3ff..a54718e9e 100644
--- a/src/client/views/collections/CollectionBaseView.tsx
+++ b/src/client/views/collections/CollectionBaseView.tsx
@@ -141,17 +141,16 @@ export class CollectionBaseView extends React.Component<CollectionViewProps> {
return false;
}
+ // this is called with the document that was dragged and the collection to move it into.
+ // if the target collection is the same as this collection, then the move will be allowed.
+ // otherwise, the document being moved must be able to be removed from its container before
+ // moving it into the target.
@action.bound
moveDocument(doc: Doc, targetCollection: Doc, addDocument: (doc: Doc) => boolean): boolean {
- let self = this;
- let targetDataDoc = this.props.Document;
- if (Doc.AreProtosEqual(targetDataDoc, targetCollection)) {
+ if (Doc.AreProtosEqual(this.props.Document, targetCollection)) {
return true;
}
- if (this.removeDocument(doc)) {
- return addDocument(doc);
- }
- return false;
+ return this.removeDocument(doc) ? addDocument(doc) : false;
}
render() {