Fix intro submit

parent aab74324
......@@ -68,7 +68,7 @@
</span>
</div>
<div id="editor-container" style="height:450px;"></div>
<button id="submit-button" class="btn blue darken-2 article-buttons" onclick="edit_submit()">Submit</button>
<button id="submit-button" class="btn blue darken-2 article-buttons" onclick="intro_submit()">Submit</button>
<button class="btn blue darken-2 article-buttons" onclick="cancel_edit()">Cancel</button>
</div>
</body>
......
......@@ -363,30 +363,28 @@
(define (post-welcome-page)
(let ((timestamp (current-time)))
(git-post-article
(gen-proper-url-name timestamp "Welcome to Colt Blog Engine!")
"Colt blog engine is written with GNU Artanis, and licenced under GPLv3.
(git-post-article (uri-encode "Welcome to Colt Blog Engine!")
"Colt blog engine is written with GNU Artanis, and licenced under GPLv3.
This project is created in hope of helping people with free software.
Happy hacking!"
`(("timestamp" . ,timestamp)
("tags" . "")
("status" . "publish")
("title" . "Welcome to Colt Blog Engine!")
("name" . "Colt")
("comment_status" . "closed"))
#:init? #t)))
`(("timestamp" . ,timestamp)
("tags" . "")
("status" . "publish")
("title" . "Welcome to Colt Blog Engine!")
("name" . "Colt")
("comment_status" . "closed"))
#:init? #t)))
(define (post-intro-page)
(let ((timestamp (current-time)))
(git-post-article
(gen-proper-url-name timestamp "About me")
"I'm too lazy to introduce myself at present."
`(("timestamp" . ,timestamp)
("tags" . "")
("status" . "publish")
("title" . "_____colt_____Intro")
("name" . "Colt")
("comment_status" . "closed")))))
(git-post-article (uri-encode "About me")
"I'm too lazy to introduce myself at present."
`(("timestamp" . ,timestamp)
("tags" . "")
("status" . "publish")
("title" . "_____colt_____Intro")
("name" . "Colt")
("comment_status" . "closed")))))
(define (ensure-blog-repo)
(let ((blog-repo (current-blog-repo)))
......
......@@ -78,6 +78,8 @@
(substring content 0 (if i i (if (< len 256) len 256)))))
(define (gen-proper-url-name timestamp url-name)
(string-downcase
(string-append (strftime "%Y/%m/%d/" (localtime timestamp))
(uri-encode url-name))))
(if (string=? url-name "About me")
url-name
(string-downcase
(string-append (strftime "%Y/%m/%d/" (localtime timestamp))
(uri-encode url-name)))))
......@@ -112,6 +112,45 @@ function show_msg_layer(msg) {
});
}
function intro_submit() {
let article_content = quill.root.innerHTML;
let title = "_____colt_____Intro";
let tags = "";
let status = "publish";
let submit_button = document.getElementById("submit-button");
submit_button.innerText = "Submiting...";
submit_button.disabled = true;
$(document).ready(function () {
$.ajax({
type: "POST",
url: "/v1/colt/edit_article",
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', "");
}
})
})
}
function edit_submit() {
let article_content = quill.root.innerHTML;
let title = document.getElementById('edit-article-title').value;
......
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