diff --git a/app/imports/ui/dialogStack/DialogBase.vue b/app/imports/ui/dialogStack/DialogBase.vue
index 443e3e4f..7141422c 100644
--- a/app/imports/ui/dialogStack/DialogBase.vue
+++ b/app/imports/ui/dialogStack/DialogBase.vue
@@ -9,6 +9,11 @@
+ $emit('delete')" v-if="isEditing">
+
+ delete
+
+
{{isEditing ? 'check' : 'create'}}
diff --git a/app/imports/ui/dialogStack/DialogStack.vue b/app/imports/ui/dialogStack/DialogStack.vue
index 846ba3a5..9f0132bf 100644
--- a/app/imports/ui/dialogStack/DialogStack.vue
+++ b/app/imports/ui/dialogStack/DialogStack.vue
@@ -20,7 +20,6 @@
:key="dialog._id"
class="dialog"
:data-element-id="dialog.elementId"
- :data-return-element-id="dialog.returnElementId"
:data-index="index"
:ref="index"
:style="getDialogStyle(index)"
@@ -111,13 +110,18 @@
target.style.transition = originalStyle.transition;
target.style.boxShadow = originalStyle.boxShadow;
source.style.transition = originalStyle.sourceTransition;
- setTimeout(() => done, MOCK_DURATION);
+ setTimeout(done, MOCK_DURATION);
});
},
leave(target, done){
+ // Give minimongo time to update documents we might need to animate to
+ setTimeout(() => this.doLeave(target, done));
+ },
+ doLeave(target, done){
let elementId;
- if (target && target.attributes['data-return-element-id']) {
- elementId = target.attributes['data-return-element-id'].value;
+ let returnElementId = this.$store.state.dialogStack.currentReturnElement;
+ if (returnElementId) {
+ elementId = returnElementId;
} else {
if (!target || !target.attributes['data-element-id']){
done();
@@ -127,6 +131,7 @@
}
let source = this.getTopElementByDataId(elementId);
if (!source){
+ console.log(`Can't find source for ${elementId}`);
done();
return;
}
diff --git a/app/imports/ui/dialogStack/dialogStackStore.js b/app/imports/ui/dialogStack/dialogStackStore.js
index 2084efe0..da374742 100644
--- a/app/imports/ui/dialogStack/dialogStackStore.js
+++ b/app/imports/ui/dialogStack/dialogStackStore.js
@@ -5,9 +5,10 @@ const dialogStackStore = {
state: {
dialogs: [],
currentResult: null,
+ currentReturnElement: null,
},
mutations: {
- pushDialogStack(state, {component, data, elementId, returnElementId, callback}){
+ pushDialogStack(state, {component, data, elementId, callback}){
// Generate a new _id so that Vue knows how to shuffle the array
const _id = Random.id();
state.dialogs.push({
@@ -15,7 +16,6 @@ const dialogStackStore = {
component,
data,
elementId,
- returnElementId,
callback,
});
updateHistory();
@@ -25,20 +25,19 @@ const dialogStackStore = {
state.currentResult = null;
updateHistory();
if (!dialog) return;
- if (dialog.callback) dialog.callback(result);
+ if (dialog.callback){
+ let returnElementId = dialog.callback(result);
+ state.currentReturnElement = returnElementId;
+ } else {
+ state.currentReturnElement = null;
+ }
},
setCurrentResult (state, result){
state.currentResult = result;
},
- setTopReturnElementId (state, elementId){
- state.dialogs[state.dialogs.length - 1].returnElementId = elementId;
- },
},
actions: {
- popDialogStack(context, result, {returnElementId} = {}){
- if (returnElementId){
- context.commit("setTopReturnElementId", returnElementId);
- }
+ popDialogStack(context, result){
if (history && history.state && history.state.openDialogs){
context.commit("setCurrentResult", result);
history.back();