Edit save + git commit + push sync

This commit is contained in:
NGPixel
2016-08-29 01:21:35 -04:00
parent 8fbce25f5d
commit 0f06ab6dc8
9 changed files with 170 additions and 34 deletions

View File

@@ -39,7 +39,7 @@ jQuery( document ).ready(function( $ ) {
if($('#mk-editor').length === 1) {
let mde = new SimpleMDE({
var mde = new SimpleMDE({
autofocus: true,
autoDownloadFontAwesome: false,
element: $("#mk-editor").get(0),

View File

@@ -11,7 +11,21 @@ if($('#page-type-edit').length) {
$('.btn-edit-save').on('click', (ev) => {
$.ajax(window.location.href, {
data: {
markdown: mde.value()
},
dataType: 'json',
method: 'PUT'
}).then((rData, rStatus, rXHR) => {
if(rData.ok) {
window.location.assign('/' + $('#page-type-edit').data('entrypath'));
} else {
alerts.pushError('Something went wrong', rData.error);
}
}, (rXHR, rStatus, err) => {
alerts.pushError('Something went wrong', 'Save operation failed.');
});
});