Show More
@@ -0,0 +1,30 b'' | |||
|
1 | {% extends "boards/base.html" %} | |
|
2 | ||
|
3 | {% load i18n %} | |
|
4 | ||
|
5 | {% block head %} | |
|
6 | <title>{% trans 'Preview' %} - {{ site_name }}</title> | |
|
7 | {% endblock %} | |
|
8 | ||
|
9 | {% block content %} | |
|
10 | ||
|
11 | <div class="post-form-w"> | |
|
12 | <div class="post-form"> | |
|
13 | <form enctype="multipart/form-data" method="post"> | |
|
14 | <textarea name="query">{{ query }}</textarea> | |
|
15 | <div class="form-submit"> | |
|
16 | <input type="submit" value="{% trans "Post" %}"/> | |
|
17 | </div> | |
|
18 | </form> | |
|
19 | </div> | |
|
20 | </div> | |
|
21 | ||
|
22 | {% if result %} | |
|
23 | <div class="post"> | |
|
24 | {% autoescape off %} | |
|
25 | {{ result }} | |
|
26 | {% endautoescape %} | |
|
27 | </div> | |
|
28 | {% endif %} | |
|
29 | ||
|
30 | {% endblock %} |
@@ -0,0 +1,35 b'' | |||
|
1 | from django.shortcuts import render | |
|
2 | from django.template import RequestContext | |
|
3 | from django.views.generic import View | |
|
4 | ||
|
5 | from boards.mdx_neboard import bbcode_extended | |
|
6 | ||
|
7 | FORM_QUERY = 'query' | |
|
8 | ||
|
9 | CONTEXT_RESULT = 'result' | |
|
10 | CONTEXT_QUERY = 'query' | |
|
11 | ||
|
12 | __author__ = 'neko259' | |
|
13 | ||
|
14 | TEMPLATE = 'boards/preview.html' | |
|
15 | ||
|
16 | ||
|
17 | class PostPreviewView(View): | |
|
18 | def get(self, request): | |
|
19 | context = RequestContext(request) | |
|
20 | ||
|
21 | return render(request, TEMPLATE, context) | |
|
22 | ||
|
23 | def post(self, request): | |
|
24 | context = RequestContext(request) | |
|
25 | ||
|
26 | if FORM_QUERY in request.POST: | |
|
27 | raw_text = request.POST[FORM_QUERY] | |
|
28 | ||
|
29 | if len(raw_text) >= 0: | |
|
30 | rendered_text = bbcode_extended(raw_text) | |
|
31 | ||
|
32 | context[CONTEXT_RESULT] = rendered_text | |
|
33 | context[CONTEXT_QUERY] = raw_text | |
|
34 | ||
|
35 | return render(request, TEMPLATE, context) |
@@ -181,10 +181,6 b' class PostForm(NeboardForm):' | |||
|
181 | 181 | def _validate_posting_speed(self): |
|
182 | 182 | can_post = True |
|
183 | 183 | |
|
184 | # TODO Remove this, it's only for test | |
|
185 | if not 'user_id' in self.session: | |
|
186 | return | |
|
187 | ||
|
188 | 184 | posting_delay = settings.POSTING_DELAY |
|
189 | 185 | |
|
190 | 186 | if board_settings.LIMIT_POSTING_SPEED and LAST_POST_TIME in \ |
|
1 | NO CONTENT: modified file, binary diff hidden |
@@ -7,7 +7,7 b' msgid ""' | |||
|
7 | 7 | msgstr "" |
|
8 | 8 | "Project-Id-Version: PACKAGE VERSION\n" |
|
9 | 9 | "Report-Msgid-Bugs-To: \n" |
|
10 |
"POT-Creation-Date: 2014-0 |
|
|
10 | "POT-Creation-Date: 2014-08-19 15:51+0300\n" | |
|
11 | 11 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" |
|
12 | 12 | "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" |
|
13 | 13 | "Language-Team: LANGUAGE <LL@li.org>\n" |
@@ -34,89 +34,85 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"' | |||
|
34 | 34 | msgid "designer" |
|
35 | 35 | msgstr "дизайнер" |
|
36 | 36 | |
|
37 |
#: forms.py:2 |
|
|
37 | #: forms.py:22 | |
|
38 | 38 | msgid "Type message here. Use formatting panel for more advanced usage." |
|
39 | 39 | msgstr "" |
|
40 | 40 | "Вводите сообщение сюда. Используйте панель для более сложного форматирования." |
|
41 | 41 | |
|
42 |
#: forms.py:2 |
|
|
42 | #: forms.py:23 | |
|
43 | 43 | msgid "tag1 several_words_tag" |
|
44 | 44 | msgstr "тег1 тег_из_нескольких_слов" |
|
45 | 45 | |
|
46 |
#: forms.py:2 |
|
|
46 | #: forms.py:25 | |
|
47 | 47 | msgid "Such image was already posted" |
|
48 | 48 | msgstr "Такое изображение уже было загружено" |
|
49 | 49 | |
|
50 |
#: forms.py:2 |
|
|
50 | #: forms.py:27 | |
|
51 | 51 | msgid "Title" |
|
52 | 52 | msgstr "Заголовок" |
|
53 | 53 | |
|
54 |
#: forms.py:2 |
|
|
54 | #: forms.py:28 | |
|
55 | 55 | msgid "Text" |
|
56 | 56 | msgstr "Текст" |
|
57 | 57 | |
|
58 |
#: forms.py: |
|
|
58 | #: forms.py:29 | |
|
59 | 59 | msgid "Tag" |
|
60 | 60 | msgstr "Тег" |
|
61 | 61 | |
|
62 |
#: forms.py:3 |
|
|
62 | #: forms.py:30 templates/boards/base.html:36 templates/search/search.html:9 | |
|
63 | 63 | #: templates/search/search.html.py:13 |
|
64 | 64 | msgid "Search" |
|
65 | 65 | msgstr "Поиск" |
|
66 | 66 | |
|
67 |
#: forms.py:10 |
|
|
67 | #: forms.py:107 | |
|
68 | 68 | msgid "Image" |
|
69 | 69 | msgstr "Изображение" |
|
70 | 70 | |
|
71 |
#: forms.py:11 |
|
|
71 | #: forms.py:112 | |
|
72 | 72 | msgid "e-mail" |
|
73 | 73 | msgstr "" |
|
74 | 74 | |
|
75 |
#: forms.py:12 |
|
|
75 | #: forms.py:123 | |
|
76 | 76 | #, python-format |
|
77 | 77 | msgid "Title must have less than %s characters" |
|
78 | 78 | msgstr "Заголовок должен иметь меньше %s символов" |
|
79 | 79 | |
|
80 |
#: forms.py:13 |
|
|
80 | #: forms.py:132 | |
|
81 | 81 | #, python-format |
|
82 | 82 | msgid "Text must have less than %s characters" |
|
83 | 83 | msgstr "Текст должен быть короче %s символов" |
|
84 | 84 | |
|
85 |
#: forms.py:14 |
|
|
85 | #: forms.py:143 | |
|
86 | 86 | #, python-format |
|
87 | 87 | msgid "Image must be less than %s bytes" |
|
88 | 88 | msgstr "Изображение должно быть менее %s байт" |
|
89 | 89 | |
|
90 |
#: forms.py:17 |
|
|
90 | #: forms.py:178 | |
|
91 | 91 | msgid "Either text or image must be entered." |
|
92 | 92 | msgstr "Текст или картинка должны быть введены." |
|
93 | 93 | |
|
94 |
#: forms.py:19 |
|
|
94 | #: forms.py:198 | |
|
95 | 95 | #, python-format |
|
96 | 96 | msgid "Wait %s seconds after last posting" |
|
97 | 97 | msgstr "Подождите %s секунд после последнего постинга" |
|
98 | 98 | |
|
99 |
#: forms.py:21 |
|
|
99 | #: forms.py:214 templates/boards/tags.html:7 templates/boards/rss/post.html:10 | |
|
100 | 100 | msgid "Tags" |
|
101 | 101 | msgstr "Теги" |
|
102 | 102 | |
|
103 |
#: forms.py:22 |
|
|
103 | #: forms.py:221 forms.py:247 | |
|
104 | 104 | msgid "Inappropriate characters in tags." |
|
105 | 105 | msgstr "Недопустимые символы в тегах." |
|
106 | 106 | |
|
107 |
#: forms.py:2 |
|
|
108 | msgid "Captcha validation failed" | |
|
109 | msgstr "Проверка капчи провалена" | |
|
110 | ||
|
111 | #: forms.py:277 | |
|
107 | #: forms.py:234 | |
|
112 | 108 | msgid "Theme" |
|
113 | 109 | msgstr "Тема" |
|
114 | 110 | |
|
115 |
#: forms.py: |
|
|
111 | #: forms.py:270 | |
|
116 | 112 | msgid "Invalid master password" |
|
117 | 113 | msgstr "Неверный мастер-пароль" |
|
118 | 114 | |
|
119 |
#: forms.py: |
|
|
115 | #: forms.py:284 | |
|
120 | 116 | #, python-format |
|
121 | 117 | msgid "Wait %s minutes after last login" |
|
122 | 118 | msgstr "Подождите %s минут после последнего входа" |
@@ -157,28 +153,27 b' msgstr "\xd0\x92\xd1\x81\xd0\xb5 \xd1\x82\xd0\xb5\xd0\xbc\xd1\x8b"' | |||
|
157 | 153 | msgid "Tag management" |
|
158 | 154 | msgstr "Управление тегами" |
|
159 | 155 | |
|
160 |
#: templates/boards/base.html:3 |
|
|
156 | #: templates/boards/base.html:37 templates/boards/settings.html:7 | |
|
161 | 157 | msgid "Settings" |
|
162 | 158 | msgstr "Настройки" |
|
163 | 159 | |
|
164 | 160 | #: templates/boards/base.html:50 |
|
165 | msgid "Logout" | |
|
166 |
msgstr " |
|
|
161 | msgid "Admin" | |
|
162 | msgstr "" | |
|
167 | 163 | |
|
168 |
#: templates/boards/base.html:52 |
|
|
169 | #: templates/boards/login.html.py:16 | |
|
170 | msgid "Login" | |
|
171 | msgstr "Вход" | |
|
172 | ||
|
173 | #: templates/boards/base.html:56 | |
|
164 | #: templates/boards/base.html:52 | |
|
174 | 165 | #, python-format |
|
175 | 166 | msgid "Speed: %(ppd)s posts per day" |
|
176 | 167 | msgstr "Скорость: %(ppd)s сообщений в день" |
|
177 | 168 | |
|
178 |
#: templates/boards/base.html:5 |
|
|
169 | #: templates/boards/base.html:54 | |
|
179 | 170 | msgid "Up" |
|
180 | 171 | msgstr "Вверх" |
|
181 | 172 | |
|
173 | #: templates/boards/login.html:6 templates/boards/login.html.py:16 | |
|
174 | msgid "Login" | |
|
175 | msgstr "Вход" | |
|
176 | ||
|
182 | 177 | #: templates/boards/login.html:19 |
|
183 | 178 | msgid "Insert your user id above" |
|
184 | 179 | msgstr "Вставьте свой ID пользователя выше" |
@@ -212,12 +207,12 b' msgid "Replies"' | |||
|
212 | 207 | msgstr "Ответы" |
|
213 | 208 | |
|
214 | 209 | #: templates/boards/post.html:86 templates/boards/thread.html:88 |
|
215 |
#: templates/boards/thread_gallery.html: |
|
|
210 | #: templates/boards/thread_gallery.html:59 | |
|
216 | 211 | msgid "messages" |
|
217 | 212 | msgstr "сообщений" |
|
218 | 213 | |
|
219 | 214 | #: templates/boards/post.html:87 templates/boards/thread.html:89 |
|
220 |
#: templates/boards/thread_gallery.html:6 |
|
|
215 | #: templates/boards/thread_gallery.html:60 | |
|
221 | 216 | msgid "images" |
|
222 | 217 | msgstr "изображений" |
|
223 | 218 | |
@@ -258,7 +253,8 b' msgstr "\xd0\x9d\xd0\xb5\xd1\x82 \xd1\x82\xd0\xb5\xd0\xbc. \xd0\xa1\xd0\xbe\xd0\xb7\xd0\xb4\xd0\xb0\xd0\xb9\xd1\x82\xd0\xb5 \xd0\xbf\xd0\xb5\xd1\x80\xd0\xb2\xd1\x83\xd1\x8e!"' | |||
|
258 | 253 | msgid "Create new thread" |
|
259 | 254 | msgstr "Создать новую тему" |
|
260 | 255 | |
|
261 |
#: templates/boards/posting_general.html:137 templates/boards/ |
|
|
256 | #: templates/boards/posting_general.html:137 templates/boards/preview.html:16 | |
|
257 | #: templates/boards/thread.html:58 | |
|
262 | 258 | msgid "Post" |
|
263 | 259 | msgstr "Отправить" |
|
264 | 260 | |
@@ -275,6 +271,10 b' msgstr "\xd0\xa1\xd0\xb8\xd0\xbd\xd1\x82\xd0\xb0\xd0\xba\xd1\x81\xd0\xb8\xd1\x81 \xd1\x82\xd0\xb5\xd0\xba\xd1\x81\xd1\x82\xd0\xb0"' | |||
|
275 | 271 | msgid "Pages:" |
|
276 | 272 | msgstr "Страницы: " |
|
277 | 273 | |
|
274 | #: templates/boards/preview.html:6 templates/boards/staticpages/help.html:19 | |
|
275 | msgid "Preview" | |
|
276 | msgstr "Предпросмотр" | |
|
277 | ||
|
278 | 278 | #: templates/boards/settings.html:15 |
|
279 | 279 | msgid "You are moderator." |
|
280 | 280 | msgstr "Вы модератор." |
@@ -295,11 +295,11 b' msgstr "\xd0\xa1\xd0\xbe\xd1\x85\xd1\x80\xd0\xb0\xd0\xbd\xd0\xb8\xd1\x82\xd1\x8c"' | |||
|
295 | 295 | msgid "No tags found." |
|
296 | 296 | msgstr "Теги не найдены." |
|
297 | 297 | |
|
298 |
#: templates/boards/thread.html:20 templates/boards/thread_gallery.html: |
|
|
298 | #: templates/boards/thread.html:20 templates/boards/thread_gallery.html:19 | |
|
299 | 299 | msgid "Normal mode" |
|
300 | 300 | msgstr "Нормальный режим" |
|
301 | 301 | |
|
302 |
#: templates/boards/thread.html:21 templates/boards/thread_gallery.html:2 |
|
|
302 | #: templates/boards/thread.html:21 templates/boards/thread_gallery.html:20 | |
|
303 | 303 | msgid "Gallery mode" |
|
304 | 304 | msgstr "Режим галереи" |
|
305 | 305 | |
@@ -315,7 +315,7 b' msgstr "\xd0\x9e\xd1\x82\xd0\xb2\xd0\xb5\xd1\x82\xd0\xb8\xd1\x82\xd1\x8c \xd0\xb2 \xd1\x82\xd0\xb5\xd0\xbc\xd1\x83"' | |||
|
315 | 315 | msgid "Switch mode" |
|
316 | 316 | msgstr "Переключить режим" |
|
317 | 317 | |
|
318 |
#: templates/boards/thread.html:90 templates/boards/thread_gallery.html:6 |
|
|
318 | #: templates/boards/thread.html:90 templates/boards/thread_gallery.html:61 | |
|
319 | 319 | msgid "Last update: " |
|
320 | 320 | msgstr "Последнее обновление: " |
|
321 | 321 | |
@@ -359,3 +359,7 b' msgstr "\xd0\x97\xd0\xb0\xd1\x87\xd0\xb5\xd1\x80\xd0\xba\xd0\xbd\xd1\x83\xd1\x82\xd1\x8b\xd0\xb9 \xd1\x82\xd0\xb5\xd0\xba\xd1\x81\xd1\x82"' | |||
|
359 | 359 | #: templates/boards/staticpages/help.html:16 |
|
360 | 360 | msgid "Comment" |
|
361 | 361 | msgstr "Комментарий" |
|
362 | ||
|
363 | #: templates/boards/staticpages/help.html:19 | |
|
364 | msgid "You can try pasting the text and previewing the result here:" | |
|
365 | msgstr "Вы можете попробовать вставить текст и проверить результат здесь:" |
@@ -116,7 +116,7 b' class CodePattern(TextFormatter):' | |||
|
116 | 116 | |
|
117 | 117 | def render_reflink(tag_name, value, options, parent, context): |
|
118 | 118 | if not REFLINK_PATTERN.match(value): |
|
119 |
return |
|
|
119 | return '>>%s' % value | |
|
120 | 120 | |
|
121 | 121 | post_id = int(value) |
|
122 | 122 | |
@@ -124,21 +124,21 b' def render_reflink(tag_name, value, opti' | |||
|
124 | 124 | if posts.exists(): |
|
125 | 125 | post = posts[0] |
|
126 | 126 | |
|
127 |
return |
|
|
127 | return '<a href="%s">>>%s</a>' % (post.get_url(), post_id) | |
|
128 | 128 | else: |
|
129 |
return |
|
|
129 | return '>>%s' % value | |
|
130 | 130 | |
|
131 | 131 | |
|
132 | 132 | def render_quote(tag_name, value, options, parent, context): |
|
133 |
source = |
|
|
133 | source = '' | |
|
134 | 134 | if 'source' in options: |
|
135 | 135 | source = options['source'] |
|
136 | 136 | |
|
137 |
result = |
|
|
137 | result = '' | |
|
138 | 138 | if source: |
|
139 |
result = |
|
|
139 | result = '<div class="multiquote"><div class="quote-header">%s</div><div class="quote-text">%s</div></div>' % (source, value) | |
|
140 | 140 | else: |
|
141 |
result = |
|
|
141 | result = '<div class="multiquote"><div class="quote-text">%s</div></div>' % value | |
|
142 | 142 | |
|
143 | 143 | return result |
|
144 | 144 | |
@@ -152,7 +152,9 b' def preparse_text(text):' | |||
|
152 | 152 | |
|
153 | 153 | |
|
154 | 154 | def bbcode_extended(markup): |
|
155 | parser = bbcode.Parser() | |
|
155 | # The newline hack is added because br's margin does not work in all | |
|
156 | # browsers except firefox, when the div's does. | |
|
157 | parser = bbcode.Parser(newline='<div class="br"></div>') | |
|
156 | 158 | parser.add_formatter('post', render_reflink, strip=True) |
|
157 | 159 | parser.add_formatter('quote', render_quote, strip=True) |
|
158 | 160 | parser.add_simple_formatter('comment', |
@@ -18,6 +18,3 b' LAST_REPLIES_COUNT = 3' | |||
|
18 | 18 | ARCHIVE_THREADS = True |
|
19 | 19 | # Limit posting speed |
|
20 | 20 | LIMIT_POSTING_SPEED = False |
|
21 | ||
|
22 | # This password is used to add admin permissions to the user | |
|
23 | MASTER_PASSWORD = u'password' |
@@ -101,15 +101,11 b' body {' | |||
|
101 | 101 | visibility: hidden; |
|
102 | 102 | } |
|
103 | 103 | |
|
104 | p { | |
|
104 | p, .br { | |
|
105 | 105 | margin-top: .5em; |
|
106 | 106 | margin-bottom: .5em; |
|
107 | 107 | } |
|
108 | 108 | |
|
109 | br { | |
|
110 | margin-bottom: .5em; | |
|
111 | } | |
|
112 | ||
|
113 | 109 | .post-form-w { |
|
114 | 110 | background: #333344; |
|
115 | 111 | border-top: solid 1px #888; |
@@ -254,6 +250,10 b' a:hover {' | |||
|
254 | 250 | border-right: solid 1px #777; |
|
255 | 251 | } |
|
256 | 252 | |
|
253 | .last-replies > .post:first-child { | |
|
254 | border-top: none; | |
|
255 | } | |
|
256 | ||
|
257 | 257 | .thread { |
|
258 | 258 | margin-bottom: 3ex; |
|
259 | 259 | margin-top: 1ex; |
@@ -381,6 +381,7 b' li {' | |||
|
381 | 381 | margin-right: 3ex; |
|
382 | 382 | border-left: solid 1px #888; |
|
383 | 383 | border-right: solid 1px #888; |
|
384 | border-bottom: solid 1px #888; | |
|
384 | 385 | background: #000; |
|
385 | 386 | } |
|
386 | 387 |
@@ -133,7 +133,7 b' p {' | |||
|
133 | 133 | vertical-align: middle; |
|
134 | 134 | } |
|
135 | 135 | |
|
136 | .post-form input, .post-form textarea { | |
|
136 | .post-form input:not([name="image"]), .post-form textarea { | |
|
137 | 137 | background: #fff; |
|
138 | 138 | color: #000; |
|
139 | 139 | border: solid 1px; |
@@ -352,3 +352,13 b' input[type="submit"]:hover {' | |||
|
352 | 352 | margin: 0.3ex; |
|
353 | 353 | padding: 0.2ex; |
|
354 | 354 | } |
|
355 | ||
|
356 | .multiquote { | |
|
357 | padding: 3px; | |
|
358 | display: inline-block; | |
|
359 | background: #ddd; | |
|
360 | border-style: solid; | |
|
361 | border-width: 1px 1px 1px 4px; | |
|
362 | border-color: #222; | |
|
363 | font-size: 0.9em; | |
|
364 | } |
@@ -32,7 +32,8 b'' | |||
|
32 | 32 | >#{{ tag.name }}</a>, |
|
33 | 33 | {% endfor %} |
|
34 | 34 | <a href="{% url 'tags' %}" title="{% trans 'Tag management' %}" |
|
35 | >[...]</a> | |
|
35 | >[...]</a>, | |
|
36 | <a href="{% url 'search' %}" title="{% trans 'Search' %}">[S]</a> | |
|
36 | 37 | <a class="link" href="{% url 'settings' %}">{% trans 'Settings' %}</a> |
|
37 | 38 | </div> |
|
38 | 39 | |
@@ -47,7 +48,6 b'' | |||
|
47 | 48 | <div class="navigation_panel"> |
|
48 | 49 | {% block metapanel %}{% endblock %} |
|
49 | 50 | [<a href="{% url 'admin:index' %}">{% trans 'Admin' %}</a>] |
|
50 | [<a href="{% url 'search' %}">{% trans 'Search' %}</a>] | |
|
51 | 51 | {% with ppd=posts_per_day|floatformat:2 %} |
|
52 | 52 | {% blocktrans %}Speed: {{ ppd }} posts per day{% endblocktrans %} |
|
53 | 53 | {% endwith %} |
@@ -15,4 +15,6 b'' | |||
|
15 | 15 | <p>[s]<span class="strikethrough">{% trans 'Strikethrough text' %}</span>[/s]</p> |
|
16 | 16 | <p>[comment]<span class="comment">{% trans 'Comment' %}</span>[/comment]</p> |
|
17 | 17 | <p>[quote]<span class="multiquote">{% trans 'Quote' %}</span>[/quote]</p> |
|
18 | <br/> | |
|
19 | <p>{% trans 'You can try pasting the text and previewing the result here:' %} <a href="{% url 'preview' %}">{% trans 'Preview' %}</a></p> | |
|
18 | 20 | {% endblock %} |
@@ -10,6 +10,7 b' from boards.views.ban import BanUserView' | |||
|
10 | 10 | from boards.views.search import BoardSearchView |
|
11 | 11 | from boards.views.static import StaticPageView |
|
12 | 12 | from boards.views.post_admin import PostAdminView |
|
13 | from boards.views.preview import PostPreviewView | |
|
13 | 14 | |
|
14 | 15 | js_info_dict = { |
|
15 | 16 | 'packages': ('boards',), |
@@ -76,4 +77,7 b" urlpatterns = patterns(''," | |||
|
76 | 77 | # Search |
|
77 | 78 | url(r'^search/$', BoardSearchView.as_view(), name='search'), |
|
78 | 79 | |
|
80 | # Post preview | |
|
81 | url(r'^preview/$', PostPreviewView.as_view(), name='preview') | |
|
82 | ||
|
79 | 83 | ) |
General Comments 0
You need to be logged in to leave comments.
Login now