Note saving, revert buttons in review page

This commit is contained in:
2018-08-11 11:02:56 +02:00
parent b1d1fa4880
commit 58c28b776b
10 changed files with 184 additions and 51 deletions
@@ -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
View File
@@ -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
View File
@@ -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 {