-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathpost.html
73 lines (73 loc) · 3.3 KB
/
post.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
{% extends 'oierspace/blog/themes/pc/theme_classic/base.html' %}
{% block title %}{{ post.title }} - {{ blog.name }}{% endblock %}
{% block head %}
{% include 'oierspace/blog/themes/pc/markdown_latex_import.html' %}
{% endblock %}
{% block content %}
<main class="container">
<div class="row g-5">
<div class="col-md-8">
<h2 class="display-4 fst-italic title-serif">{{ post.title }}</h2>
<div class="mb-1 text-muted">
{{ post.publish_time }} - 发布于
<a href="{% url 'blog_category' post.category.slug %}">{{ post.category.title }}</a>
- {{ post.num_visits }} 浏览
{% if blog.owner == user %}
- <a target="_blank" href="https://oier.space/dashboard/post/{{ post.pk }}">编辑</a>
{% endif %}
</div>
<div id="content" class="markdown"></div>
<script>
document.getElementById('content').innerHTML = markdownit({html:true}).use(
texmath,
{
engine: katex,
delimiters: 'dollars',
}
).render("{{ post.content|escapejs }}");
hljs.highlightAll();
</script>
<div class="mb-1 text-muted">最后修改于 {{ post.last_edit_time }}</div>
{% if user.is_authenticated %}
<br>
{% if have_error %}
<div class="alert alert-danger">
{% for error in errors %}
{{ error }}<br>
{% endfor %}
</div>
{% endif %}
<form method="post">
{% csrf_token %}
<textarea class="bg-light" style="border: 0; border-radius: .4em; width: 100%; height: 12em; padding: 1.4em; resize: none; box-sizing: border-box" placeholder="评论" name="comment"></textarea>
<button class="w-100 btn btn-primary btn-lg" type="submit">发送评论</button>
</form>
{% else %}
<a class="w-100 btn btn-primary btn-lg" href="https://oier.space/luogulogin/?r={{ blog.domain }}&loc=post/{{ post.slug }}">登录以发送评论</a>
{% endif %}
{% if comments %}
<br>
{% for comment in comments %}
<div class="bg-light p-4 rounded mt-3" id="comment-{{ comment.pk }}">
<h5 style="display: inline-block">
{{ comment.username_display }}
{% if comment.user_badge %}
<span class="badge rounded-pill bg-secondary">{{ comment.user_badge }}</span>
{% endif %}
</h5>
<span class="text-muted">{{ comment.sending_time }}</span>
{% if comment.user == user or blog.owner == user %}
<a class="text-muted" href="{% url 'blog_post' post.slug %}?delete={{ comment.pk }}" style="float: right">删除</a>
{% endif %}
<div>{{ comment.content }}</div>
</div>
{% endfor %}
{% endif %}
</div>
{% include 'oierspace/blog/themes/pc/theme_classic/component/side.html' %}
</div>
</main>
{% endblock %}
{% block style %}
{% include 'oierspace/blog/themes/pc/markdown_css.html' %}
{% endblock %}