Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
hopetree
committed
Jun 28, 2023
1 parent
42f0c6f
commit 6dc50ce
Showing
8 changed files
with
223 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
function article_update_save(csrf, api_url, article_slug) { | ||
const article_body = testEditor.getMarkdown(); | ||
$.ajaxSetup({ | ||
data: { | ||
csrfmiddlewaretoken: csrf | ||
} | ||
}); | ||
$.ajax({ | ||
type: 'post', | ||
url: api_url, | ||
data: { | ||
'article_slug': article_slug, | ||
'article_body': article_body, | ||
}, | ||
dataType: 'json', | ||
success: function (data) { | ||
if (data.code === 0) { | ||
window.location.href = data.data.callback | ||
} | ||
}, | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
{% extends 'blog/base.html' %} | ||
{% load static tool_tags %} | ||
{% block head_title %}{{ article.title }}_{{ article.category }}{% endblock %} | ||
{% block metas %} | ||
<meta name="robots" content="noindex"> | ||
<meta name="description" content="{{ article.summary }}"> | ||
{% endblock %} | ||
{% block top-file %} | ||
<link rel="stylesheet" href="{% static 'editor/css/editormd.min.css' %}"/> | ||
<style> | ||
#layout > header { | ||
margin: 0 auto; | ||
padding: 5px 0; | ||
width: 90%; | ||
} | ||
|
||
#layout > header { | ||
margin-bottom: 1rem; | ||
} | ||
|
||
#layout > header > div > a { | ||
color: inherit; | ||
text-decoration: none; | ||
} | ||
|
||
#layout > header > div > a:hover { | ||
color: #ea6f5a; | ||
} | ||
|
||
</style> | ||
{% endblock %} | ||
{% block base_content %} | ||
<div id="layout"> | ||
<header class="my-2"> | ||
<button type="button" class="btn btn-success btn-sm mr-2" id="save-article">保存修改</button> | ||
<button type="button" class="btn btn-warning btn-sm mr-2" id="back-article">放弃编辑</button> | ||
<button type="button" class="btn btn-info btn-sm mr-2" id="more-edit-article">后台编辑</button> | ||
</header> | ||
<div id="test-editormd"> | ||
<textarea style="display:none;">{{ article.body }}</textarea> | ||
</div> | ||
</div> | ||
{% endblock %} | ||
{% block end_file %} | ||
<script src="https://cdn.bootcss.com/jquery/3.3.1/jquery.min.js"></script> | ||
<script src="{% static 'editor/js/editormd.min.js' %}"></script> | ||
<script type="text/javascript"> | ||
let testEditor; | ||
|
||
$(function () { | ||
testEditor = editormd("test-editormd", { | ||
width: "90%", | ||
height: "1000", | ||
syncScrolling: "single", | ||
path: "{% static 'editor/lib/' %}" | ||
}); | ||
}); | ||
</script> | ||
<script src="{% static 'blog/js/article.js' %}?v20230628.1"></script> | ||
<script> | ||
$('#save-article').click(function () { | ||
article_update_save("{{ csrf_token }}", "{% url 'blog:article_update' %}", "{{ article.slug }}") | ||
}); | ||
$('#back-article').click(function () { | ||
window.location.href = "{% url 'blog:detail' article.slug %}"; | ||
}); | ||
$('#more-edit-article').click(function () { | ||
window.location.href = "{% url 'admin:blog_article_change' article.pk %}"; | ||
}); | ||
</script> | ||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{% extends "blog/base.html" %} | ||
{% load static %} | ||
|
||
{% block head_title %}403{% endblock %} | ||
{% block metas %} | ||
<meta name="description" content="403,无权限访问"> | ||
<meta name="keywords" content="403页面"> | ||
{% endblock %} | ||
|
||
{% block base_content %} | ||
<div class="container"> | ||
<div class="row errorpage"> | ||
<div class="col align-self-center error-img text-center"> | ||
<h1 style="font-size: 12rem;color: #ee795a">403</h1> | ||
<div class="errormsg"> | ||
<h3>你没有权限造访本星球,请返回地球...</h3> | ||
<a href="javascript:history.go(-1);">返回地球</a> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
{% endblock %} |