Skip to content

Commit

Permalink
BO: Display modal when leaving the translations page
Browse files Browse the repository at this point in the history
  • Loading branch information
maximebiloe committed Jul 12, 2017
1 parent d008d41 commit ed24a7f
Showing 1 changed file with 11 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
<Principal :modal="this.$refs.transModal" ref="principal" />
</div>
</div>
<PSModal @save="onSave" @leave="onLeave" :translations="translations"/>
<PSModal ref="transModal" :translations="translations"/>
</div>
</template>

Expand All @@ -50,7 +50,7 @@
import Principal from './principal';
import PSModal from 'app/widgets/ps-modal';
import { EventBus } from 'app/utils/event-bus';


export default {
name: 'app',
Expand Down Expand Up @@ -90,7 +90,14 @@
setTimeout(() => {
window.stop();
}, 500);
EventBus.$emit('showModal');
this.$refs.transModal.showModal();
this.$refs.transModal.$once('save', () => {
this.$refs.principal.saveTranslations();
this.leavePage();
});
this.$refs.transModal.$once('leave', () => {
this.leavePage();
});
return null;
}
};
Expand All @@ -102,11 +109,7 @@
});
this.$store.currentDomain = '';
},
onSave() {
this.$refs.principal.saveTranslations();
EventBus.$emit('hideModal');
},
onLeave() {
leavePage() {
this.leave = true;
window.location.href = this.destHref;
},
Expand Down

0 comments on commit ed24a7f

Please sign in to comment.