##// END OF EJS Templates
Updating last_update time if the thread in autoupdate
neko259 -
r536:886da067 default
parent child Browse files
Show More
@@ -55,11 +55,18 b' function updateThread() {'
55 .success(function(data) {
55 .success(function(data) {
56 var bottom = isPageBottom();
56 var bottom = isPageBottom();
57
57
58 var lastUpdate = '';
59
58 var addedPosts = data.added;
60 var addedPosts = data.added;
59 for (var i = 0; i < addedPosts.length; i++) {
61 for (var i = 0; i < addedPosts.length; i++) {
60 var postText = addedPosts[i];
62 var postText = addedPosts[i];
61
63
62 var post = $(postText);
64 var post = $(postText);
65
66 if (lastUpdate === '') {
67 lastUpdate = post.find('.pub_time').text();
68 }
69
63 post.appendTo(lastPost.parent());
70 post.appendTo(lastPost.parent());
64 addRefLinkPreview(post[0]);
71 addRefLinkPreview(post[0]);
65
72
@@ -72,6 +79,11 b' function updateThread() {'
72 var postText = updatedPosts[i];
79 var postText = updatedPosts[i];
73
80
74 var post = $(postText);
81 var post = $(postText);
82
83 if (lastUpdate === '') {
84 lastUpdate = post.find('.pub_time').text();
85 }
86
75 var postId = post.attr('id');
87 var postId = post.attr('id');
76
88
77 var oldPost = $('div.thread').children('.post[id=' + postId + ']');
89 var oldPost = $('div.thread').children('.post[id=' + postId + ']');
@@ -81,7 +93,7 b' function updateThread() {'
81
93
82 blink(post);
94 blink(post);
83 }
95 }
84
96
85 // TODO Process deleted posts
97 // TODO Process deleted posts
86
98
87 lastUpdateTime = data.last_update;
99 lastUpdateTime = data.last_update;
@@ -92,8 +104,11 b' function updateThread() {'
92 $target.animate({scrollTop: $target.height()}, 1000);
104 $target.animate({scrollTop: $target.height()}, 1000);
93 }
105 }
94
106
95 $('#reply-count').text(getReplyCount());
107 var hasPostChanges = (updatedPosts.length > 0)
96 $('#image-count').text(getImageCount());
108 || (addedPosts.length > 0);
109 if (hasPostChanges) {
110 updateMetadataPanel(lastUpdate);
111 }
97
112
98 updateBumplimitProgress(data.added.length);
113 updateBumplimitProgress(data.added.length);
99 updatePostBumpableStatus();
114 updatePostBumpableStatus();
@@ -132,6 +147,23 b' function getImageCount() {'
132 return $('.thread').find('img').length
147 return $('.thread').find('img').length
133 }
148 }
134
149
150 function updateMetadataPanel(lastUpdate) {
151 var replyCountField = $('#reply-count');
152 var imageCountField = $('#image-count');
153
154 replyCountField.text(getReplyCount());
155 imageCountField.text(getImageCount());
156
157 if (lastUpdate !== '') {
158 var lastUpdateField = $('#last-update');
159 lastUpdateField.text(lastUpdate);
160 blink(lastUpdateField);
161 }
162
163 blink(replyCountField);
164 blink(imageCountField);
165 }
166
135 /**
167 /**
136 * Update bumplimit progress bar
168 * Update bumplimit progress bar
137 */
169 */
@@ -158,12 +190,10 b' function updateBumplimitProgress(postDel'
158 * If the bumplimit is reached, add dead_post class to all posts
190 * If the bumplimit is reached, add dead_post class to all posts
159 */
191 */
160 function updatePostBumpableStatus() {
192 function updatePostBumpableStatus() {
161 var postCount = getReplyCount();
162 var postsToLimitElement = $('#left_to_limit');
193 var postsToLimitElement = $('#left_to_limit');
163 var postsToLimit = parseInt(postsToLimitElement.text());
164
194
165 if (postsToLimit <= 0) {
195 if (postsToLimitElement === null) {
166 $('.thread').find('.post').addClass('dead_post');
196 $('.thread').children('.post').addClass('dead_post');
167 }
197 }
168 }
198 }
169
199
@@ -227,10 +257,9 b' function resetForm(form) {'
227 } else {
257 } else {
228 var errors = json.errors;
258 var errors = json.errors;
229 for (var i = 0; i < errors.length; i++) {
259 for (var i = 0; i < errors.length; i++) {
230 var error = errors[i];
260 var fieldErrors = errors[i];
231
261
232 var fieldName = error.field;
262 var error = fieldErrors.errors;
233 var error = error.errors;
234
263
235 var errorList = $('<div class="form-errors">' + error
264 var errorList = $('<div class="form-errors">' + error
236 + '<div>');
265 + '<div>');
@@ -28,8 +28,8 b''
28 <div class="post-info">
28 <div class="post-info">
29 <span class="title">{{ post.title }}</span>
29 <span class="title">{{ post.title }}</span>
30 <a class="post_id" href="{% post_url post.id %}">
30 <a class="post_id" href="{% post_url post.id %}">
31 ({{ post.id }})</a>
31 ({{ post.id }}) </a>
32 [{{ post.pub_time }}]
32 [<span class="pub_time">{{ post.pub_time }}</span>]
33 [<a href="#" onclick="javascript:addQuickReply('{{ post.id }}')
33 [<a href="#" onclick="javascript:addQuickReply('{{ post.id }}')
34 ; return false;">&gt;&gt;</a>]
34 ; return false;">&gt;&gt;</a>]
35
35
@@ -56,8 +56,8 b''
56 <div class="post-info">
56 <div class="post-info">
57 <span class="title">{{ post.title }}</span>
57 <span class="title">{{ post.title }}</span>
58 <a class="post_id" href="#{{ post.id }}">
58 <a class="post_id" href="#{{ post.id }}">
59 ({{ post.id }})</a>
59 ({{ post.id }}) </a>
60 [{{ post.pub_time }}]
60 [<span class="pub_time">{{ post.pub_time }}</span>]
61 {% if not thread.archived %}
61 {% if not thread.archived %}
62 [<a href="#" onclick="javascript:addQuickReply('{{ post.id }}')
62 [<a href="#" onclick="javascript:addQuickReply('{{ post.id }}')
63 ; return false;">&gt;&gt;</a>]
63 ; return false;">&gt;&gt;</a>]
@@ -137,7 +137,7 b''
137 {% cache 600 thread_meta thread.last_edit_time moderator LANGUAGE_CODE %}
137 {% cache 600 thread_meta thread.last_edit_time moderator LANGUAGE_CODE %}
138 <span id="reply-count">{{ thread.get_reply_count }}</span> {% trans 'replies' %},
138 <span id="reply-count">{{ thread.get_reply_count }}</span> {% trans 'replies' %},
139 <span id="image-count">{{ thread.get_images_count }}</span> {% trans 'images' %}.
139 <span id="image-count">{{ thread.get_images_count }}</span> {% trans 'images' %}.
140 {% trans 'Last update: ' %}{{ thread.last_edit_time }}
140 {% trans 'Last update: ' %}<span id="last-update">{{ thread.last_edit_time }}</span>
141 [<a href="rss/">RSS</a>]
141 [<a href="rss/">RSS</a>]
142 {% endcache %}
142 {% endcache %}
143 </span>
143 </span>
@@ -1,19 +1,4 b''
1 = Features =
1 = Features =
2 [DONE] Connecting tags to each other
3 [DONE] Connect posts to the replies (in messages), get rid of the JS reply map
4 [DONE] Better django admin pages to simplify admin operations
5 [DONE] Regen script to update all posts
6 [DONE] Remove jump links from refmaps
7 [DONE] Ban reasons. Split bans into 2 types "read-only" and "read
8 denied". Use second only for autoban for spam
9 [DONE] Clean up tests and make them run ALWAYS
10 [DONE] Use transactions in tests
11 [DONE] Thread autoupdate (JS + API)
12 [DONE] Split up post model into post and thread,
13 and move everything that is used only in 1st post to thread model.
14 [DONE] Show board speed in the lower panel (posts per day)
15 [DONE] Save image thumbnails size to the separate field
16
17 [NOT STARTED] Tree view (JS)
2 [NOT STARTED] Tree view (JS)
18 [NOT STARTED] Adding tags to images filename
3 [NOT STARTED] Adding tags to images filename
19 [NOT STARTED] Federative network for s2s communication
4 [NOT STARTED] Federative network for s2s communication
@@ -32,15 +17,9 b' post or its part (delimited by N charact'
32 [NOT STARTED] Post deletion confirmation page
17 [NOT STARTED] Post deletion confirmation page
33 [NOT STARTED] Moderating page. Tags editing and adding
18 [NOT STARTED] Moderating page. Tags editing and adding
34 [NOT STARTED] Get thread graph image using pygraphviz
19 [NOT STARTED] Get thread graph image using pygraphviz
35 [NOT STARTED] Creating post via AJAX without reloading page
36 [NOT STARTED] Subscribing to tag via AJAX
20 [NOT STARTED] Subscribing to tag via AJAX
37
21
38 = Bugs =
22 = Bugs =
39 [DONE] Fix bug with creating threads from tag view
40 [DONE] Quote characters within quote causes quote parsing to fail
41
42 [IN PROGRESS] Replies, images, last update time in bottom panel doesn't change when
43 thread updates (last update changing left)
44
23
45 = Testing =
24 = Testing =
46 [NOT STARTED] Make tests for every view
25 [NOT STARTED] Make tests for every view
General Comments 0
You need to be logged in to leave comments. Login now