add-index-page-caching

merge-requests/2/head
王宇洋 3 years ago
commit 1de65edefd

@ -6,18 +6,18 @@
<div class="post-content">
<h3 class="post-title">
<a href="{{ url_for('.post', id=post.question.id) }}">{{ post.question.title }}</a>
<a href="{{ url_for('.view_question', question_id=post.question.id) }}">{{ post.question.title }}</a>
</h3>
<div class="post-body">
<p>
{% if post.question.body_html %}
{{ post.question.body_html |safe|striptags|truncate(260,killwords=Flase,leeway=0) }}
{% else %}
{{ post.question.body |truncate(200,killwords=Flase,leeway=0)}}
{% endif %}
<small><a href="{{ url_for('.post', id=post.question.id) }}"><B>Read More</B></a></small>
</p>
</div>
{# <div class="post-body">#}
{# <p>#}
{# {% if post.question.body_html %}#}
{# {{ post.question.body_html |safe|striptags|truncate(260,killwords=Flase,leeway=0) }}#}
{# {% else %}#}
{# {{ post.question.body |truncate(200,killwords=Flase,leeway=0)}}#}
{# {% endif %}#}
{# <small><a href="{{ url_for('.post', id=post.question.id) }}"><B>Read More</B></a></small>#}
{# </p>#}
{# </div>#}
<div class="post-footer">
<span class="post-date">
<span class="glyphicon glyphicon-time"></span>

@ -125,7 +125,46 @@
<div class="tabbable">
<ul class="nav post-nav">
<li id="btn-1">
<a href="{{ url_for('.save_question', question_id=question.id ) }}" class="glyphicon glyphicon-bookmark"> Follow</a>
<a class="glyphicon glyphicon-bookmark" href="javascript:void (0);" onclick="{
var csrftoken = $('meta[name=csrf-token]').attr('content');
var _this=this;
{#console.log(this.childNodes[3]);#}
{#console.log(this.childElementCount);#}
var sendData={
'csrf_token':csrftoken
};
$.ajax({
url: '{{ url_for('.AJAXsave_question', question_id=question_id) }}',
type: 'POST',
{#dataType: 'json',#}
{#contentType: 'application/json',#}
{#data: JSON.stringify(sendData),#}
success: function(result) {
console.log('success\n'+result);
if(result.like){
_this.innerText=' Unfollow'
}else{
_this.innerText=' Follow'
}
{#span1.setAttribute('href', '{{ url_for('.dislike', post_id=post.id) }}');#}
},
error:function(msg){
console.log(msg);
if(msg.status===403){
window.location.href='{{ url_for('auth.login') }}'
}
}
})
}">
{% if not current_user.is_savingquestion(question) %}
Follow
{% else %}
Unfollow
{% endif %}
</a>
</li>
<li id="btn-2">
<a href="{{ url_for('.new_answer_md',question_id=question_id )}}" class="glyphicon glyphicon-pencil">

Loading…
Cancel
Save