Bugletfixes
This commit is contained in:
parent
9d0ca63aa9
commit
cd784e34c3
3 changed files with 6 additions and 2 deletions
|
@ -24,6 +24,7 @@ function openEditor() {
|
|||
const cancel = editor.querySelector('.cancel');
|
||||
|
||||
const footer = document.querySelector("footer");
|
||||
const articleId = footer.querySelector(".article-id");
|
||||
const revision = footer.querySelector(".revision");
|
||||
const lastUpdated = footer.querySelector(".last-updated");
|
||||
|
||||
|
@ -65,8 +66,9 @@ function openEditor() {
|
|||
const result = await response.json();
|
||||
|
||||
// Update url-bar, page title and footer
|
||||
window.history.replaceState(null, result.title, result.slug);
|
||||
window.history.replaceState(null, result.title, result.slug == "" ? "." : result.slug);
|
||||
document.querySelector("title").textContent = result.title;
|
||||
if (result.article_id != null) articleId.textContent = result.article_id;
|
||||
revision.textContent = result.revision;
|
||||
lastUpdated.textContent = result.created;
|
||||
|
||||
|
|
|
@ -109,6 +109,7 @@ impl Resource for NewArticleResource {
|
|||
#[derive(Serialize)]
|
||||
struct PutResponse<'a> {
|
||||
slug: &'a str,
|
||||
article_id: i32,
|
||||
revision: i32,
|
||||
title: &'a str,
|
||||
rendered: &'a str,
|
||||
|
@ -134,6 +135,7 @@ impl Resource for NewArticleResource {
|
|||
.with_header(ContentType(APPLICATION_JSON.clone()))
|
||||
.with_body(serde_json::to_string(&PutResponse {
|
||||
slug: &updated.slug,
|
||||
article_id: updated.article_id,
|
||||
revision: updated.revision,
|
||||
title: &updated.title,
|
||||
rendered: &Template {
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
<p><a id="openEditor" href="?editor">Edit</a></p>
|
||||
<dl>
|
||||
<dt>Article ID</dt>
|
||||
<dd>{{article_id}}</dd>
|
||||
<dd class="article-id">{{article_id}}</dd>
|
||||
|
||||
<dt>Revision</dt>
|
||||
<dd class="revision">{{revision}}</dd>
|
||||
|
|
Loading…
Reference in a new issue