mirror of https://github.com/Requarks/wiki.git
10 changed files with 141 additions and 89 deletions
Unified View
Diff Options
-
4client/js/app.js
-
102client/js/components/editor.component.js
-
43client/js/components/modal-discard-page.vue
-
2client/js/components/tree.vue
-
4client/js/store/index.js
-
9client/js/store/modules/editor.js
-
16client/js/store/modules/modal-discard-page.js
-
24server/views/pages/create.pug
-
24server/views/pages/edit.pug
-
2server/views/pages/source.pug
@ -0,0 +1,43 @@ |
|||||
|
<template lang="pug"> |
||||
|
transition(:duration="400") |
||||
|
.modal(v-show='isShown', v-cloak) |
||||
|
transition(name='modal-background') |
||||
|
.modal-background(v-show='isShown') |
||||
|
.modal-container |
||||
|
transition(name='modal-content') |
||||
|
.modal-content(v-show='isShown') |
||||
|
header.is-orange Discard? |
||||
|
section |
||||
|
span(v-if='mode === "create"') Are you sure you want to leave this page and loose anything you wrote so far? |
||||
|
span(v-else) Are you sure you want to leave this page and loose any modifications? |
||||
|
footer |
||||
|
a.button.is-grey.is-outlined(v-on:click='stay') Stay on page |
||||
|
a.button.is-orange(v-on:click='discard') Discard |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
export default { |
||||
|
name: 'modal-discard-page', |
||||
|
props: ['mode', 'currentPath'], |
||||
|
data () { |
||||
|
return {} |
||||
|
}, |
||||
|
computed: { |
||||
|
isShown () { |
||||
|
return this.$store.state.modalDiscardPage.shown |
||||
|
} |
||||
|
}, |
||||
|
methods: { |
||||
|
stay: function () { |
||||
|
this.$store.dispatch('modalDiscardPage/close') |
||||
|
}, |
||||
|
discard: function () { |
||||
|
if(this.mode === 'create') { |
||||
|
window.location.assign('/') |
||||
|
} else { |
||||
|
window.location.assign('/' + this.currentPath) |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
</script> |
@ -0,0 +1,9 @@ |
|||||
|
'use strict' |
||||
|
|
||||
|
export default { |
||||
|
namespaced: true, |
||||
|
state: {}, |
||||
|
getters: {}, |
||||
|
mutations: {}, |
||||
|
actions: {} |
||||
|
} |
@ -0,0 +1,16 @@ |
|||||
|
'use strict' |
||||
|
|
||||
|
export default { |
||||
|
namespaced: true, |
||||
|
state: { |
||||
|
shown: false |
||||
|
}, |
||||
|
getters: {}, |
||||
|
mutations: { |
||||
|
shownChange: (state, shownState) => { state.shown = shownState } |
||||
|
}, |
||||
|
actions: { |
||||
|
open({ commit }) { commit('shownChange', true) }, |
||||
|
close({ commit }) { commit('shownChange', false) } |
||||
|
} |
||||
|
} |
Write
Preview
Loading…
Cancel
Save