Note saving, revert buttons in review page
This commit is contained in:
Vendored
+6
@@ -12,4 +12,10 @@ $(function () {
|
||||
$('[data-toggle="tooltip"]').tooltip({
|
||||
container: 'body'
|
||||
})
|
||||
|
||||
$(document).on('click', 'a[data-confirm]', function (e) {
|
||||
if (!window.confirm(this.dataset.confirm)) {
|
||||
e.preventDefault()
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
@@ -265,6 +265,7 @@ export default {
|
||||
this.query({
|
||||
action: 'col.add',
|
||||
}, (resp) => {
|
||||
resp.data._editing = true;
|
||||
this.columns.push(resp.data)
|
||||
})
|
||||
}
|
||||
@@ -414,7 +415,7 @@ export default {
|
||||
|
||||
resetOrder() {
|
||||
this.query({
|
||||
action: 'col.reset-sort'
|
||||
action: 'reset.col-order'
|
||||
}, (resp) => {
|
||||
this.columns = resp.data;
|
||||
})
|
||||
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
import { query } from './table-editor-utils'
|
||||
|
||||
export default function (dataRoute) {
|
||||
let $note = $('#field-note')
|
||||
let lastText = $note.val()
|
||||
|
||||
let handler = _.debounce(function () {
|
||||
query(dataRoute, {
|
||||
action: 'note.set',
|
||||
text: lastText
|
||||
})
|
||||
}, 350)
|
||||
|
||||
$note.on('input', () => {
|
||||
let text = $note.val()
|
||||
if (text !== lastText) {
|
||||
lastText = text
|
||||
handler()
|
||||
}
|
||||
})
|
||||
}
|
||||
+13
-8
@@ -2,17 +2,22 @@ function busy (yes) {
|
||||
$('#draft-busy').css('opacity', yes ? 1 : 0)
|
||||
}
|
||||
|
||||
let loaderHideTimeout;
|
||||
|
||||
function query (route, data, sucfn, erfn) {
|
||||
busy(true)
|
||||
if (!sucfn) sucfn = () => {}
|
||||
if (!erfn) erfn = () => {}
|
||||
|
||||
window.axios.post(route, data).then(sucfn).catch((error) => {
|
||||
console.error(error.message)
|
||||
erfn(error.response.data)
|
||||
}).then(() => {
|
||||
busy(false)
|
||||
})
|
||||
clearTimeout(loaderHideTimeout)
|
||||
busy(true)
|
||||
window.axios.post(route, data)
|
||||
.then(sucfn)
|
||||
.catch((error) => {
|
||||
console.error(error.message)
|
||||
erfn(error.response.data)
|
||||
})
|
||||
.finally(() => {
|
||||
loaderHideTimeout = setTimeout(() => busy(false), 50)
|
||||
})
|
||||
}
|
||||
|
||||
export {
|
||||
|
||||
Vendored
+10
-8
@@ -1,21 +1,23 @@
|
||||
import DraftNotePage from './components/DraftNotePage'
|
||||
|
||||
window.Vue = require('vue')
|
||||
|
||||
const ColumnEditor = Vue.component('column-editor', require('./components/ColumnEditor.vue'))
|
||||
const RowsEditor = Vue.component('rows-editor', require('./components/RowsEditor.vue'))
|
||||
const Icon = Vue.component('v-icon', require('./components/Icon.vue'))
|
||||
|
||||
// const app = new Vue({
|
||||
// el: '#app'
|
||||
// });
|
||||
|
||||
window.app = {
|
||||
ColumnEditor: function (selector, data) {
|
||||
ColumnEditor (selector, data) {
|
||||
return new ColumnEditor({ propsData: data }).$mount(selector)
|
||||
},
|
||||
RowsEditor: function (selector, data) {
|
||||
|
||||
RowsEditor (selector, data) {
|
||||
return new RowsEditor({ propsData: data }).$mount(selector)
|
||||
},
|
||||
Icon: function (selector, data) {
|
||||
|
||||
Icon (selector, data) {
|
||||
return new Icon({ propsData: data }).$mount(selector)
|
||||
}
|
||||
},
|
||||
|
||||
DraftNotePage
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user