mirror of https://github.com/requarks/wiki
parent
fa098f8ece
commit
8239adfe7b
@ -0,0 +1,65 @@
|
||||
<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-red
|
||||
span {{ $t('modal.deleteusertitle') }}
|
||||
p.modal-notify(v-bind:class='{ "is-active": isLoading }'): i
|
||||
section
|
||||
span {{ $t('modal.deleteuserwarning') }}
|
||||
footer
|
||||
a.button.is-grey.is-outlined(v-on:click='cancel') {{ $t('modal.abort') }}
|
||||
a.button.is-red(v-on:click='deleteUser') {{ $t('modal.delete') }}
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'modal-delete-user',
|
||||
props: ['currentUser'],
|
||||
data () {
|
||||
return {
|
||||
isLoading: false
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
isShown () {
|
||||
return this.$store.state.modalDeleteUser.shown
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
cancel: function () {
|
||||
this.isLoading = false
|
||||
this.$store.dispatch('modalDeleteUser/close')
|
||||
},
|
||||
discard: function () {
|
||||
let self = this
|
||||
this.isLoading = true
|
||||
this.$http.delete('/admin/users/' + this.currentUser).then(resp => {
|
||||
return resp.json()
|
||||
}).then(resp => {
|
||||
if (resp.ok) {
|
||||
window.location.assign('/admin/users')
|
||||
} else {
|
||||
self.isLoading = false
|
||||
self.$store.dispatch('alert', {
|
||||
style: 'red',
|
||||
icon: 'square-cross',
|
||||
msg: resp.msg
|
||||
})
|
||||
}
|
||||
}).catch(err => {
|
||||
self.isLoading = false
|
||||
self.$store.dispatch('alert', {
|
||||
style: 'red',
|
||||
icon: 'square-cross',
|
||||
msg: 'Error: ' + err.body.msg
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
@ -1,43 +0,0 @@
|
||||
'use strict'
|
||||
|
||||
/* global usrData */
|
||||
|
||||
'use strict'
|
||||
|
||||
import $ from 'jquery'
|
||||
import Vue from 'vue'
|
||||
|
||||
// Vue Delete User instance
|
||||
|
||||
module.exports = (alerts) => {
|
||||
let vueDeleteUser = new Vue({
|
||||
el: '#modal-admin-users-delete',
|
||||
data: {
|
||||
loading: false
|
||||
},
|
||||
methods: {
|
||||
open: (ev) => {
|
||||
$('#modal-admin-users-delete').addClass('is-active')
|
||||
},
|
||||
cancel: (ev) => {
|
||||
$('#modal-admin-users-delete').removeClass('is-active')
|
||||
},
|
||||
deleteUser: (ev) => {
|
||||
vueDeleteUser.loading = true
|
||||
$.ajax('/admin/users/' + usrData._id, {
|
||||
dataType: 'json',
|
||||
method: 'DELETE'
|
||||
}).then((rData, rStatus, rXHR) => {
|
||||
vueDeleteUser.loading = false
|
||||
vueDeleteUser.cancel()
|
||||
window.location.assign('/admin/users')
|
||||
}, (rXHR, rStatus, err) => {
|
||||
vueDeleteUser.loading = false
|
||||
alerts.pushError('Error', rXHR.responseJSON.msg)
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
$('.btn-deluser-prompt').on('click', vueDeleteUser.open)
|
||||
}
|
@ -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) }
|
||||
}
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
.modal#modal-admin-users-delete
|
||||
.modal-background
|
||||
.modal-container
|
||||
.modal-content
|
||||
header.is-red
|
||||
span Delete User Account?
|
||||
p.modal-notify(v-bind:class='{ "is-active": loading }'): i
|
||||
section
|
||||
span Are you sure you want to delete this user account? This action cannot be undone!
|
||||
footer
|
||||
a.button.is-grey.is-outlined(v-on:click='cancel') Abort
|
||||
a.button.is-red(v-on:click='deleteUser') Delete
|
@ -1,10 +0,0 @@
|
||||
.modal#modal-create-discard
|
||||
.modal-background
|
||||
.modal-container
|
||||
.modal-content
|
||||
header.is-orange Discard?
|
||||
section
|
||||
span Are you sure you want to leave this page and loose anything you wrote so far?
|
||||
footer
|
||||
a.button.is-grey.is-outlined.btn-create-discard Stay on page
|
||||
a.button.is-orange(href='/') Discard
|
@ -1,11 +0,0 @@
|
||||
|
||||
.modal#modal-edit-discard
|
||||
.modal-background
|
||||
.modal-container
|
||||
.modal-content
|
||||
header.is-orange Discard?
|
||||
section
|
||||
span Are you sure you want to leave this page and loose any modifications?
|
||||
footer
|
||||
a.button.is-grey.is-outlined.btn-edit-discard Stay on page
|
||||
a.button.is-orange(href='/' + pageData.meta.path) Discard
|
@ -1,33 +0,0 @@
|
||||
|
||||
//.modallayer#modal-editor-link
|
||||
.modallayer-content
|
||||
.tabs.is-boxed
|
||||
ul
|
||||
li
|
||||
a
|
||||
span.icon.is-small
|
||||
i.fa.fa-file-text-o
|
||||
span Internal Document Link
|
||||
li.is-active
|
||||
a
|
||||
span.icon.is-small
|
||||
i.fa.fa-external-link
|
||||
span External Link
|
||||
.columns.is-hidden
|
||||
.column
|
||||
label.label Text to display
|
||||
p.control
|
||||
input.input(type='text', placeholder='Text input')
|
||||
.column
|
||||
label.label Link
|
||||
p.control
|
||||
input.input(type='text', placeholder='http://')
|
||||
.columns
|
||||
.column
|
||||
label.label Text to display
|
||||
p.control
|
||||
input.input(type='text', placeholder='Text input')
|
||||
.column
|
||||
label.label Link
|
||||
p.control
|
||||
input.input(type='text', placeholder='http://')
|
Loading…
Reference in new issue