Fix intro edit & update

parent 14115fec
......@@ -127,7 +127,7 @@
(article-name (hash-ref json-content "name"))
(article-content (hash-ref json-content "content"))
(article-status (hash-ref json-content "status"))
(article-oid (hash-ref json-content "oid"))
(article-oid (hash-ref json-content "oid"))
(article-tags (hash-ref json-content "tags"))
(update-timestamp? (hash-ref json-content "update_timestamp"))
(oid (git-edit-article article-title article-name article-content
......@@ -157,7 +157,7 @@
(lambda (rc)
(let-values (((title author blog disqus pubkey old-passwd new-passwd)
(:from-post rc 'get-vals "title" "author" "blog-url"
"disqus" "disqus-pubkey" "old-passwd" "new-passwd")))
"disqus" "disqus-pubkey" "old-passwd" "new-passwd")))
(let/ec return
(when (and new-passwd (not (string-null? new-passwd)))
(if (check-passwd old-passwd)
......
......@@ -137,6 +137,9 @@
(define (cache-the-post! oid op)
(let ((new-post (get-one-post-from-git oid)))
(cond
((string=? (meta-data-title (post-meta-data new-post))
"_____colt_____Intro")
(set! *intro* (list new-post)))
((eq? op 'post)
(set! *all-post-objs*
(sort-by-time
......
/*
@licstart The following is the entire license notice for the
JavaScript code in this page.
@licstart The following is the entire license notice for the
JavaScript code in this page.
Copyright (C) 2019 Mu Lei known as NalaGinrut <mulei@gnu.org>
Copyright (C) 2019 Mu Lei known as NalaGinrut <mulei@gnu.org>
The JavaScript code in this page is free software: you can
redistribute it and/or modify it under the terms of the GNU
General Public License (GNU GPL) as published by the Free Software
Foundation, either version 3 of the License, or (at your option)
any later version. The code is distributed WITHOUT ANY WARRANTY;
without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU GPL for more details.
The JavaScript code in this page is free software: you can
redistribute it and/or modify it under the terms of the GNU
General Public License (GNU GPL) as published by the Free Software
Foundation, either version 3 of the License, or (at your option)
any later version. The code is distributed WITHOUT ANY WARRANTY;
without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU GPL for more details.
As additional permission under GNU GPL version 3 section 7, you
may distribute non-source (e.g., minimized or compacted) forms of
that code without the copy of the GNU GPL normally required by
section 4, provided you include this license notice and a URL
through which recipients can access the Corresponding Source.
As additional permission under GNU GPL version 3 section 7, you
may distribute non-source (e.g., minimized or compacted) forms of
that code without the copy of the GNU GPL normally required by
section 4, provided you include this license notice and a URL
through which recipients can access the Corresponding Source.
@licend The above is the entire license notice
for the JavaScript code in this page.
*/
@licend The above is the entire license notice
for the JavaScript code in this page.
*/
var children_nodes;
var quill;
var url_name;
......@@ -124,35 +124,33 @@ function intro_submit() {
submit_button.innerText = "Submiting...";
submit_button.disabled = true;
$(document).ready(function () {
$.ajax({
type: "POST",
url: "/v1/colt/edit_article",
contentType: "application/json; charset=utf-8",
dataType: "json",
data: JSON.stringify({
"title": title,
"name": "About me",
"content": article_content,
"status": status,
"oid": article_oid,
"tags": tags,
"update_timestamp": false
}),
success: function (oid) {
if ("failed" === oid)
{
show_msg_layer("Edit failed, please check!");
submit_button.innerText = "Submit";
submit_button.disabled = false;
}
else
window.location.pathname = "/about";
localStorage.setItem('colt.saved_content', "");
fetch('/v1/colt/edit_article', {
method: 'POST',
body: JSON.stringify({
"title": title,
"name": "About me",
"content": article_content,
"status": status,
"oid": article_oid,
"tags": tags,
"update_timestamp": false
}),
headers: {
'Content-Type': 'application/json; charset=utf-8'
}})
.then(response => response.text())
.then(oid => {
if ("failed" === oid)
{
show_msg_layer("Edit failed, please check!");
submit_button.innerText = "Submit";
submit_button.disabled = false;
}
else
window.location.pathname = "/about";
localStorage.setItem('colt.saved_content', "");
})
})
}
function edit_submit() {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment