finish music player

ajax_post
Yang Liuxin 3 years ago
parent 8d9de37d6a
commit e5b779c1f0

@ -414,6 +414,7 @@ def post(id):
else:
flash('Comment published successfully')
return redirect(url_for('.post', id=post.id))
# return render_template('answer.html', posts=[post], form=form, comments=comments, pagination=pagination)
return render_template('post.html', posts=[post], form=form, comments=comments, pagination=pagination)

@ -0,0 +1,240 @@
{% extends "base.html" %}
{% import "bootstrap/wtf.html" as wtf %}
{% import "_macros.html" as macros %}
{% block title %}Post{% endblock %}
{% block styles %}
{{ super() }}
<link href="{{ url_for('static', filename='editormd/css/editormd.preview.min.css') }}" rel="stylesheet"/>
<link href="{{ url_for('static', filename='editormd/css/editormd.css') }}" rel="stylesheet"/>
<link rel="stylesheet" href="{{ url_for('static', filename='share.css') }}">
<link href="{{ url_for('static', filename='single_post.css') }}" rel="stylesheet"/>
<link href="{{ url_for('static', filename='comments.css') }}" rel="stylesheet"/>
{% endblock %}
{% block scripts %}
{{ super() }}
<script type="text/javascript" src="{{ url_for('static', filename='editormd/lib/marked.min.js') }}"></script>
<script type="text/javascript" src="{{ url_for('static', filename='editormd/lib/prettify.min.js') }}"></script>
<script type="text/javascript" src="{{ url_for('static', filename='editormd/editormd.min.js') }}"></script>
<script type="text/javascript" src="{{ url_for('static', filename='js/jquery.1.8.2.min.js') }}"></script>
<script type="text/javascript" src="{{ url_for('static', filename='js/share.js') }}"></script>
<script type="text/javascript">
editormd.markdownToHTML("fancy-content", {
htmlDecode: "style,script,iframe",
emoji: true,
taskList: true,
});
</script>
<script>
var comment = document.getElementById('body')
comment.className = 'form-control'
comment.style = "margin:30px; height:100px; width:730px; overflow:auto; resize: none;";
var submit = document.getElementById('submit')
submit.className = 'btn btn-primary';
submit.style = "margin-left: 40px";
$(function () {
$("#socialShare").socialShare({
content: '',
url: '',
titile: ''
});
});
$("#shareQQ").on("click", function () {
$(this).socialShare("tQQ");
})
</script>
{% endblock %}
{% block page_content %}
<ul class="posts list-unstyled">
{% for post in posts %}
<li class="post">
<div class="post-box">
<div class="post-content col-sm-offset-1 col-sm-10">
<h1 class="post-title text-center" style="margin: 30px; font-size: 35px">
<a href="">
Question
</a>
</h1>
<div class="content" id="fancy-content" style="padding-bottom:20px;
border-bottom: 1px solid #ddd;margin: 30px;">
This is the content.
</div>
</div>
<div class="post-content col-sm-offset-1 col-sm-10">
{# 标题#}
<h1 class="post-title text-center" style="margin: 30px; font-size: 35px">
<a href="{{ url_for('.post', id=post.id) }}">
{{ post.title }}
</a>
</h1>
<div id="socialShare"></div>
<div class="content" id="fancy-content" style="padding-bottom:20px;
border-bottom: 1px solid #ddd;margin: 30px;">
{{ post.body_html| safe }}
</div>
</div>
<!-- 作者-->
<div class="post-author col-sm-offset-1 col-sm-10">
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">Author</h3>
</div>
{% if post.is_anonymous %}
<div class="panel-body">
<div class=" col-sm-2">
<span class="head-photo">
<img class="img-rounded profile-thumbnail"
src="{{ url_for('static',filename='Image/anonymous.png') }}" alt="avatar"
style="width: 60px; height: 60px">
</span>
</div>
<div class="col-sm-2">
<h4>
Anonymous
</h4>
</div>
</div>
{% else %}
<div class="panel-body">
<div class=" col-sm-2">
<a class="head-photo"
href="{{ url_for('.user', username=post.author.username) }}">
{% if post.author.avatar_img %}
<img class="img-rounded profile-thumbnail"
src="{{ post.author.avatar_img }}" alt="avatar"
style="width: 60px; height: 60px">
{% else %}
<img class="img-rounded profile-thumbnail"
src="{{ post.author.gravatar(size=60) }}" alt="avatar">
{% endif %}
</a>
</div>
<div class="col-sm-3">
<h4>
<a href="{{ url_for('.user', username=post.author.username) }}">
{{ post.author.username }}
{% if post.author.can(Permission.ACTIVITY) %}
<svg class="icon" viewBox="0 0 1024 1024" width="17" height="17"
style="margin: 0">
<path d="M959.786667 148.906667l-44.330667-0.725333c-1.024 0-100.437333-2.048-203.050667-41.728-105.301333-40.789333-173.141333-87.552-173.781333-88.021333L511.872 0 485.248 18.474667C484.608 18.901333 416.768 65.706667 311.466667 106.453333 208.938667 146.218667 109.482667 148.181333 108.544 148.181333L64 148.906667l0 430.464C64 795.477333 355.328 1024 511.957333 1024 668.714667 1024 960 795.477333 960 579.370667L959.786667 148.906667zM321.877333 772.48 321.877333 355.413333 282.112 355.413333 282.112 317.482667 441.173333 317.482667l0 189.610667 200.192-189.610667 157.696 0L321.877333 772.48z"
fill="#3688FF"></path>
</svg>
{% endif %}
</a>
</h4>
</div>
<div class="col-sm-5">
<h6>{{ post.author.grade }}</h6>
<h6>{{ post.author.college }}</h6>
</div>
{% if current_user.can(Permission.FOLLOW) and post.author != current_user %}
{% if not current_user.is_following(post.author) %}
<a align="center"
href="{{ url_for('.follow', username=post.author.username) }}"
class="btn btn-primary" style="margin-top: 12px">Follow</a>
{% else %}
<a align="center"
href="{{ url_for('.unfollow', username=post.author.username) }}"
class="btn btn-default" style="margin-top: 12px">Unfollow</a>
{% endif %}
{% endif %}
</div>
{% endif %}
</div>
</div>
</div>
{# 评论区#}
<div class="container col-sm-offset-1 col-sm-10 comment-cont">
<h2 id="comments">Comments</h2>
{% include 'Posts/_comments.html' %}
{% if current_user.can(Permission.COMMENT) %}
<div class="comment-form">
<form role="form" class="form-signin" method="post">
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}"/>
<div class="col-md-12">
{% if request.args.get('reply') %}
<div class="alert alert-warning alert-dismissible" id="reply" role="alert">
Reply to <b>{{ request.args.get('author') }}</b>
<a style="float: right" href="{{ url_for('.post', id=post.id) }}">Cancel</a>
</div>
{% endif %}
<div class="comment-box col-md-10">
{{ form.csrf_token }}
{{ form.body }}
</div>
<div class="col-md-2 submit">
<div class="checkbox">
<label>
<input name="anonymous" type="checkbox"> Anonymous
</label>
</div>
{{ form.submit }}
</div>
</div>
</form>
</div>
{% endif %}
{% if pagination %}
<div class="pagination">
{{ macros.pagination_widget(pagination, '.post', fragment='#comments', id=posts[0].id) }}
</div>
{% endif %}
</div>
<!-- 点赞与查看点赞的人 -->
<div class="like-btn">
<!-- 点赞-->
{% if not current_user.is_liking(post) %}
<a class="unlike" href="{{ url_for('.like_inpost', post_id=post.id) }}">
<svg viewBox="0 0 1024 1024" width="25" height="25">
<path d="M889.6 396.8 608 396.8C633.6 262.4 684.8 96 576 44.8 460.8-6.4 454.4 64 441.6 179.2c-12.8 121.6-192 249.6-192 249.6l0 563.2 608 0c83.2-38.4 134.4-377.6 160-499.2C1043.2 371.2 889.6 396.8 889.6 396.8z"
fill="#868686"></path>
<path d="M0 428.8l179.2 0 0 569.6-179.2 0 0-569.6Z" fill="#868686"></path>
</svg>
<div>{{ post.liker.count() }} likes</div>
</a>
{% else %}
<a class="liked" href="{{ url_for('.dislike_inpost', post_id=post.id) }}">
<svg viewBox="0 0 1024 1024" width="25" height="25">
<path d="M889.6 396.8 608 396.8C633.6 262.4 684.8 96 576 44.8 460.8-6.4 454.4 64 441.6 179.2c-12.8 121.6-192 249.6-192 249.6l0 563.2 608 0c83.2-38.4 134.4-377.6 160-499.2C1043.2 371.2 889.6 396.8 889.6 396.8z"
fill="#3688FF"></path>
<path d="M0 428.8l179.2 0 0 569.6-179.2 0 0-569.6Z" fill="#3688FF"></path>
</svg>
<div>{{ post.liker.count() }} likes</div>
</a>
{% endif %}
<a class="all-liker" href="{{ url_for('.liked_by', post_id = post.id ) }}">
<svg viewBox="0 0 1024 1024" version="1.1" width="30" height="30">
<path d="M896.930909 247.156364c-4.421818-5.12-9.076364-9.774545-13.730909-14.196364a225.745455 225.745455 0 0 0-104.727273-56.552727 24.436364 24.436364 0 0 0-4.421818 0 160.349091 160.349091 0 0 0-23.272727-4.189091c-7.912727 0-16.290909-1.396364-24.436364-1.629091a226.210909 226.210909 0 0 0-65.396363 8.610909 232.727273 232.727273 0 0 0-76.8 37.701818 230.632727 230.632727 0 0 0-141.963637-46.545454c-8.378182 0-16.290909 0-23.272727 1.629091a209.454545 209.454545 0 0 0-23.272727 3.956363A230.4 230.4 0 0 0 285.090909 232.727273a156.392727 156.392727 0 0 0-13.498182 14.196363 228.072727 228.072727 0 0 0-57.250909 130.094546 269.730909 269.730909 0 0 0-1.163636 27.694545 252.974545 252.974545 0 0 0 4.421818 46.545455 136.145455 136.145455 0 0 1 71.912727 26.763636 139.636364 139.636364 0 0 1 46.545455-23.272727 128.930909 128.930909 0 0 1 39.098182-5.12 99.141818 99.141818 0 0 1 14.661818 0 72.610909 72.610909 0 0 1 14.196363 2.56 8.145455 8.145455 0 0 1 2.56 0A135.447273 135.447273 0 0 1 468.945455 488.727273c2.792727 2.792727 5.585455 5.585455 8.145454 8.610909a135.912727 135.912727 0 0 1 34.909091 76.567273 132.421818 132.421818 0 0 1 0 16.756363 170.589091 170.589091 0 0 1-10.007273 53.992727 267.636364 267.636364 0 0 1-43.054545 75.17091l-7.68 8.843636c-5.585455 6.749091-11.636364 13.032727-17.687273 19.316364a1156.189091 1156.189091 0 0 0 140.8 94.72 19.781818 19.781818 0 0 0 19.083636 0c12.567273-6.981818 36.770909-21.178182 67.025455-41.425455s60.974545-42.356364 94.952727-69.818182l14.894546-12.8 7.912727-6.981818a778.705455 778.705455 0 0 0 75.636364-76.101818l12.567272-15.127273a436.130909 436.130909 0 0 0 71.912728-125.207273 282.763636 282.763636 0 0 0 15.825454-90.530909 269.032727 269.032727 0 0 0 0-27.694545 229.236364 229.236364 0 0 0-57.250909-129.861818z"
fill="#73B4FF"></path>
<path d="M397.498182 718.196364a801.745455 801.745455 0 0 1-83.316364-83.083637c-4.189091-5.12-8.378182-10.007273-12.334545-15.127272a427.054545 427.054545 0 0 1-72.378182-125.207273 269.963636 269.963636 0 0 1-11.869091-44.218182 127.069091 127.069091 0 0 0-13.265455 0 97.978182 97.978182 0 0 0-14.42909 0 95.185455 95.185455 0 0 0-14.196364 2.327273A137.076364 137.076364 0 0 0 110.312727 488.727273c-2.792727 2.792727-5.585455 5.585455-8.145454 8.610909a135.912727 135.912727 0 0 0-34.210909 77.730909v16.756364a170.356364 170.356364 0 0 0 8.843636 52.82909 269.265455 269.265455 0 0 0 43.52 75.17091l7.447273 8.843636a483.607273 483.607273 0 0 0 50.036363 50.036364l9.076364 7.68a703.534545 703.534545 0 0 0 97.047273 67.025454 12.334545 12.334545 0 0 0 11.403636 0c7.447273-4.421818 23.272727-12.8 40.261818-24.901818a690.036364 690.036364 0 0 0 56.785455-42.123636l9.076363-7.68 4.654546-4.189091c9.541818-8.378182 18.618182-17.454545 27.694545-26.530909l-20.945454-16.989091z"
fill="#87D3FF"></path>
<path d="M459.170909 719.825455a267.636364 267.636364 0 0 0 43.054546-75.17091 170.589091 170.589091 0 0 0 9.774545-53.992727 132.421818 132.421818 0 0 0 0-16.756363 135.912727 135.912727 0 0 0-34.210909-77.73091c-2.56-3.025455-5.352727-5.818182-8.145455-8.610909a135.447273 135.447273 0 0 0-62.836363-33.745454 8.145455 8.145455 0 0 0-2.56 0 72.610909 72.610909 0 0 0-14.196364-2.56 99.141818 99.141818 0 0 0-14.661818 0 128.930909 128.930909 0 0 0-39.098182 5.12 139.636364 139.636364 0 0 0-46.545454 23.272727 136.145455 136.145455 0 0 0-71.912728-26.763636 269.963636 269.963636 0 0 0 11.869091 44.218182A427.054545 427.054545 0 0 0 302.545455 619.985455c3.956364 5.12 8.145455 10.007273 12.334545 15.127272a801.745455 801.745455 0 0 0 83.316364 83.083637l15.36 12.8 20.945454 16.989091c6.050909-6.283636 12.101818-12.567273 17.687273-19.316364z"
fill="#73B4FF"></path>
<path d="M459.170909 719.825455a267.636364 267.636364 0 0 0 43.054546-75.17091 170.589091 170.589091 0 0 0 9.774545-53.992727 132.421818 132.421818 0 0 0 0-16.756363 135.912727 135.912727 0 0 0-34.210909-77.73091c-2.56-3.025455-5.352727-5.818182-8.145455-8.610909a135.447273 135.447273 0 0 0-62.836363-33.745454 8.145455 8.145455 0 0 0-2.56 0 72.610909 72.610909 0 0 0-14.196364-2.56 99.141818 99.141818 0 0 0-14.661818 0 128.930909 128.930909 0 0 0-39.098182 5.12 139.636364 139.636364 0 0 0-46.545454 23.272727 136.145455 136.145455 0 0 0-71.912728-26.763636 269.963636 269.963636 0 0 0 11.869091 44.218182A427.054545 427.054545 0 0 0 302.545455 619.985455c3.956364 5.12 8.145455 10.007273 12.334545 15.127272a801.745455 801.745455 0 0 0 83.316364 83.083637l15.36 12.8 20.945454 16.989091c6.050909-6.283636 12.101818-12.567273 17.687273-19.316364z"
fill="#1474E4"></path>
</svg>
<div>All Likers</div>
</a>
</div>
</li>
{% endfor %}
</ul>
{% endblock %}
Loading…
Cancel
Save