diff --git a/boards/static/js/refpopup.js b/boards/static/js/refpopup.js
--- a/boards/static/js/refpopup.js
+++ b/boards/static/js/refpopup.js
@@ -57,7 +57,7 @@ function showPostPreview(e) {
};
- cln.innerHTML = gettext('Loading...');
+ cln.innerHTML = "
" + gettext('Loading...') + "
";
//если пост найден в дереве.
if($('div[id='+pNum+']').length > 0) {
@@ -72,7 +72,7 @@ function showPostPreview(e) {
//ajax api
else {
$.ajax({
- url: '/api/post/' + pNum + '/'
+ url: '/api/post/' + pNum + '/?truncated'
})
.success(function(data) {
// TODO get a json, not post itself
@@ -83,7 +83,8 @@ function showPostPreview(e) {
})
.error(function() {
- cln.innerHTML = gettext('Post not found');
+ cln.innerHTML = ""
+ + gettext('Post not found') + "
";
});
}
diff --git a/boards/templates/boards/post.html b/boards/templates/boards/post.html
--- a/boards/templates/boards/post.html
+++ b/boards/templates/boards/post.html
@@ -39,7 +39,11 @@
{% endif %}
{% autoescape off %}
- {{ post.text.rendered }}
+ {% if truncated %}
+ {{ post.text.rendered|truncatewords_html:50 }}
+ {% else %}
+ {{ post.text.rendered }}
+ {% endif %}
{% endautoescape %}
{% if post.is_referenced %}
diff --git a/boards/views.py b/boards/views.py
--- a/boards/views.py
+++ b/boards/views.py
@@ -449,6 +449,8 @@ def get_post(request, post_id):
context = RequestContext(request)
context["post"] = post
context["can_bump"] = thread.can_bump()
+ if "truncated" in request.GET:
+ context["truncated"] = True
return render(request, 'boards/post.html', context)