forked from phith0n/Minos
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpost.htm
217 lines (212 loc) · 12.1 KB
/
post.htm
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
{% extends "base.htm" %}
{% block header_title %}{{ post["title"] }}{% end %}
{% block header_static %}
<link rel="stylesheet" href="{{ static_url('assets/highlightjs/default.min.css') }}">
{% end %}
{% block body %}
{% include "header.htm" %}
<div class="am-container">
<div class="am-g">
<div class="am-u-lg-9 am-u-md-12 am-u-sm-12">
<div class="am-panel am-panel-default">
<div class="am-panel-hd">
<div class="am-g">
<div class="am-u-sm-1 am-u-md-1 am-u-lg-1 am-hide-sm-down"><img width="48" height="48"
src="{{ get_avatar(user.get('_id')) }}" class="am-comment-avatar" /></div>
<div class="am-u-sm-9 am-u-md-9 am-u-lg-9">
<strong>{{ post["title"] }}</strong><br />
<small><a class="am-comment-author" href="/user/detail/{{ user.get('username') }}">
{{ user.get('username') }}</a> 发表于 {{ humantime(post['time'], span = True) }}
<a href="/sort/{{ post['sort']['_id'] }}"><span class="am-badge am-badge-success">{{ post["sort"]["name"] }}</span></a></small>
</div>
<div class="am-u-sm-2 am-u-md-2 am-u-lg-2 am-text-right am-hide-sm-down">
<a class="am-link-muted" href="" id="like"><span class="am-icon-thumbs-up am-text-xs"></span> <span class="am-text-xs minos-act">顶({{ len(post['like']) }})</span></a><br />
<a class="am-link-muted" href="" id="unlike"><span class="am-icon-thumbs-down am-text-xs"></span> <span class="am-text-xs minos-act">踩({{ len(post['unlike']) }})</span></a>
</div>
</div>
</div>
<article class="am-article am-margin am-text-break">
<div class="am-article-bd ">
{% raw post["content"] %}
</div>
<hr class="am-article-divider am-hide-sm-down" />
<div class="am-article-bd" >
<ul class="am-list am-list-static am-list-border">
{% if post.get("rank") != 0 or post.get('star') %}
<li>
{% if post.get("rank") > 0 %}<span class="am-badge am-badge-success">奖励{{ post.get('rank') }}金币</span>{% end %}
{% if post.get("rank") < 0 %}<span class="am-badge am-badge-danger">惩罚{{ -post.get('rank') }}金币</span>{% end %}
{% if post.get('star') %}<span class="am-badge am-badge-primary">加精</span>{% end %}
管理员对帖子进行了操作
</li>
{% end %}
{% if len(post['thanks']) %}
<li class="am-text-truncate">
<span class="am-badge am-badge-success">共{{ len(post['thanks']) }}个感谢</span>
<span>{% set thx_user = ','.join(post['thanks']) %}
他们感谢过作者:{{ thx_user }}</span>
</li>
{% end %}
{% if post['charge'] and len(post['buyer']) %}
<li class="am-text-truncate">
<span class="am-badge am-badge-secondary">共{{ len(post['buyer']) }}次购买</span>
{% set buy_user = ','.join(post['buyer']) %}
他们购买了帖子:{{ buy_user }}
</li>
{% end %}
</ul>
</div>
<div class="minos-social am-hide-sm-down bdsharebuttonbox">
<span class="am-text-sm">收藏:</span>
<a href="#" id="bookmark" class="am-icon-btn am-default am-icon-bookmark"></a>
<span class="am-text-sm">感谢:</span>
<a href="#" id="thanks" class="am-icon-btn am-default am-icon-check"></a>
<span class="am-text-sm">分享到:</span>
<a href="#" title="分享到微信" class="am-icon-btn am-success am-icon-weixin"></a>
<a href="#" data-cmd="tsina" title="分享到新浪微博" class="am-icon-btn am-danger am-icon-weibo"></a>
<a href="#" data-cmd="qzone" title="分享到QQ空间" class="am-icon-btn am-primary am-icon-qq"></a>
</div>
<hr class="am-article-divider" />
</article>
<div class="am-panel-bd">
{% if len(post["comment"]) %}
<ul class="am-comments-list">
{% for comment in post["comment"] %}
<li class="am-comment">
<a name="{{ comment['_id'] }}"></a>
<a href="/user/detail/{{ comment['user']['username'] }}">
<img src="{{ get_avatar(comment['user']['id']) }}" class="am-comment-avatar" width="48"
height="48">
</a>
<div class="am-comment-main">
<header class="am-comment-hd">
<div class="am-comment-meta">
<a href="/user/detail/{{ comment['user']['username'] }}" class="am-comment-author">{{ comment['user']['username'] }}</a> 评论于 {{ humantime(comment['time']) }}
</div>
<div class="am-g am-comment-meta am-g-collapse am-text-right">
<div class="am-u-sm-8"> </div>
<div class="am-u-sm-2">
{% if power == "admin" %}
<form method="post" action="/admin/delcomment">
<a href="del-comment">删除</a>
<input type="hidden" name="comid" value="{{ comment['_id'] }}">
<input type="hidden" name="postid" value="{{ post['_id'] }}">
{% raw xsrf_form_html() %}
</form>
{% end %}
</div>
<div class="am-u-sm-2">
<a href="reply-comment" name="@{{ comment['user']['username'] }}">回复</a>
</div>
</div>
</header>
<div class="am-comment-bd am-text-sm">
<p class="minos-at am-text-break">{% raw nl2br(comment['content']) %}</p>
</div>
</div>
</li>
{% end %}
</ul>
{% else %}
<span class="am-text-primary am-text-sm">还没有人评论,你不要顶一下楼主么?</span>
{% end %}
</div>
<hr class="minos-hr " />
<div class="am-panel-bd">
<form class="am-form" method="post">
<div class="am-form-group">
<label>发表评论</label>
<textarea name="content" id="comment" class="minos-textbox" rows="5"></textarea>
</div>
{% if handler.settings["captcha"]["comment"] %}
<div class="am-g am-margin-bottom">
<div class="am-form-group">
<div class="am-u-sm-4">
<input type="text" name="captcha" class="am-input-sm" >
</div>
<div class="am-u-sm-4">
<img src="/captcha.png" height="36" id="captcha" />
</div>
<div class="am-u-sm-4"></div>
</div>
</div>
{% end %}
<button type="submit" class="am-btn am-btn-default am-btn-block am-btn-xs">提交</button>
<input type="hidden" id="postid" name="postid" value="{{ post.get('_id') }}" />
{% raw xsrf_form_html() %}
</form>
</div>
</div>
</div>
<div class="am-u-lg-3 am-show-lg-only">
{% include "self.htm" %}
{% if is_edit(post) or power == "admin" %}
<div class="am-panel am-panel-default">
<div class="am-panel-hd">编辑文章</div>
<ul class="am-list am-list-static minos-admin-edit">
<li><a class="am-text-sm" href="/edit/{{ post['_id'] }}"><span class="am-icon-edit"></span> 修改</a></li>
{% if power == 'admin' %}
<li>
<form action="/admin/article" method="post" id="delete">
<input name="id" value="{{ post['_id'] }}" type="hidden">
<input name="method" type="hidden">
<a class="am-text-sm" href=""><span class="am-icon-remove"></span> 删除</a>
{% raw xsrf_form_html() %}
</form>
</li>
<li>
<form action="/admin/article" method="post" id="star">
<input name="id" value="{{ post['_id'] }}" type="hidden">
<input name="method" type="hidden">
<a class="am-text-sm" href="#{{ 'star' if post.get('star') else 'unstar' }}"><span class="am-icon-star"></span>{% if post.get('star') %} 取消精华{% else %} 精华{% end %}</a>
{% raw xsrf_form_html() %}
</form>
</li>
<li>
<form action="/admin/article" method="post" id="rank">
<input name="id" value="{{ post['_id'] }}" type="hidden">
<input name="method" type="hidden">
<input name="rank" type="hidden">
<a class="am-text-sm" href="#{{ 'rank' if post.get('rank') else 'unrank' }}"><span class="am-icon-usd"></span>  评分</a>
{% raw xsrf_form_html() %}
</form>
</li>
<li>
<form action="/admin/article" method="post" id="open">
<input name="id" value="{{ post['_id'] }}" type="hidden">
<input name="method" type="hidden">
<a class="am-text-sm" href="#{{ 'open' if post.get('open') else 'close' }}"><span class="am-icon-eye"></span> {% if post.get('open') %}不公开{% else %}公开{% end %}</a>
{% raw xsrf_form_html() %}
</form>
</li>
<li>
<form action="/admin/article" method="post" id="top">
<input name="id" value="{{ post['_id'] }}" type="hidden">
<input name="method" type="hidden">
<a class="am-text-sm" href="#{{ 'top' if post.get('top') else 'notop' }}"><span class="am-icon-thumb-tack"></span> {% if post.get('top') %} 不置顶{% else %} 置顶{% end %}</a>
{% raw xsrf_form_html() %}
</form>
</li>
{% end %}
</ul>
</div>
{% end %}
</div>
</div>
</div>
<div class="am-modal am-modal-no-btn" tabindex="-1" id="show-qrcode">
<div class="am-modal-dialog">
<div class="am-modal-hd">微信扫描分享
<a href="javascript: void(0)" class="am-close am-close-spin" data-am-modal-close>×</a>
</div>
<div class="am-modal-bd am-g" >
<div id="qrcode"></div>
</div>
</div>
</div>
{% end %}
{% block footer_static %}
<script src="{{ static_url('assets/highlightjs/highlight.min.js') }}"></script>
<script src="{{ static_url('assets/js/app.js') }}"></script>
<script src="{{ static_url('assets/js/post.js') }}"></script>
{% end %}