Show More
@@ -1,5 +1,6 b'' | |||||
1 | import re |
|
1 | import re | |
2 | import time |
|
2 | import time | |
|
3 | import pytz | |||
3 |
|
4 | |||
4 | from django import forms |
|
5 | from django import forms | |
5 | from django.core.files.uploadedfile import SimpleUploadedFile |
|
6 | from django.core.files.uploadedfile import SimpleUploadedFile | |
@@ -47,6 +48,13 b' HTTP_RESULT_OK = 200' | |||||
47 | TEXTAREA_ROWS = 4 |
|
48 | TEXTAREA_ROWS = 4 | |
48 |
|
49 | |||
49 |
|
50 | |||
|
51 | def get_timezones(): | |||
|
52 | timezones = [] | |||
|
53 | for tz in pytz.common_timezones: | |||
|
54 | timezones.append((tz, tz),) | |||
|
55 | return timezones | |||
|
56 | ||||
|
57 | ||||
50 | class FormatPanel(forms.Textarea): |
|
58 | class FormatPanel(forms.Textarea): | |
51 | """ |
|
59 | """ | |
52 | Panel for text formatting. Consists of buttons to add different tags to the |
|
60 | Panel for text formatting. Consists of buttons to add different tags to the | |
@@ -321,9 +329,9 b' class ThreadForm(PostForm):' | |||||
321 |
|
329 | |||
322 | class SettingsForm(NeboardForm): |
|
330 | class SettingsForm(NeboardForm): | |
323 |
|
331 | |||
324 | theme = forms.ChoiceField(choices=settings.THEMES, |
|
332 | theme = forms.ChoiceField(choices=settings.THEMES, label=_('Theme')) | |
325 | label=_('Theme')) |
|
|||
326 | username = forms.CharField(label=_('User name'), required=False) |
|
333 | username = forms.CharField(label=_('User name'), required=False) | |
|
334 | timezone = forms.ChoiceField(choices=get_timezones(), label=_('Time zone')) | |||
327 |
|
335 | |||
328 | def clean_username(self): |
|
336 | def clean_username(self): | |
329 | username = self.cleaned_data['username'] |
|
337 | username = self.cleaned_data['username'] |
1 | NO CONTENT: modified file, binary diff hidden |
|
NO CONTENT: modified file, binary diff hidden |
@@ -7,7 +7,7 b' msgid ""' | |||||
7 | msgstr "" |
|
7 | msgstr "" | |
8 | "Project-Id-Version: PACKAGE VERSION\n" |
|
8 | "Project-Id-Version: PACKAGE VERSION\n" | |
9 | "Report-Msgid-Bugs-To: \n" |
|
9 | "Report-Msgid-Bugs-To: \n" | |
10 |
"POT-Creation-Date: 2015-03- |
|
10 | "POT-Creation-Date: 2015-03-30 18:42+0300\n" | |
11 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" |
|
11 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" | |
12 | "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" |
|
12 | "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" | |
13 | "Language-Team: LANGUAGE <LL@li.org>\n" |
|
13 | "Language-Team: LANGUAGE <LL@li.org>\n" | |
@@ -38,93 +38,97 b' msgstr "\xd1\x80\xd0\xb0\xd0\xb7\xd1\x80\xd0\xb0\xd0\xb1\xd0\xbe\xd1\x82\xd1\x87\xd0\xb8\xd0\xba javascript"' | |||||
38 | msgid "designer" |
|
38 | msgid "designer" | |
39 | msgstr "дизайнер" |
|
39 | msgstr "дизайнер" | |
40 |
|
40 | |||
41 |
#: forms.py:3 |
|
41 | #: forms.py:34 | |
42 | msgid "Type message here. Use formatting panel for more advanced usage." |
|
42 | msgid "Type message here. Use formatting panel for more advanced usage." | |
43 | msgstr "" |
|
43 | msgstr "" | |
44 | "Вводите сообщение сюда. Используйте панель для более сложного форматирования." |
|
44 | "Вводите сообщение сюда. Используйте панель для более сложного форматирования." | |
45 |
|
45 | |||
46 |
#: forms.py:3 |
|
46 | #: forms.py:35 | |
47 | msgid "tag1 several_words_tag" |
|
47 | msgid "tag1 several_words_tag" | |
48 | msgstr "метка1 метка_из_нескольких_слов" |
|
48 | msgstr "метка1 метка_из_нескольких_слов" | |
49 |
|
49 | |||
50 |
#: forms.py:3 |
|
50 | #: forms.py:37 | |
51 | msgid "Title" |
|
51 | msgid "Title" | |
52 | msgstr "Заголовок" |
|
52 | msgstr "Заголовок" | |
53 |
|
53 | |||
54 |
#: forms.py:3 |
|
54 | #: forms.py:38 | |
55 | msgid "Text" |
|
55 | msgid "Text" | |
56 | msgstr "Текст" |
|
56 | msgstr "Текст" | |
57 |
|
57 | |||
58 |
#: forms.py:3 |
|
58 | #: forms.py:39 | |
59 | msgid "Tag" |
|
59 | msgid "Tag" | |
60 | msgstr "Метка" |
|
60 | msgstr "Метка" | |
61 |
|
61 | |||
62 |
#: forms.py: |
|
62 | #: forms.py:40 templates/boards/base.html:36 templates/search/search.html:13 | |
63 | #: templates/search/search.html.py:17 |
|
63 | #: templates/search/search.html.py:17 | |
64 | msgid "Search" |
|
64 | msgid "Search" | |
65 | msgstr "Поиск" |
|
65 | msgstr "Поиск" | |
66 |
|
66 | |||
67 |
#: forms.py:13 |
|
67 | #: forms.py:139 | |
68 | msgid "Image" |
|
68 | msgid "Image" | |
69 | msgstr "Изображение" |
|
69 | msgstr "Изображение" | |
70 |
|
70 | |||
71 |
#: forms.py:1 |
|
71 | #: forms.py:142 | |
72 | msgid "Image URL" |
|
72 | msgid "Image URL" | |
73 | msgstr "URL изображения" |
|
73 | msgstr "URL изображения" | |
74 |
|
74 | |||
75 |
#: forms.py:14 |
|
75 | #: forms.py:148 | |
76 | msgid "e-mail" |
|
76 | msgid "e-mail" | |
77 | msgstr "" |
|
77 | msgstr "" | |
78 |
|
78 | |||
79 |
#: forms.py:15 |
|
79 | #: forms.py:159 | |
80 | #, python-format |
|
80 | #, python-format | |
81 | msgid "Title must have less than %s characters" |
|
81 | msgid "Title must have less than %s characters" | |
82 | msgstr "Заголовок должен иметь меньше %s символов" |
|
82 | msgstr "Заголовок должен иметь меньше %s символов" | |
83 |
|
83 | |||
84 |
#: forms.py:16 |
|
84 | #: forms.py:168 | |
85 | #, python-format |
|
85 | #, python-format | |
86 | msgid "Text must have less than %s characters" |
|
86 | msgid "Text must have less than %s characters" | |
87 | msgstr "Текст должен быть короче %s символов" |
|
87 | msgstr "Текст должен быть короче %s символов" | |
88 |
|
88 | |||
89 |
#: forms.py:1 |
|
89 | #: forms.py:190 | |
90 | msgid "Invalid URL" |
|
90 | msgid "Invalid URL" | |
91 | msgstr "Неверный URL" |
|
91 | msgstr "Неверный URL" | |
92 |
|
92 | |||
93 |
#: forms.py:2 |
|
93 | #: forms.py:227 | |
94 | msgid "Either text or image must be entered." |
|
94 | msgid "Either text or image must be entered." | |
95 | msgstr "Текст или картинка должны быть введены." |
|
95 | msgstr "Текст или картинка должны быть введены." | |
96 |
|
96 | |||
97 |
#: forms.py:23 |
|
97 | #: forms.py:243 | |
98 | #, python-format |
|
98 | #, python-format | |
99 | msgid "Wait %s seconds after last posting" |
|
99 | msgid "Wait %s seconds after last posting" | |
100 | msgstr "Подождите %s секунд после последнего постинга" |
|
100 | msgstr "Подождите %s секунд после последнего постинга" | |
101 |
|
101 | |||
102 |
#: forms.py:2 |
|
102 | #: forms.py:255 | |
103 | #, python-format |
|
103 | #, python-format | |
104 | msgid "Image must be less than %s bytes" |
|
104 | msgid "Image must be less than %s bytes" | |
105 | msgstr "Изображение должно быть менее %s байт" |
|
105 | msgstr "Изображение должно быть менее %s байт" | |
106 |
|
106 | |||
107 |
#: forms.py:2 |
|
107 | #: forms.py:302 templates/boards/rss/post.html:10 templates/boards/tags.html:7 | |
108 | msgid "Tags" |
|
108 | msgid "Tags" | |
109 | msgstr "Метки" |
|
109 | msgstr "Метки" | |
110 |
|
110 | |||
111 |
#: forms.py:30 |
|
111 | #: forms.py:309 | |
112 | msgid "Inappropriate characters in tags." |
|
112 | msgid "Inappropriate characters in tags." | |
113 | msgstr "Недопустимые символы в метках." |
|
113 | msgstr "Недопустимые символы в метках." | |
114 |
|
114 | |||
115 |
#: forms.py:3 |
|
115 | #: forms.py:320 | |
116 | msgid "Need at least 1 required tag." |
|
116 | msgid "Need at least 1 required tag." | |
117 | msgstr "Нужна хотя бы 1 обязательная метка." |
|
117 | msgstr "Нужна хотя бы 1 обязательная метка." | |
118 |
|
118 | |||
119 |
#: forms.py:32 |
|
119 | #: forms.py:332 | |
120 | msgid "Theme" |
|
120 | msgid "Theme" | |
121 | msgstr "Тема" |
|
121 | msgstr "Тема" | |
122 |
|
122 | |||
123 |
#: forms.py:3 |
|
123 | #: forms.py:333 | |
124 | msgid "User name" |
|
124 | msgid "User name" | |
125 | msgstr "Имя пользователя" |
|
125 | msgstr "Имя пользователя" | |
126 |
|
126 | |||
127 |
#: forms.py:33 |
|
127 | #: forms.py:334 | |
|
128 | msgid "Time zone" | |||
|
129 | msgstr "Часовой пояс" | |||
|
130 | ||||
|
131 | #: forms.py:340 | |||
128 | msgid "Inappropriate characters." |
|
132 | msgid "Inappropriate characters." | |
129 | msgstr "Недопустимые символы." |
|
133 | msgstr "Недопустимые символы." | |
130 |
|
134 | |||
@@ -169,7 +173,7 b' msgstr "\xd0\xa3\xd0\xbf\xd1\x80\xd0\xb0\xd0\xb2\xd0\xbb\xd0\xb5\xd0\xbd\xd0\xb8\xd0\xb5 \xd0\xbc\xd0\xb5\xd1\x82\xd0\xba\xd0\xb0\xd0\xbc\xd0\xb8"' | |||||
169 | msgid "Notifications" |
|
173 | msgid "Notifications" | |
170 | msgstr "Уведомления" |
|
174 | msgstr "Уведомления" | |
171 |
|
175 | |||
172 |
#: templates/boards/base.html:47 templates/boards/settings.html: |
|
176 | #: templates/boards/base.html:47 templates/boards/settings.html:9 | |
173 | msgid "Settings" |
|
177 | msgid "Settings" | |
174 | msgstr "Настройки" |
|
178 | msgstr "Настройки" | |
175 |
|
179 | |||
@@ -187,12 +191,12 b' msgid "Up"' | |||||
187 | msgstr "Вверх" |
|
191 | msgstr "Вверх" | |
188 |
|
192 | |||
189 | #: templates/boards/notifications.html:17 |
|
193 | #: templates/boards/notifications.html:17 | |
190 |
#: templates/boards/posting_general.html: |
|
194 | #: templates/boards/posting_general.html:81 templates/search/search.html:26 | |
191 | msgid "Previous page" |
|
195 | msgid "Previous page" | |
192 | msgstr "Предыдущая страница" |
|
196 | msgstr "Предыдущая страница" | |
193 |
|
197 | |||
194 | #: templates/boards/notifications.html:27 |
|
198 | #: templates/boards/notifications.html:27 | |
195 |
#: templates/boards/posting_general.html:11 |
|
199 | #: templates/boards/posting_general.html:121 templates/search/search.html:37 | |
196 | msgid "Next page" |
|
200 | msgid "Next page" | |
197 | msgstr "Следующая страница" |
|
201 | msgstr "Следующая страница" | |
198 |
|
202 | |||
@@ -216,52 +220,52 b' msgstr "\xd0\x98\xd0\xb7\xd0\xbc\xd0\xb5\xd0\xbd\xd0\xb8\xd1\x82\xd1\x8c \xd1\x82\xd0\xb5\xd0\xbc\xd1\x83"' | |||||
216 | msgid "Replies" |
|
220 | msgid "Replies" | |
217 | msgstr "Ответы" |
|
221 | msgstr "Ответы" | |
218 |
|
222 | |||
219 |
#: templates/boards/post.html:86 templates/boards/thread.html: |
|
223 | #: templates/boards/post.html:86 templates/boards/thread.html:30 | |
220 | msgid "messages" |
|
224 | msgid "messages" | |
221 | msgstr "сообщений" |
|
225 | msgstr "сообщений" | |
222 |
|
226 | |||
223 |
#: templates/boards/post.html:87 templates/boards/thread.html: |
|
227 | #: templates/boards/post.html:87 templates/boards/thread.html:31 | |
224 | msgid "images" |
|
228 | msgid "images" | |
225 | msgstr "изображений" |
|
229 | msgstr "изображений" | |
226 |
|
230 | |||
227 |
#: templates/boards/posting_general.html:6 |
|
231 | #: templates/boards/posting_general.html:65 | |
228 | msgid "Edit tag" |
|
232 | msgid "Edit tag" | |
229 | msgstr "Изменить метку" |
|
233 | msgstr "Изменить метку" | |
230 |
|
234 | |||
231 |
#: templates/boards/posting_general.html:6 |
|
235 | #: templates/boards/posting_general.html:68 | |
232 | #, python-format |
|
236 | #, python-format | |
233 | msgid "This tag has %(thread_count)s threads and %(post_count)s posts." |
|
237 | msgid "This tag has %(thread_count)s threads and %(post_count)s posts." | |
234 | msgstr "С этой меткой есть %(thread_count)s тем и %(post_count)s сообщений." |
|
238 | msgstr "С этой меткой есть %(thread_count)s тем и %(post_count)s сообщений." | |
235 |
|
239 | |||
236 |
#: templates/boards/posting_general.html:9 |
|
240 | #: templates/boards/posting_general.html:96 | |
237 | #, python-format |
|
241 | #, python-format | |
238 | msgid "Skipped %(count)s replies. Open thread to see all replies." |
|
242 | msgid "Skipped %(count)s replies. Open thread to see all replies." | |
239 | msgstr "Пропущено %(count)s ответов. Откройте тред, чтобы увидеть все ответы." |
|
243 | msgstr "Пропущено %(count)s ответов. Откройте тред, чтобы увидеть все ответы." | |
240 |
|
244 | |||
241 |
#: templates/boards/posting_general.html:12 |
|
245 | #: templates/boards/posting_general.html:126 | |
242 | msgid "No threads exist. Create the first one!" |
|
246 | msgid "No threads exist. Create the first one!" | |
243 | msgstr "Нет тем. Создайте первую!" |
|
247 | msgstr "Нет тем. Создайте первую!" | |
244 |
|
248 | |||
245 |
#: templates/boards/posting_general.html:13 |
|
249 | #: templates/boards/posting_general.html:132 | |
246 | msgid "Create new thread" |
|
250 | msgid "Create new thread" | |
247 | msgstr "Создать новую тему" |
|
251 | msgstr "Создать новую тему" | |
248 |
|
252 | |||
249 |
#: templates/boards/posting_general.html:13 |
|
253 | #: templates/boards/posting_general.html:137 templates/boards/preview.html:16 | |
250 |
#: templates/boards/thread_normal.html:4 |
|
254 | #: templates/boards/thread_normal.html:46 | |
251 | msgid "Post" |
|
255 | msgid "Post" | |
252 | msgstr "Отправить" |
|
256 | msgstr "Отправить" | |
253 |
|
257 | |||
254 |
#: templates/boards/posting_general.html:14 |
|
258 | #: templates/boards/posting_general.html:143 | |
255 | msgid "Tags must be delimited by spaces. Text or image is required." |
|
259 | msgid "Tags must be delimited by spaces. Text or image is required." | |
256 | msgstr "" |
|
260 | msgstr "" | |
257 | "Метки должны быть разделены пробелами. Текст или изображение обязательны." |
|
261 | "Метки должны быть разделены пробелами. Текст или изображение обязательны." | |
258 |
|
262 | |||
259 |
#: templates/boards/posting_general.html:14 |
|
263 | #: templates/boards/posting_general.html:146 | |
260 |
#: templates/boards/thread_normal.html:5 |
|
264 | #: templates/boards/thread_normal.html:51 | |
261 | msgid "Text syntax" |
|
265 | msgid "Text syntax" | |
262 | msgstr "Синтаксис текста" |
|
266 | msgstr "Синтаксис текста" | |
263 |
|
267 | |||
264 |
#: templates/boards/posting_general.html:15 |
|
268 | #: templates/boards/posting_general.html:158 | |
265 | msgid "Pages:" |
|
269 | msgid "Pages:" | |
266 | msgstr "Страницы: " |
|
270 | msgstr "Страницы: " | |
267 |
|
271 | |||
@@ -273,19 +277,19 b' msgstr "\xd0\x9f\xd1\x80\xd0\xb5\xd0\xb4\xd0\xbf\xd1\x80\xd0\xbe\xd1\x81\xd0\xbc\xd0\xbe\xd1\x82\xd1\x80"' | |||||
273 | msgid "Post image" |
|
277 | msgid "Post image" | |
274 | msgstr "Изображение сообщения" |
|
278 | msgstr "Изображение сообщения" | |
275 |
|
279 | |||
276 |
#: templates/boards/settings.html:1 |
|
280 | #: templates/boards/settings.html:17 | |
277 | msgid "You are moderator." |
|
281 | msgid "You are moderator." | |
278 | msgstr "Вы модератор." |
|
282 | msgstr "Вы модератор." | |
279 |
|
283 | |||
280 |
#: templates/boards/settings.html:2 |
|
284 | #: templates/boards/settings.html:21 | |
281 | msgid "Hidden tags:" |
|
285 | msgid "Hidden tags:" | |
282 | msgstr "Скрытые метки:" |
|
286 | msgstr "Скрытые метки:" | |
283 |
|
287 | |||
284 |
#: templates/boards/settings.html:2 |
|
288 | #: templates/boards/settings.html:29 | |
285 | msgid "No hidden tags." |
|
289 | msgid "No hidden tags." | |
286 | msgstr "Нет скрытых меток." |
|
290 | msgstr "Нет скрытых меток." | |
287 |
|
291 | |||
288 |
#: templates/boards/settings.html:3 |
|
292 | #: templates/boards/settings.html:38 | |
289 | msgid "Save" |
|
293 | msgid "Save" | |
290 | msgstr "Сохранить" |
|
294 | msgstr "Сохранить" | |
291 |
|
295 | |||
@@ -342,36 +346,36 b' msgstr "\xd0\x92\xd1\x8b \xd0\xbc\xd0\xbe\xd0\xb6\xd0\xb5\xd1\x82\xd0\xb5 \xd0\xbf\xd0\xbe\xd0\xbf\xd1\x80\xd0\xbe\xd0\xb1\xd0\xbe\xd0\xb2\xd0\xb0\xd1\x82\xd1\x8c \xd0\xb2\xd1\x81\xd1\x82\xd0\xb0\xd0\xb2\xd0\xb8\xd1\x82\xd1\x8c \xd1\x82\xd0\xb5\xd0\xba\xd1\x81\xd1\x82 \xd0\xb8 \xd0\xbf\xd1\x80\xd0\xbe\xd0\xb2\xd0\xb5\xd1\x80\xd0\xb8\xd1\x82\xd1\x8c \xd1\x80\xd0\xb5\xd0\xb7\xd1\x83\xd0\xbb\xd1\x8c\xd1\x82\xd0\xb0\xd1\x82 \xd0\xb7\xd0\xb4\xd0\xb5\xd1\x81\xd1\x8c:"' | |||||
342 | msgid "No tags found." |
|
346 | msgid "No tags found." | |
343 | msgstr "Метки не найдены." |
|
347 | msgstr "Метки не найдены." | |
344 |
|
348 | |||
345 |
#: templates/boards/thread.html:3 |
|
349 | #: templates/boards/thread.html:32 | |
346 | msgid "Last update: " |
|
350 | msgid "Last update: " | |
347 | msgstr "Последнее обновление: " |
|
351 | msgstr "Последнее обновление: " | |
348 |
|
352 | |||
349 |
#: templates/boards/thread_gallery.html:2 |
|
353 | #: templates/boards/thread_gallery.html:21 | |
350 |
#: templates/boards/thread_normal.html:1 |
|
354 | #: templates/boards/thread_normal.html:16 | |
351 | msgid "Normal mode" |
|
355 | msgid "Normal mode" | |
352 | msgstr "Нормальный режим" |
|
356 | msgstr "Нормальный режим" | |
353 |
|
357 | |||
354 |
#: templates/boards/thread_gallery.html:2 |
|
358 | #: templates/boards/thread_gallery.html:22 | |
355 |
#: templates/boards/thread_normal.html:1 |
|
359 | #: templates/boards/thread_normal.html:17 | |
356 | msgid "Gallery mode" |
|
360 | msgid "Gallery mode" | |
357 | msgstr "Режим галереи" |
|
361 | msgstr "Режим галереи" | |
358 |
|
362 | |||
359 |
#: templates/boards/thread_gallery.html:5 |
|
363 | #: templates/boards/thread_gallery.html:52 | |
360 | msgid "No images." |
|
364 | msgid "No images." | |
361 | msgstr "Нет изображений." |
|
365 | msgstr "Нет изображений." | |
362 |
|
366 | |||
363 |
#: templates/boards/thread_normal.html:2 |
|
367 | #: templates/boards/thread_normal.html:25 | |
364 | msgid "posts to bumplimit" |
|
368 | msgid "posts to bumplimit" | |
365 | msgstr "сообщений до бамплимита" |
|
369 | msgstr "сообщений до бамплимита" | |
366 |
|
370 | |||
367 |
#: templates/boards/thread_normal.html:3 |
|
371 | #: templates/boards/thread_normal.html:39 | |
368 | msgid "Reply to thread" |
|
372 | msgid "Reply to thread" | |
369 | msgstr "Ответить в тему" |
|
373 | msgstr "Ответить в тему" | |
370 |
|
374 | |||
371 |
#: templates/boards/thread_normal.html:5 |
|
375 | #: templates/boards/thread_normal.html:52 | |
372 | msgid "Close form" |
|
376 | msgid "Close form" | |
373 | msgstr "Закрыть форму" |
|
377 | msgstr "Закрыть форму" | |
374 |
|
378 | |||
375 |
#: templates/boards/thread_normal.html:6 |
|
379 | #: templates/boards/thread_normal.html:68 | |
376 | msgid "Update" |
|
380 | msgid "Update" | |
377 | msgstr "Обновить" |
|
381 | msgstr "Обновить" |
@@ -1,4 +1,8 b'' | |||||
|
1 | import pytz | |||
|
2 | ||||
1 | from django.shortcuts import redirect |
|
3 | from django.shortcuts import redirect | |
|
4 | from django.utils import timezone | |||
|
5 | ||||
2 | from boards import utils |
|
6 | from boards import utils | |
3 | from boards.models import Ban |
|
7 | from boards.models import Ban | |
4 |
|
8 | |||
@@ -26,3 +30,13 b' class BanMiddleware:' | |||||
26 | ban = bans[0] |
|
30 | ban = bans[0] | |
27 | if not ban.can_read: |
|
31 | if not ban.can_read: | |
28 | return redirect('banned') |
|
32 | return redirect('banned') | |
|
33 | ||||
|
34 | ||||
|
35 | class TimezoneMiddleware(object): | |||
|
36 | def process_request(self, request): | |||
|
37 | tzname = request.session.get('django_timezone') | |||
|
38 | if tzname: | |||
|
39 | timezone.activate(pytz.timezone(tzname)) | |||
|
40 | else: | |||
|
41 | timezone.deactivate() | |||
|
42 |
@@ -23,17 +23,6 b'' | |||||
23 | for the JavaScript code in this page. |
|
23 | for the JavaScript code in this page. | |
24 | */ |
|
24 | */ | |
25 |
|
25 | |||
26 | if (window.Intl) { |
|
|||
27 | var LOCALE = window.navigator.language; |
|
|||
28 | var FORMATTER = new Intl.DateTimeFormat( |
|
|||
29 | LOCALE, |
|
|||
30 | { |
|
|||
31 | weekday: 'short', year: 'numeric', month: 'short', day: 'numeric', |
|
|||
32 | hour: 'numeric', minute: '2-digit', second: '2-digit' |
|
|||
33 | } |
|
|||
34 | ); |
|
|||
35 | } |
|
|||
36 |
|
||||
37 |
|
|
26 | /** | |
38 | * An email is a hidden file to prevent spam bots from posting. It has to be |
|
27 | * An email is a hidden file to prevent spam bots from posting. It has to be | |
39 | * hidden. |
|
28 | * hidden. | |
@@ -51,36 +40,6 b' function highlightCode(node) {' | |||||
51 | }); |
|
40 | }); | |
52 | } |
|
41 | } | |
53 |
|
42 | |||
54 | /** |
|
|||
55 | * Translate timestamps to local ones for all <time> tags inside node. |
|
|||
56 | */ |
|
|||
57 | function translate_time(node) { |
|
|||
58 | if (window.Intl === null) { |
|
|||
59 | return; |
|
|||
60 | } |
|
|||
61 |
|
||||
62 | var elements; |
|
|||
63 |
|
||||
64 | if (node === null) { |
|
|||
65 | elements = $('time'); |
|
|||
66 | } else { |
|
|||
67 | elements = node.find('time'); |
|
|||
68 | } |
|
|||
69 |
|
||||
70 | if (!elements.length) { |
|
|||
71 | return; |
|
|||
72 | } |
|
|||
73 |
|
||||
74 | elements.each(function() { |
|
|||
75 | var element = $(this); |
|
|||
76 | var dateAttr = element.attr('datetime'); |
|
|||
77 | if (dateAttr) { |
|
|||
78 | var date = new Date(dateAttr); |
|
|||
79 | element.text(FORMATTER.format(date)); |
|
|||
80 | } |
|
|||
81 | }); |
|
|||
82 | } |
|
|||
83 |
|
||||
84 | $( document ).ready(function() { |
|
43 | $( document ).ready(function() { | |
85 | hideEmailFromForm(); |
|
44 | hideEmailFromForm(); | |
86 |
|
45 | |||
@@ -94,6 +53,4 b' function translate_time(node) {' | |||||
94 | addRefLinkPreview(); |
|
53 | addRefLinkPreview(); | |
95 |
|
54 | |||
96 | highlightCode($(document)); |
|
55 | highlightCode($(document)); | |
97 |
|
||||
98 | translate_time(null); |
|
|||
99 | }); |
|
56 | }); |
@@ -20,7 +20,6 b' function mkPreview(cln, html) {' | |||||
20 |
|
20 | |||
21 | highlightCode($(cln)); |
|
21 | highlightCode($(cln)); | |
22 | addRefLinkPreview(cln); |
|
22 | addRefLinkPreview(cln); | |
23 | translate_time($(cln)); |
|
|||
24 | }; |
|
23 | }; | |
25 |
|
24 | |||
26 | function isElementInViewport (el) { |
|
25 | function isElementInViewport (el) { |
@@ -196,7 +196,6 b' function updateMetadataPanel(lastUpdate)' | |||||
196 | if (lastUpdate !== '') { |
|
196 | if (lastUpdate !== '') { | |
197 | var lastUpdateField = $('#last-update'); |
|
197 | var lastUpdateField = $('#last-update'); | |
198 | lastUpdateField.html(lastUpdate); |
|
198 | lastUpdateField.html(lastUpdate); | |
199 | translate_time(lastUpdateField); |
|
|||
200 | blink(lastUpdateField); |
|
199 | blink(lastUpdateField); | |
201 | } |
|
200 | } | |
202 |
|
201 | |||
@@ -305,7 +304,6 b' function showAsErrors(form, text) {' | |||||
305 | function processNewPost(post) { |
|
304 | function processNewPost(post) { | |
306 | addRefLinkPreview(post[0]); |
|
305 | addRefLinkPreview(post[0]); | |
307 | highlightCode(post); |
|
306 | highlightCode(post); | |
308 | translate_time(post); |
|
|||
309 | blink(post); |
|
307 | blink(post); | |
310 | } |
|
308 | } | |
311 |
|
309 |
@@ -4,6 +4,7 b'' | |||||
4 | {% load cache %} |
|
4 | {% load cache %} | |
5 | {% load board %} |
|
5 | {% load board %} | |
6 | {% load static %} |
|
6 | {% load static %} | |
|
7 | {% load tz %} | |||
7 |
|
8 | |||
8 | {% block head %} |
|
9 | {% block head %} | |
9 | <meta name="robots" content="noindex"> |
|
10 | <meta name="robots" content="noindex"> | |
@@ -38,6 +39,7 b'' | |||||
38 | {% block content %} |
|
39 | {% block content %} | |
39 |
|
40 | |||
40 | {% get_current_language as LANGUAGE_CODE %} |
|
41 | {% get_current_language as LANGUAGE_CODE %} | |
|
42 | {% get_current_timezone as TIME_ZONE %} | |||
41 |
|
43 | |||
42 | {% if tag %} |
|
44 | {% if tag %} | |
43 | <div class="tag_info"> |
|
45 | <div class="tag_info"> | |
@@ -81,7 +83,7 b'' | |||||
81 | {% endif %} |
|
83 | {% endif %} | |
82 |
|
84 | |||
83 | {% for thread in threads %} |
|
85 | {% for thread in threads %} | |
84 | {% cache 600 thread_short thread.id thread.last_edit_time moderator LANGUAGE_CODE %} |
|
86 | {% cache 600 thread_short thread.id thread.last_edit_time moderator LANGUAGE_CODE TIME_ZONE %} | |
85 | <div class="thread"> |
|
87 | <div class="thread"> | |
86 | {% post_view thread.get_opening_post moderator is_opening=True thread=thread truncated=True need_open_link=True %} |
|
88 | {% post_view thread.get_opening_post moderator is_opening=True thread=thread truncated=True need_open_link=True %} | |
87 | {% if not thread.archived %} |
|
89 | {% if not thread.archived %} |
@@ -2,6 +2,7 b'' | |||||
2 |
|
2 | |||
3 | {% load i18n %} |
|
3 | {% load i18n %} | |
4 | {% load humanize %} |
|
4 | {% load humanize %} | |
|
5 | {% load tz %} | |||
5 |
|
6 | |||
6 | {% block head %} |
|
7 | {% block head %} | |
7 | <meta name="robots" content="noindex"> |
|
8 | <meta name="robots" content="noindex"> |
@@ -4,6 +4,7 b'' | |||||
4 | {% load cache %} |
|
4 | {% load cache %} | |
5 | {% load static from staticfiles %} |
|
5 | {% load static from staticfiles %} | |
6 | {% load board %} |
|
6 | {% load board %} | |
|
7 | {% load tz %} | |||
7 |
|
8 | |||
8 | {% block head %} |
|
9 | {% block head %} | |
9 | <title>{{ opening_post.get_title|striptags|truncatewords:10 }} |
|
10 | <title>{{ opening_post.get_title|striptags|truncatewords:10 }} | |
@@ -13,6 +14,7 b'' | |||||
13 | {% block metapanel %} |
|
14 | {% block metapanel %} | |
14 |
|
15 | |||
15 | {% get_current_language as LANGUAGE_CODE %} |
|
16 | {% get_current_language as LANGUAGE_CODE %} | |
|
17 | {% get_current_timezone as TIME_ZONE %} | |||
16 |
|
18 | |||
17 | <span class="metapanel" |
|
19 | <span class="metapanel" | |
18 | data-last-update="{{ last_update }}" |
|
20 | data-last-update="{{ last_update }}" | |
@@ -24,7 +26,7 b'' | |||||
24 | {% block thread_meta_panel %} |
|
26 | {% block thread_meta_panel %} | |
25 | {% endblock %} |
|
27 | {% endblock %} | |
26 |
|
28 | |||
27 | {% cache 600 thread_meta thread.last_edit_time moderator LANGUAGE_CODE %} |
|
29 | {% cache 600 thread_meta thread.last_edit_time moderator LANGUAGE_CODE TIME_ZONE %} | |
28 | <span id="reply-count">{{ thread.get_reply_count }}</span>{% if thread.has_post_limit %}/{{ thread.max_posts }}{% endif %} {% trans 'messages' %}, |
|
30 | <span id="reply-count">{{ thread.get_reply_count }}</span>{% if thread.has_post_limit %}/{{ thread.max_posts }}{% endif %} {% trans 'messages' %}, | |
29 | <span id="image-count">{{ thread.get_images_count }}</span> {% trans 'images' %}. |
|
31 | <span id="image-count">{{ thread.get_images_count }}</span> {% trans 'images' %}. | |
30 | {% trans 'Last update: ' %}<span id="last-update"><time datetime="{{ thread.last_edit_time|date:'c' }}">{{ thread.last_edit_time|date:'r' }}</time></span> |
|
32 | {% trans 'Last update: ' %}<span id="last-update"><time datetime="{{ thread.last_edit_time|date:'c' }}">{{ thread.last_edit_time|date:'r' }}</time></span> |
@@ -4,6 +4,7 b'' | |||||
4 | {% load cache %} |
|
4 | {% load cache %} | |
5 | {% load static from staticfiles %} |
|
5 | {% load static from staticfiles %} | |
6 | {% load board %} |
|
6 | {% load board %} | |
|
7 | {% load tz %} | |||
7 |
|
8 | |||
8 | {% block head %} |
|
9 | {% block head %} | |
9 | <meta name="robots" content="noindex"> |
|
10 | <meta name="robots" content="noindex"> | |
@@ -12,10 +13,10 b'' | |||||
12 | {% endblock %} |
|
13 | {% endblock %} | |
13 |
|
14 | |||
14 | {% block content %} |
|
15 | {% block content %} | |
15 | {% spaceless %} |
|
|||
16 | {% get_current_language as LANGUAGE_CODE %} |
|
16 | {% get_current_language as LANGUAGE_CODE %} | |
|
17 | {% get_current_timezone as TIME_ZONE %} | |||
17 |
|
18 | |||
18 | {% cache 600 thread_gallery_view thread.id thread.last_edit_time LANGUAGE_CODE request.get_host %} |
|
19 | {% cache 600 thread_gallery_view thread.id thread.last_edit_time LANGUAGE_CODE request.get_host TIME_ZONE %} | |
19 | <div class="image-mode-tab"> |
|
20 | <div class="image-mode-tab"> | |
20 | <a href="{% url 'thread' thread.get_opening_post.id %}">{% trans 'Normal mode' %}</a>, |
|
21 | <a href="{% url 'thread' thread.get_opening_post.id %}">{% trans 'Normal mode' %}</a>, | |
21 | <a class="current_mode" href="{% url 'thread_gallery' thread.get_opening_post.id %}">{% trans 'Gallery mode' %}</a> |
|
22 | <a class="current_mode" href="{% url 'thread_gallery' thread.get_opening_post.id %}">{% trans 'Gallery mode' %}</a> | |
@@ -52,6 +53,4 b'' | |||||
52 | {% endif %} |
|
53 | {% endif %} | |
53 | </div> |
|
54 | </div> | |
54 | {% endcache %} |
|
55 | {% endcache %} | |
55 |
|
||||
56 | {% endspaceless %} |
|
|||
57 | {% endblock %} |
|
56 | {% endblock %} |
@@ -4,11 +4,13 b'' | |||||
4 | {% load cache %} |
|
4 | {% load cache %} | |
5 | {% load static from staticfiles %} |
|
5 | {% load static from staticfiles %} | |
6 | {% load board %} |
|
6 | {% load board %} | |
|
7 | {% load tz %} | |||
7 |
|
8 | |||
8 | {% block content %} |
|
9 | {% block content %} | |
9 | {% get_current_language as LANGUAGE_CODE %} |
|
10 | {% get_current_language as LANGUAGE_CODE %} | |
|
11 | {% get_current_timezone as TIME_ZONE %} | |||
10 |
|
12 | |||
11 | {% cache 600 thread_view thread.id thread.last_edit_time moderator LANGUAGE_CODE %} |
|
13 | {% cache 600 thread_view thread.id thread.last_edit_time moderator LANGUAGE_CODE TIME_ZONE %} | |
12 |
|
14 | |||
13 | <div class="image-mode-tab"> |
|
15 | <div class="image-mode-tab"> | |
14 | <a class="current_mode" href="{% url 'thread' opening_post.id %}">{% trans 'Normal mode' %}</a>, |
|
16 | <a class="current_mode" href="{% url 'thread' opening_post.id %}">{% trans 'Normal mode' %}</a>, |
@@ -1,5 +1,8 b'' | |||||
|
1 | import pytz | |||
|
2 | ||||
1 | from django.db import transaction |
|
3 | from django.db import transaction | |
2 | from django.shortcuts import render, redirect |
|
4 | from django.shortcuts import render, redirect | |
|
5 | from django.utils import timezone | |||
3 |
|
6 | |||
4 | from boards.abstracts.settingsmanager import get_settings_manager, \ |
|
7 | from boards.abstracts.settingsmanager import get_settings_manager, \ | |
5 | SETTING_USERNAME, SETTING_LAST_NOTIFICATION_ID |
|
8 | SETTING_USERNAME, SETTING_LAST_NOTIFICATION_ID | |
@@ -8,6 +11,7 b' from boards.forms import SettingsForm, P' | |||||
8 |
|
11 | |||
9 | FORM_THEME = 'theme' |
|
12 | FORM_THEME = 'theme' | |
10 | FORM_USERNAME = 'username' |
|
13 | FORM_USERNAME = 'username' | |
|
14 | FORM_TIMEZONE = 'timezone' | |||
11 |
|
15 | |||
12 | CONTEXT_HIDDEN_TAGS = 'hidden_tags' |
|
16 | CONTEXT_HIDDEN_TAGS = 'hidden_tags' | |
13 |
|
17 | |||
@@ -25,7 +29,9 b' class SettingsView(BaseBoardView):' | |||||
25 | form = SettingsForm( |
|
29 | form = SettingsForm( | |
26 | initial={ |
|
30 | initial={ | |
27 | FORM_THEME: selected_theme, |
|
31 | FORM_THEME: selected_theme, | |
28 |
FORM_USERNAME: settings_manager.get_setting(SETTING_USERNAME) |
|
32 | FORM_USERNAME: settings_manager.get_setting(SETTING_USERNAME), | |
|
33 | FORM_TIMEZONE: request.session.get('django_timezone', timezone.get_current_timezone()), | |||
|
34 | }, | |||
29 | error_class=PlainErrorList) |
|
35 | error_class=PlainErrorList) | |
30 |
|
36 | |||
31 | params[CONTEXT_FORM] = form |
|
37 | params[CONTEXT_FORM] = form | |
@@ -50,6 +56,8 b' class SettingsView(BaseBoardView):' | |||||
50 | settings_manager.set_setting(SETTING_USERNAME, username) |
|
56 | settings_manager.set_setting(SETTING_USERNAME, username) | |
51 | settings_manager.set_setting(SETTING_LAST_NOTIFICATION_ID, None) |
|
57 | settings_manager.set_setting(SETTING_LAST_NOTIFICATION_ID, None) | |
52 |
|
58 | |||
|
59 | request.session['django_timezone'] = form.cleaned_data[FORM_TIMEZONE] | |||
|
60 | ||||
53 | return redirect('settings') |
|
61 | return redirect('settings') | |
54 | else: |
|
62 | else: | |
55 | params = dict() |
|
63 | params = dict() |
@@ -116,6 +116,7 b' MIDDLEWARE_CLASSES = (' | |||||
116 | 'django.contrib.auth.middleware.AuthenticationMiddleware', |
|
116 | 'django.contrib.auth.middleware.AuthenticationMiddleware', | |
117 | 'django.contrib.messages.middleware.MessageMiddleware', |
|
117 | 'django.contrib.messages.middleware.MessageMiddleware', | |
118 | 'boards.middlewares.BanMiddleware', |
|
118 | 'boards.middlewares.BanMiddleware', | |
|
119 | 'boards.middlewares.TimezoneMiddleware', | |||
119 | ) |
|
120 | ) | |
120 |
|
121 | |||
121 | ROOT_URLCONF = 'neboard.urls' |
|
122 | ROOT_URLCONF = 'neboard.urls' |
General Comments 0
You need to be logged in to leave comments.
Login now