You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

43 lines
1.3 KiB

  1. <template lang="pug">
  2. transition(:duration="400")
  3. .modal(v-show='isShown', v-cloak)
  4. transition(name='modal-background')
  5. .modal-background(v-show='isShown')
  6. .modal-container
  7. transition(name='modal-content')
  8. .modal-content(v-show='isShown')
  9. header.is-orange Discard?
  10. section
  11. span(v-if='mode === "create"') Are you sure you want to leave this page and loose anything you wrote so far?
  12. span(v-else) Are you sure you want to leave this page and loose any modifications?
  13. footer
  14. a.button.is-grey.is-outlined(v-on:click='stay') Stay on page
  15. a.button.is-orange(v-on:click='discard') Discard
  16. </template>
  17. <script>
  18. export default {
  19. name: 'modal-discard-page',
  20. props: ['mode', 'currentPath'],
  21. data () {
  22. return {}
  23. },
  24. computed: {
  25. isShown () {
  26. return this.$store.state.modalDiscardPage.shown
  27. }
  28. },
  29. methods: {
  30. stay: function () {
  31. this.$store.dispatch('modalDiscardPage/close')
  32. },
  33. discard: function () {
  34. if(this.mode === 'create') {
  35. window.location.assign('/')
  36. } else {
  37. window.location.assign('/' + this.currentPath)
  38. }
  39. }
  40. }
  41. }
  42. </script>