refactor: alerts + admin profile + user create dialog as Vue components

This commit is contained in:
NGPixel
2017-05-21 16:43:58 -04:00
parent c20c935fa5
commit 6814c952bf
15 changed files with 364 additions and 272 deletions

View File

@@ -1,7 +1,5 @@
'use strict'
import * as $ from 'jquery'
export default {
name: 'admin-profile',
props: ['email', 'name', 'provider'],
@@ -13,17 +11,29 @@ export default {
},
methods: {
saveUser() {
let self = this
if (this.password !== this.passwordVerify) {
//alerts.pushError('Error', "Passwords don't match!")
return
return self.$store.dispatch('alert', {
style: 'red',
icon: 'square-cross',
msg: 'The passwords don\'t match. Try again.'
})
}
$.post(window.location.href, {
this.$http.post(window.location.href, {
password: this.password,
name: this.name
}).done((resp) => {
//alerts.pushSuccess('Saved successfully', 'Changes have been applied.')
}).fail((jqXHR, txtStatus, resp) => {
//alerts.pushError('Error', resp)
}).then(resp => {
self.$store.dispatch('alert', {
style: 'green',
icon: 'check',
msg: 'Changes have been applied successfully.'
})
}).catch(err => {
self.$store.dispatch('alert', {
style: 'red',
icon: 'square-cross',
msg: 'Error: ' + err.body.msg
})
})
}
}

View File

@@ -7,9 +7,7 @@ import _ from 'lodash'
import Vue from 'vue'
module.exports = (alerts) => {
if ($('#page-type-admin-users').length) {
require('../modals/admin-users-create.js')(alerts)
} else if ($('#page-type-admin-users-edit').length) {
if ($('#page-type-admin-users-edit').length) {
let vueEditUser = new Vue({
el: '#page-type-admin-users-edit',
data: {

View File

@@ -4,8 +4,6 @@
import $ from 'jquery'
import MathJax from 'mathjax'
// import * as CopyPath from '../components/copy-path.vue'
import Vue from 'vue'
module.exports = (alerts) => {
if ($('#page-type-view').length) {