Show More
@@ -343,10 +343,10 b' class Post(models.Model):' | |||||
343 | return str(self.id) + str(self.last_edit_time.microsecond) |
|
343 | return str(self.id) + str(self.last_edit_time.microsecond) | |
344 |
|
344 | |||
345 | def get_sorted_referenced_posts(self): |
|
345 | def get_sorted_referenced_posts(self): | |
346 |
|
|
346 | return self.referenced_posts.order_by('id') | |
347 |
|
347 | |||
348 | def is_referenced(self): |
|
348 | def is_referenced(self): | |
349 |
|
|
349 | return self.referenced_posts.count() > 0 | |
350 |
|
350 | |||
351 |
|
351 | |||
352 | class User(models.Model): |
|
352 | class User(models.Model): |
@@ -40,7 +40,7 b' function showPostPreview(e) {' | |||||
40 |
|
40 | |||
41 | var cln = doc.createElement('div'); |
|
41 | var cln = doc.createElement('div'); | |
42 | cln.id = 'pstprev_' + pNum; |
|
42 | cln.id = 'pstprev_' + pNum; | |
43 |
cln.className = 'post_preview |
|
43 | cln.className = 'post_preview'; | |
44 |
|
44 | |||
45 | cln.style.cssText = 'top:' + y + 'px;' + (x < doc.body.clientWidth/2 ? 'left:' + x + 'px' : 'right:' + parseInt(doc.body.clientWidth - x + 1) + 'px'); |
|
45 | cln.style.cssText = 'top:' + y + 'px;' + (x < doc.body.clientWidth/2 ? 'left:' + x + 'px' : 'right:' + parseInt(doc.body.clientWidth - x + 1) + 'px'); | |
46 |
|
46 | |||
@@ -61,7 +61,7 b' function showPostPreview(e) {' | |||||
61 |
|
61 | |||
62 | //если пост найден в дереве. |
|
62 | //если пост найден в дереве. | |
63 | if($('div[id='+pNum+']').length > 0) { |
|
63 | if($('div[id='+pNum+']').length > 0) { | |
64 | var postdata = $('div[id='+pNum+']').html(); |
|
64 | var postdata = $('div[id='+pNum+']').wrap("<div/>").parent().html(); | |
65 |
|
65 | |||
66 | //TODO: временно |
|
66 | //TODO: временно | |
67 | //funcInit(postdata); |
|
67 | //funcInit(postdata); | |
@@ -76,7 +76,7 b' function showPostPreview(e) {' | |||||
76 | }) |
|
76 | }) | |
77 | .success(function(data) { |
|
77 | .success(function(data) { | |
78 | // TODO get a json, not post itself |
|
78 | // TODO get a json, not post itself | |
79 | var postdata = $(data).html(); |
|
79 | var postdata = $(data).wrap("<div/>").parent().html(); | |
80 |
|
80 | |||
81 | //make preview |
|
81 | //make preview | |
82 | mkPreview(cln, postdata); |
|
82 | mkPreview(cln, postdata); |
@@ -1,4 +1,5 b'' | |||||
1 | {% load i18n %} |
|
1 | {% load i18n %} | |
|
2 | {% load board %} | |||
2 |
|
3 | |||
3 | <div class="post" id="{{ post.id }}"> |
|
4 | <div class="post" id="{{ post.id }}"> | |
4 | {% if post.image %} |
|
5 | {% if post.image %} | |
@@ -33,6 +34,13 b'' | |||||
33 | {% autoescape off %} |
|
34 | {% autoescape off %} | |
34 | {{ post.text.rendered }} |
|
35 | {{ post.text.rendered }} | |
35 | {% endautoescape %} |
|
36 | {% endautoescape %} | |
|
37 | <div class="refmap"> | |||
|
38 | {% trans "Replies" %}: | |||
|
39 | {% for ref_post in post.get_sorted_referenced_posts %} | |||
|
40 | <a href="{% post_url ref_post.id %}">>>{{ ref_post.id }}</a | |||
|
41 | >{% if not forloop.last %},{% endif %} | |||
|
42 | {% endfor %} | |||
|
43 | </div> | |||
36 | </div> |
|
44 | </div> | |
37 | {% if post.tags.exists %} |
|
45 | {% if post.tags.exists %} | |
38 | <div class="metadata"> |
|
46 | <div class="metadata"> |
@@ -68,14 +68,14 b'' | |||||
68 | {{ post.text.rendered }} |
|
68 | {{ post.text.rendered }} | |
69 | {% endautoescape %} |
|
69 | {% endautoescape %} | |
70 | {% if post.is_referenced %} |
|
70 | {% if post.is_referenced %} | |
71 |
|
|
71 | <div class="refmap"> | |
72 |
|
|
72 | {% trans "Replies" %}: | |
73 |
|
|
73 | {% for ref_post in post.get_sorted_referenced_posts %} | |
74 |
|
|
74 | <a href="{% post_url ref_post.id %}">>>{{ ref_post.id }}</a | |
75 | >{% if not forloop.last %},{% endif %} |
|
75 | >{% if not forloop.last %},{% endif %} | |
76 |
|
|
76 | {% endfor %} | |
77 |
|
|
77 | </div> | |
78 |
|
|
78 | {% endif %} | |
79 | </div> |
|
79 | </div> | |
80 | {% if forloop.first %} |
|
80 | {% if forloop.first %} | |
81 | <div class="metadata"> |
|
81 | <div class="metadata"> |
General Comments 0
You need to be logged in to leave comments.
Login now