##// END OF EJS Templates
Merged with default
neko259 -
r834:cfa74d10 merge decentral
parent child Browse files
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 def _validate_posting_speed(self):
181 def _validate_posting_speed(self):
182 can_post = True
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 posting_delay = settings.POSTING_DELAY
184 posting_delay = settings.POSTING_DELAY
189
185
190 if board_settings.LIMIT_POSTING_SPEED and LAST_POST_TIME in \
186 if board_settings.LIMIT_POSTING_SPEED and LAST_POST_TIME in \
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: 2014-07-20 20:11+0300\n"
10 "POT-Creation-Date: 2014-08-19 15:51+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"
@@ -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 msgid "designer"
34 msgid "designer"
35 msgstr "дизайнер"
35 msgstr "дизайнер"
36
36
37 #: forms.py:23
37 #: forms.py:22
38 msgid "Type message here. Use formatting panel for more advanced usage."
38 msgid "Type message here. Use formatting panel for more advanced usage."
39 msgstr ""
39 msgstr ""
40 "Вводите сообщение сюда. Используйте панель для более сложного форматирования."
40 "Вводите сообщение сюда. Используйте панель для более сложного форматирования."
41
41
42 #: forms.py:24
42 #: forms.py:23
43 msgid "tag1 several_words_tag"
43 msgid "tag1 several_words_tag"
44 msgstr "тег1 тег_из_нескольких_слов"
44 msgstr "тег1 тег_из_нескольких_слов"
45
45
46 #: forms.py:26
46 #: forms.py:25
47 msgid "Such image was already posted"
47 msgid "Such image was already posted"
48 msgstr "Такое изображение уже было загружено"
48 msgstr "Такое изображение уже было загружено"
49
49
50 #: forms.py:28
50 #: forms.py:27
51 msgid "Title"
51 msgid "Title"
52 msgstr "Заголовок"
52 msgstr "Заголовок"
53
53
54 #: forms.py:29
54 #: forms.py:28
55 msgid "Text"
55 msgid "Text"
56 msgstr "Текст"
56 msgstr "Текст"
57
57
58 #: forms.py:30
58 #: forms.py:29
59 msgid "Tag"
59 msgid "Tag"
60 msgstr "Тег"
60 msgstr "Тег"
61
61
62 #: forms.py:31 templates/boards/base.html:54 templates/search/search.html:9
62 #: forms.py:30 templates/boards/base.html:36 templates/search/search.html:9
63 #: templates/search/search.html.py:13
63 #: templates/search/search.html.py:13
64 msgid "Search"
64 msgid "Search"
65 msgstr "Поиск"
65 msgstr "Поиск"
66
66
67 #: forms.py:108
67 #: forms.py:107
68 msgid "Image"
68 msgid "Image"
69 msgstr "Изображение"
69 msgstr "Изображение"
70
70
71 #: forms.py:113
71 #: forms.py:112
72 msgid "e-mail"
72 msgid "e-mail"
73 msgstr ""
73 msgstr ""
74
74
75 #: forms.py:124
75 #: forms.py:123
76 #, python-format
76 #, python-format
77 msgid "Title must have less than %s characters"
77 msgid "Title must have less than %s characters"
78 msgstr "Заголовок должен иметь меньше %s символов"
78 msgstr "Заголовок должен иметь меньше %s символов"
79
79
80 #: forms.py:133
80 #: forms.py:132
81 #, python-format
81 #, python-format
82 msgid "Text must have less than %s characters"
82 msgid "Text must have less than %s characters"
83 msgstr "Текст должен быть короче %s символов"
83 msgstr "Текст должен быть короче %s символов"
84
84
85 #: forms.py:144
85 #: forms.py:143
86 #, python-format
86 #, python-format
87 msgid "Image must be less than %s bytes"
87 msgid "Image must be less than %s bytes"
88 msgstr "Изображение должно быть менее %s байт"
88 msgstr "Изображение должно быть менее %s байт"
89
89
90 #: forms.py:179
90 #: forms.py:178
91 msgid "Either text or image must be entered."
91 msgid "Either text or image must be entered."
92 msgstr "Текст или картинка должны быть введены."
92 msgstr "Текст или картинка должны быть введены."
93
93
94 #: forms.py:199
94 #: forms.py:198
95 #, python-format
95 #, python-format
96 msgid "Wait %s seconds after last posting"
96 msgid "Wait %s seconds after last posting"
97 msgstr "Подождите %s секунд после последнего постинга"
97 msgstr "Подождите %s секунд после последнего постинга"
98
98
99 #: forms.py:215 templates/boards/tags.html:7 templates/boards/rss/post.html:10
99 #: forms.py:214 templates/boards/tags.html:7 templates/boards/rss/post.html:10
100 msgid "Tags"
100 msgid "Tags"
101 msgstr "Теги"
101 msgstr "Теги"
102
102
103 #: forms.py:222 forms.py:290
103 #: forms.py:221 forms.py:247
104 msgid "Inappropriate characters in tags."
104 msgid "Inappropriate characters in tags."
105 msgstr "Недопустимые символы в тегах."
105 msgstr "Недопустимые символы в тегах."
106
106
107 #: forms.py:250 forms.py:271
107 #: forms.py:234
108 msgid "Captcha validation failed"
109 msgstr "Проверка капчи провалена"
110
111 #: forms.py:277
112 msgid "Theme"
108 msgid "Theme"
113 msgstr "Тема"
109 msgstr "Тема"
114
110
115 #: forms.py:313
111 #: forms.py:270
116 msgid "Invalid master password"
112 msgid "Invalid master password"
117 msgstr "Неверный мастер-пароль"
113 msgstr "Неверный мастер-пароль"
118
114
119 #: forms.py:327
115 #: forms.py:284
120 #, python-format
116 #, python-format
121 msgid "Wait %s minutes after last login"
117 msgid "Wait %s minutes after last login"
122 msgstr "Подождите %s минут после последнего входа"
118 msgstr "Подождите %s минут после последнего входа"
@@ -157,28 +153,27 b' msgstr "\xd0\x92\xd1\x81\xd0\xb5 \xd1\x82\xd0\xb5\xd0\xbc\xd1\x8b"'
157 msgid "Tag management"
153 msgid "Tag management"
158 msgstr "Управление тегами"
154 msgstr "Управление тегами"
159
155
160 #: templates/boards/base.html:36 templates/boards/settings.html:7
156 #: templates/boards/base.html:37 templates/boards/settings.html:7
161 msgid "Settings"
157 msgid "Settings"
162 msgstr "Настройки"
158 msgstr "Настройки"
163
159
164 #: templates/boards/base.html:50
160 #: templates/boards/base.html:50
165 msgid "Logout"
161 msgid "Admin"
166 msgstr "Выход"
162 msgstr ""
167
163
168 #: templates/boards/base.html:52 templates/boards/login.html:6
164 #: templates/boards/base.html:52
169 #: templates/boards/login.html.py:16
170 msgid "Login"
171 msgstr "Вход"
172
173 #: templates/boards/base.html:56
174 #, python-format
165 #, python-format
175 msgid "Speed: %(ppd)s posts per day"
166 msgid "Speed: %(ppd)s posts per day"
176 msgstr "Скорость: %(ppd)s сообщений в день"
167 msgstr "Скорость: %(ppd)s сообщений в день"
177
168
178 #: templates/boards/base.html:58
169 #: templates/boards/base.html:54
179 msgid "Up"
170 msgid "Up"
180 msgstr "Вверх"
171 msgstr "Вверх"
181
172
173 #: templates/boards/login.html:6 templates/boards/login.html.py:16
174 msgid "Login"
175 msgstr "Вход"
176
182 #: templates/boards/login.html:19
177 #: templates/boards/login.html:19
183 msgid "Insert your user id above"
178 msgid "Insert your user id above"
184 msgstr "Вставьте свой ID пользователя выше"
179 msgstr "Вставьте свой ID пользователя выше"
@@ -212,12 +207,12 b' msgid "Replies"'
212 msgstr "Ответы"
207 msgstr "Ответы"
213
208
214 #: templates/boards/post.html:86 templates/boards/thread.html:88
209 #: templates/boards/post.html:86 templates/boards/thread.html:88
215 #: templates/boards/thread_gallery.html:61
210 #: templates/boards/thread_gallery.html:59
216 msgid "messages"
211 msgid "messages"
217 msgstr "сообщений"
212 msgstr "сообщений"
218
213
219 #: templates/boards/post.html:87 templates/boards/thread.html:89
214 #: templates/boards/post.html:87 templates/boards/thread.html:89
220 #: templates/boards/thread_gallery.html:62
215 #: templates/boards/thread_gallery.html:60
221 msgid "images"
216 msgid "images"
222 msgstr "изображений"
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 msgid "Create new thread"
253 msgid "Create new thread"
259 msgstr "Создать новую тему"
254 msgstr "Создать новую тему"
260
255
261 #: templates/boards/posting_general.html:137 templates/boards/thread.html:58
256 #: templates/boards/posting_general.html:137 templates/boards/preview.html:16
257 #: templates/boards/thread.html:58
262 msgid "Post"
258 msgid "Post"
263 msgstr "Отправить"
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 msgid "Pages:"
271 msgid "Pages:"
276 msgstr "Страницы: "
272 msgstr "Страницы: "
277
273
274 #: templates/boards/preview.html:6 templates/boards/staticpages/help.html:19
275 msgid "Preview"
276 msgstr "Предпросмотр"
277
278 #: templates/boards/settings.html:15
278 #: templates/boards/settings.html:15
279 msgid "You are moderator."
279 msgid "You are moderator."
280 msgstr "Вы модератор."
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 msgid "No tags found."
295 msgid "No tags found."
296 msgstr "Теги не найдены."
296 msgstr "Теги не найдены."
297
297
298 #: templates/boards/thread.html:20 templates/boards/thread_gallery.html:21
298 #: templates/boards/thread.html:20 templates/boards/thread_gallery.html:19
299 msgid "Normal mode"
299 msgid "Normal mode"
300 msgstr "Нормальный режим"
300 msgstr "Нормальный режим"
301
301
302 #: templates/boards/thread.html:21 templates/boards/thread_gallery.html:22
302 #: templates/boards/thread.html:21 templates/boards/thread_gallery.html:20
303 msgid "Gallery mode"
303 msgid "Gallery mode"
304 msgstr "Режим галереи"
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 msgid "Switch mode"
315 msgid "Switch mode"
316 msgstr "Переключить режим"
316 msgstr "Переключить режим"
317
317
318 #: templates/boards/thread.html:90 templates/boards/thread_gallery.html:63
318 #: templates/boards/thread.html:90 templates/boards/thread_gallery.html:61
319 msgid "Last update: "
319 msgid "Last update: "
320 msgstr "Последнее обновление: "
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 #: templates/boards/staticpages/help.html:16
359 #: templates/boards/staticpages/help.html:16
360 msgid "Comment"
360 msgid "Comment"
361 msgstr "Комментарий"
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 def render_reflink(tag_name, value, options, parent, context):
117 def render_reflink(tag_name, value, options, parent, context):
118 if not REFLINK_PATTERN.match(value):
118 if not REFLINK_PATTERN.match(value):
119 return u'>>%s' % value
119 return '>>%s' % value
120
120
121 post_id = int(value)
121 post_id = int(value)
122
122
@@ -124,21 +124,21 b' def render_reflink(tag_name, value, opti'
124 if posts.exists():
124 if posts.exists():
125 post = posts[0]
125 post = posts[0]
126
126
127 return u'<a href="%s">&gt;&gt;%s</a>' % (post.get_url(), post_id)
127 return '<a href="%s">&gt;&gt;%s</a>' % (post.get_url(), post_id)
128 else:
128 else:
129 return u'>>%s' % value
129 return '>>%s' % value
130
130
131
131
132 def render_quote(tag_name, value, options, parent, context):
132 def render_quote(tag_name, value, options, parent, context):
133 source = u''
133 source = ''
134 if 'source' in options:
134 if 'source' in options:
135 source = options['source']
135 source = options['source']
136
136
137 result = u''
137 result = ''
138 if source:
138 if source:
139 result = u'<div class="multiquote"><div class="quote-header">%s</div><div class="quote-text">%s</div></div>' % (source, value)
139 result = '<div class="multiquote"><div class="quote-header">%s</div><div class="quote-text">%s</div></div>' % (source, value)
140 else:
140 else:
141 result = u'<div class="multiquote"><div class="quote-text">%s</div></div>' % value
141 result = '<div class="multiquote"><div class="quote-text">%s</div></div>' % value
142
142
143 return result
143 return result
144
144
@@ -152,7 +152,9 b' def preparse_text(text):'
152
152
153
153
154 def bbcode_extended(markup):
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 parser.add_formatter('post', render_reflink, strip=True)
158 parser.add_formatter('post', render_reflink, strip=True)
157 parser.add_formatter('quote', render_quote, strip=True)
159 parser.add_formatter('quote', render_quote, strip=True)
158 parser.add_simple_formatter('comment',
160 parser.add_simple_formatter('comment',
@@ -18,6 +18,3 b' LAST_REPLIES_COUNT = 3'
18 ARCHIVE_THREADS = True
18 ARCHIVE_THREADS = True
19 # Limit posting speed
19 # Limit posting speed
20 LIMIT_POSTING_SPEED = False
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 visibility: hidden;
101 visibility: hidden;
102 }
102 }
103
103
104 p {
104 p, .br {
105 margin-top: .5em;
105 margin-top: .5em;
106 margin-bottom: .5em;
106 margin-bottom: .5em;
107 }
107 }
108
108
109 br {
110 margin-bottom: .5em;
111 }
112
113 .post-form-w {
109 .post-form-w {
114 background: #333344;
110 background: #333344;
115 border-top: solid 1px #888;
111 border-top: solid 1px #888;
@@ -254,6 +250,10 b' a:hover {'
254 border-right: solid 1px #777;
250 border-right: solid 1px #777;
255 }
251 }
256
252
253 .last-replies > .post:first-child {
254 border-top: none;
255 }
256
257 .thread {
257 .thread {
258 margin-bottom: 3ex;
258 margin-bottom: 3ex;
259 margin-top: 1ex;
259 margin-top: 1ex;
@@ -381,6 +381,7 b' li {'
381 margin-right: 3ex;
381 margin-right: 3ex;
382 border-left: solid 1px #888;
382 border-left: solid 1px #888;
383 border-right: solid 1px #888;
383 border-right: solid 1px #888;
384 border-bottom: solid 1px #888;
384 background: #000;
385 background: #000;
385 }
386 }
386
387
@@ -133,7 +133,7 b' p {'
133 vertical-align: middle;
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 background: #fff;
137 background: #fff;
138 color: #000;
138 color: #000;
139 border: solid 1px;
139 border: solid 1px;
@@ -352,3 +352,13 b' input[type="submit"]:hover {'
352 margin: 0.3ex;
352 margin: 0.3ex;
353 padding: 0.2ex;
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 >#{{ tag.name }}</a>,
32 >#{{ tag.name }}</a>,
33 {% endfor %}
33 {% endfor %}
34 <a href="{% url 'tags' %}" title="{% trans 'Tag management' %}"
34 <a href="{% url 'tags' %}" title="{% trans 'Tag management' %}"
35 >[...]</a>
35 >[...]</a>,
36 <a href="{% url 'search' %}" title="{% trans 'Search' %}">[S]</a>
36 <a class="link" href="{% url 'settings' %}">{% trans 'Settings' %}</a>
37 <a class="link" href="{% url 'settings' %}">{% trans 'Settings' %}</a>
37 </div>
38 </div>
38
39
@@ -47,7 +48,6 b''
47 <div class="navigation_panel">
48 <div class="navigation_panel">
48 {% block metapanel %}{% endblock %}
49 {% block metapanel %}{% endblock %}
49 [<a href="{% url 'admin:index' %}">{% trans 'Admin' %}</a>]
50 [<a href="{% url 'admin:index' %}">{% trans 'Admin' %}</a>]
50 [<a href="{% url 'search' %}">{% trans 'Search' %}</a>]
51 {% with ppd=posts_per_day|floatformat:2 %}
51 {% with ppd=posts_per_day|floatformat:2 %}
52 {% blocktrans %}Speed: {{ ppd }} posts per day{% endblocktrans %}
52 {% blocktrans %}Speed: {{ ppd }} posts per day{% endblocktrans %}
53 {% endwith %}
53 {% endwith %}
@@ -15,4 +15,6 b''
15 <p>[s]<span class="strikethrough">{% trans 'Strikethrough text' %}</span>[/s]</p>
15 <p>[s]<span class="strikethrough">{% trans 'Strikethrough text' %}</span>[/s]</p>
16 <p>[comment]<span class="comment">{% trans 'Comment' %}</span>[/comment]</p>
16 <p>[comment]<span class="comment">{% trans 'Comment' %}</span>[/comment]</p>
17 <p>[quote]<span class="multiquote">{% trans 'Quote' %}</span>[/quote]</p>
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 {% endblock %}
20 {% endblock %}
@@ -10,6 +10,7 b' from boards.views.ban import BanUserView'
10 from boards.views.search import BoardSearchView
10 from boards.views.search import BoardSearchView
11 from boards.views.static import StaticPageView
11 from boards.views.static import StaticPageView
12 from boards.views.post_admin import PostAdminView
12 from boards.views.post_admin import PostAdminView
13 from boards.views.preview import PostPreviewView
13
14
14 js_info_dict = {
15 js_info_dict = {
15 'packages': ('boards',),
16 'packages': ('boards',),
@@ -76,4 +77,7 b" urlpatterns = patterns('',"
76 # Search
77 # Search
77 url(r'^search/$', BoardSearchView.as_view(), name='search'),
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