##// END OF EJS Templates
Added settings to limit posting speed. Added message when the form data is sent and response not yet received
neko259 -
r725:ce7b9618 default
parent child Browse files
Show More
@@ -193,7 +193,8 b' class PostForm(NeboardForm):'
193 else:
193 else:
194 posting_delay = settings.POSTING_DELAY
194 posting_delay = settings.POSTING_DELAY
195
195
196 if LAST_POST_TIME in self.session:
196 if board_settings.LIMIT_POSTING_SPEED and LAST_POST_TIME in \
197 self.session:
197 now = time.time()
198 now = time.time()
198 last_post_time = self.session[LAST_POST_TIME]
199 last_post_time = self.session[LAST_POST_TIME]
199
200
1 NO CONTENT: modified file, binary diff hidden
NO CONTENT: modified file, binary diff hidden
@@ -8,7 +8,7 b' msgid ""'
8 msgstr ""
8 msgstr ""
9 "Project-Id-Version: PACKAGE VERSION\n"
9 "Project-Id-Version: PACKAGE VERSION\n"
10 "Report-Msgid-Bugs-To: \n"
10 "Report-Msgid-Bugs-To: \n"
11 "POT-Creation-Date: 2013-12-21 21:45+0200\n"
11 "POT-Creation-Date: 2014-07-02 13:26+0300\n"
12 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
12 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
13 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14 "Language-Team: LANGUAGE <LL@li.org>\n"
14 "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -19,25 +19,14 b' msgstr ""'
19 "Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n"
19 "Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n"
20 "%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n"
20 "%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n"
21
21
22 #: static/js/refpopup.js:57
22 #: static/js/refpopup.js:58
23 msgid "Loading..."
23 msgid "Loading..."
24 msgstr "Π—Π°Π³Ρ€ΡƒΠ·ΠΊΠ°..."
24 msgstr "Π—Π°Π³Ρ€ΡƒΠ·ΠΊΠ°..."
25
25
26 #: static/js/refpopup.js:76
26 #: static/js/refpopup.js:77
27 msgid "Post not found"
27 msgid "Post not found"
28 msgstr "Π‘ΠΎΠΎΠ±Ρ‰Π΅Π½ΠΈΠ΅ Π½Π΅ Π½Π°ΠΉΠ΄Π΅Π½ΠΎ"
28 msgstr "Π‘ΠΎΠΎΠ±Ρ‰Π΅Π½ΠΈΠ΅ Π½Π΅ Π½Π°ΠΉΠ΄Π΅Π½ΠΎ"
29
29
30 #: static/js/thread.js:32
30 #: static/js/thread_update.js:279
31 msgid "Normal"
31 msgid "Sending message..."
32 msgstr "ΠΠΎΡ€ΠΌΠ°Π»ΡŒΠ½Ρ‹ΠΉ"
32 msgstr "ΠžΡ‚ΠΏΡ€Π°Π²ΠΊΠ° сообщСния..." No newline at end of file
33
34 #: static/js/thread.js:33
35 msgid "Gallery"
36 msgstr "ГалСрСя"
37
38 #: static/js/thread_update.js:177
39 msgid "[new posts]"
40 msgstr "[Π½ΠΎΠ²Ρ‹Π΅ посты]"
41
42 #~ msgid "Replies"
43 #~ msgstr "ΠžΡ‚Π²Π΅Ρ‚Ρ‹"
@@ -15,4 +15,6 b" DEFAULT_THEME = 'md'"
15 LAST_REPLIES_COUNT = 3
15 LAST_REPLIES_COUNT = 3
16
16
17 # Enable archiving threads instead of deletion when the thread limit is reached
17 # Enable archiving threads instead of deletion when the thread limit is reached
18 ARCHIVE_THREADS = True No newline at end of file
18 ARCHIVE_THREADS = True
19 # Limit posting speed
20 LIMIT_POSTING_SPEED = False No newline at end of file
@@ -27,7 +27,7 b' var THREAD_UPDATE_DELAY = 10000;'
27
27
28 var loading = false;
28 var loading = false;
29 var lastUpdateTime = null;
29 var lastUpdateTime = null;
30 var unreadPosts = 0
30 var unreadPosts = 0;
31
31
32 function blink(node) {
32 function blink(node) {
33 var blinkCount = 2;
33 var blinkCount = 2;
@@ -226,7 +226,7 b' function updateOnPost(response, statusTe'
226 var json = $.parseJSON(response);
226 var json = $.parseJSON(response);
227 var status = json.status;
227 var status = json.status;
228
228
229 form.children('.form-errors').remove();
229 showAsErrors(form, '');
230
230
231 if (status === 'ok') {
231 if (status === 'ok') {
232 resetForm(form);
232 resetForm(form);
@@ -238,14 +238,27 b' function updateOnPost(response, statusTe'
238
238
239 var error = fieldErrors.errors;
239 var error = fieldErrors.errors;
240
240
241 var errorList = $('<div class="form-errors">' + error
241 showAsErrors(form, error);
242 + '<div>');
243 errorList.appendTo(form);
244 }
242 }
245 }
243 }
246 }
244 }
247
245
248 /**
246 /**
247 * Show text in the errors row of the form.
248 * @param form
249 * @param text
250 */
251 function showAsErrors(form, text) {
252 form.children('.form-errors').remove();
253
254 if (text.length > 0) {
255 var errorList = $('<div class="form-errors">' + text
256 + '<div>');
257 errorList.appendTo(form);
258 }
259 }
260
261 /**
249 * Run js methods that are usually run on the document, on the new post
262 * Run js methods that are usually run on the document, on the new post
250 */
263 */
251 function processNewPost(post) {
264 function processNewPost(post) {
@@ -257,11 +270,14 b' function processNewPost(post) {'
257 initAutoupdate();
270 initAutoupdate();
258
271
259 // Post form data over AJAX
272 // Post form data over AJAX
260 var threadId = $('div.thread').children('.post').first().attr('id');;
273 var threadId = $('div.thread').children('.post').first().attr('id');
261
274
262 var form = $('#form');
275 var form = $('#form');
263
276
264 var options = {
277 var options = {
278 beforeSubmit: function(arr, $form, options) {
279 showAsErrors($('form'), gettext('Sending message...'));
280 },
265 success: updateOnPost,
281 success: updateOnPost,
266 url: '/api/add_post/' + threadId + '/'
282 url: '/api/add_post/' + threadId + '/'
267 };
283 };
General Comments 0
You need to be logged in to leave comments. Login now