##// END OF EJS Templates
Truncate posts in reflink popups
neko259 -
r368:39307834 thread_autoupdate
parent child Browse files
Show More
@@ -57,7 +57,7 b' function showPostPreview(e) {'
57 57 };
58 58
59 59
60 cln.innerHTML = gettext('Loading...');
60 cln.innerHTML = "<div class=\"post\">" + gettext('Loading...') + "</div>";
61 61
62 62 //если пост найден в дереве.
63 63 if($('div[id='+pNum+']').length > 0) {
@@ -72,7 +72,7 b' function showPostPreview(e) {'
72 72 //ajax api
73 73 else {
74 74 $.ajax({
75 url: '/api/post/' + pNum + '/'
75 url: '/api/post/' + pNum + '/?truncated'
76 76 })
77 77 .success(function(data) {
78 78 // TODO get a json, not post itself
@@ -83,7 +83,8 b' function showPostPreview(e) {'
83 83
84 84 })
85 85 .error(function() {
86 cln.innerHTML = gettext('Post not found');
86 cln.innerHTML = "<div class=\"post\">"
87 + gettext('Post not found') + "</div>";
87 88 });
88 89 }
89 90
@@ -39,7 +39,11 b''
39 39 {% endif %}
40 40 </div>
41 41 {% autoescape off %}
42 {{ post.text.rendered }}
42 {% if truncated %}
43 {{ post.text.rendered|truncatewords_html:50 }}
44 {% else %}
45 {{ post.text.rendered }}
46 {% endif %}
43 47 {% endautoescape %}
44 48 {% if post.is_referenced %}
45 49 <div class="refmap">
@@ -449,6 +449,8 b' def get_post(request, post_id):'
449 449 context = RequestContext(request)
450 450 context["post"] = post
451 451 context["can_bump"] = thread.can_bump()
452 if "truncated" in request.GET:
453 context["truncated"] = True
452 454
453 455 return render(request, 'boards/post.html', context)
454 456
General Comments 0
You need to be logged in to leave comments. Login now