Show More
@@ -0,0 +1,74 b'' | |||
|
1 | {% extends "boards/base.html" %} | |
|
2 | ||
|
3 | {% load i18n %} | |
|
4 | {% load board %} | |
|
5 | {% load static %} | |
|
6 | {% load tz %} | |
|
7 | ||
|
8 | {% block head %} | |
|
9 | <meta name="robots" content="noindex"> | |
|
10 | ||
|
11 | <title>{{ site_name }} - {% trans "feed" %}</title> | |
|
12 | ||
|
13 | {% if prev_page_link %} | |
|
14 | <link rel="prev" href="{{ prev_page_link }}" /> | |
|
15 | {% endif %} | |
|
16 | {% if next_page_link %} | |
|
17 | <link rel="next" href="{{ next_page_link }}" /> | |
|
18 | {% endif %} | |
|
19 | ||
|
20 | {% endblock %} | |
|
21 | ||
|
22 | {% block content %} | |
|
23 | ||
|
24 | {% get_current_language as LANGUAGE_CODE %} | |
|
25 | {% get_current_timezone as TIME_ZONE %} | |
|
26 | ||
|
27 | {% if posts %} | |
|
28 | {% if prev_page_link %} | |
|
29 | <div class="page_link"> | |
|
30 | <a href="{{ prev_page_link }}">{% trans "Previous page" %}</a> | |
|
31 | </div> | |
|
32 | {% endif %} | |
|
33 | ||
|
34 | {% for post in posts %} | |
|
35 | {% post_view post moderator=moderator truncated=True %} | |
|
36 | {% endfor %} | |
|
37 | ||
|
38 | {% if next_page_link %} | |
|
39 | <div class="page_link"> | |
|
40 | <a href="{{ next_page_link }}">{% trans "Next page" %}</a> | |
|
41 | </div> | |
|
42 | {% endif %} | |
|
43 | {% else %} | |
|
44 | <div class="post"> | |
|
45 | {% trans 'No posts exist. Create the first one!' %}</div> | |
|
46 | {% endif %} | |
|
47 | {% endblock %} | |
|
48 | ||
|
49 | {% block metapanel %} | |
|
50 | ||
|
51 | <span class="metapanel"> | |
|
52 | <b><a href="{% url "authors" %}">{{ site_name }}</a> {{ version }}</b> | |
|
53 | {% trans "Pages:" %} | |
|
54 | <a href=" | |
|
55 | {% url "feed" page=paginator.page_range|first %} | |
|
56 | "><<</a> | |
|
57 | [ | |
|
58 | {% for page in paginator.center_range %} | |
|
59 | <a | |
|
60 | {% ifequal page current_page.number %} | |
|
61 | class="current_page" | |
|
62 | {% endifequal %} | |
|
63 | href=" | |
|
64 | {% url "feed" page=page %} | |
|
65 | ">{{ page }}</a> | |
|
66 | {% if not forloop.last %},{% endif %} | |
|
67 | {% endfor %} | |
|
68 | ] | |
|
69 | <a href=" | |
|
70 | {% url "feed" page=paginator.page_range|last %} | |
|
71 | ">>></a> | |
|
72 | </span> | |
|
73 | ||
|
74 | {% endblock %} |
@@ -0,0 +1,65 b'' | |||
|
1 | from django.core.urlresolvers import reverse | |
|
2 | from django.core.files import File | |
|
3 | from django.core.files.temp import NamedTemporaryFile | |
|
4 | from django.core.paginator import EmptyPage | |
|
5 | from django.db import transaction | |
|
6 | from django.http import Http404 | |
|
7 | from django.shortcuts import render, redirect | |
|
8 | import requests | |
|
9 | ||
|
10 | from boards import utils, settings | |
|
11 | from boards.abstracts.paginator import get_paginator | |
|
12 | from boards.models import Post, Thread, Ban, Tag, PostImage, Banner | |
|
13 | from boards.views.base import BaseBoardView | |
|
14 | from boards.views.posting_mixin import PostMixin | |
|
15 | ||
|
16 | ||
|
17 | PARAMETER_CURRENT_PAGE = 'current_page' | |
|
18 | PARAMETER_PAGINATOR = 'paginator' | |
|
19 | PARAMETER_POSTS = 'posts' | |
|
20 | ||
|
21 | PARAMETER_PREV_LINK = 'prev_page_link' | |
|
22 | PARAMETER_NEXT_LINK = 'next_page_link' | |
|
23 | ||
|
24 | TEMPLATE = 'boards/feed.html' | |
|
25 | DEFAULT_PAGE = 1 | |
|
26 | ||
|
27 | ||
|
28 | class FeedView(PostMixin, BaseBoardView): | |
|
29 | ||
|
30 | def get(self, request, page=DEFAULT_PAGE): | |
|
31 | params = self.get_context_data(request=request) | |
|
32 | ||
|
33 | paginator = get_paginator(Post.objects.order_by('-pub_time'), 10) | |
|
34 | paginator.current_page = int(page) | |
|
35 | ||
|
36 | params[PARAMETER_POSTS] = paginator.page(page).object_list | |
|
37 | ||
|
38 | self.get_page_context(paginator, params, page) | |
|
39 | ||
|
40 | return render(request, TEMPLATE, params) | |
|
41 | ||
|
42 | # TODO Dedup this into PagedMixin | |
|
43 | def get_page_context(self, paginator, params, page): | |
|
44 | """ | |
|
45 | Get pagination context variables | |
|
46 | """ | |
|
47 | ||
|
48 | params[PARAMETER_PAGINATOR] = paginator | |
|
49 | current_page = paginator.page(int(page)) | |
|
50 | params[PARAMETER_CURRENT_PAGE] = current_page | |
|
51 | if current_page.has_previous(): | |
|
52 | params[PARAMETER_PREV_LINK] = self.get_previous_page_link( | |
|
53 | current_page) | |
|
54 | if current_page.has_next(): | |
|
55 | params[PARAMETER_NEXT_LINK] = self.get_next_page_link(current_page) | |
|
56 | ||
|
57 | def get_previous_page_link(self, current_page): | |
|
58 | return reverse('feed', kwargs={ | |
|
59 | 'page': current_page.previous_page_number(), | |
|
60 | }) | |
|
61 | ||
|
62 | def get_next_page_link(self, current_page): | |
|
63 | return reverse('feed', kwargs={ | |
|
64 | 'page': current_page.next_page_number(), | |
|
65 | }) |
|
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: 2015-05- |
|
|
10 | "POT-Creation-Date: 2015-05-14 12:40+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" |
@@ -89,20 +89,20 b' msgstr "\xd0\x94\xd0\xbe\xd0\xbf\xd0\xbe\xd0\xbb\xd0\xbd\xd0\xb8\xd1\x82\xd0\xb5\xd0\xbb\xd1\x8c\xd0\xbd\xd1\x8b\xd0\xb5 \xd1\x82\xd0\xb5\xd0\xbc\xd1\x8b"' | |||
|
89 | 89 | msgid "Title must have less than %s characters" |
|
90 | 90 | msgstr "Заголовок должен иметь меньше %s символов" |
|
91 | 91 | |
|
92 |
#: forms.py:17 |
|
|
92 | #: forms.py:177 | |
|
93 | 93 | #, python-format |
|
94 | 94 | msgid "Text must have less than %s characters" |
|
95 | 95 | msgstr "Текст должен быть короче %s символов" |
|
96 | 96 | |
|
97 |
#: forms.py:19 |
|
|
97 | #: forms.py:197 | |
|
98 | 98 | msgid "Invalid URL" |
|
99 | 99 | msgstr "Неверный URL" |
|
100 | 100 | |
|
101 |
#: forms.py:21 |
|
|
101 | #: forms.py:218 | |
|
102 | 102 | msgid "Invalid additional thread list" |
|
103 | 103 | msgstr "Неверный список дополнительных тем" |
|
104 | 104 | |
|
105 |
#: forms.py:25 |
|
|
105 | #: forms.py:250 | |
|
106 | 106 | msgid "Either text or image must be entered." |
|
107 | 107 | msgstr "Текст или картинка должны быть введены." |
|
108 | 108 | |
@@ -111,8 +111,8 b' msgstr "\xd0\xa2\xd0\xb5\xd0\xba\xd1\x81\xd1\x82 \xd0\xb8\xd0\xbb\xd0\xb8 \xd0\xba\xd0\xb0\xd1\x80\xd1\x82\xd0\xb8\xd0\xbd\xd0\xba\xd0\xb0 \xd0\xb4\xd0\xbe\xd0\xbb\xd0\xb6\xd0\xbd\xd1\x8b \xd0\xb1\xd1\x8b\xd1\x82\xd1\x8c \xd0\xb2\xd0\xb2\xd0\xb5\xd0\xb4\xd0\xb5\xd0\xbd\xd1\x8b."' | |||
|
111 | 111 | msgid "Image must be less than %s bytes" |
|
112 | 112 | msgstr "Изображение должно быть менее %s байт" |
|
113 | 113 | |
|
114 |
#: forms.py:335 templates/boards/ |
|
|
115 |
#: templates/boards/rss/post.html:10 templates/boards/tags.html: |
|
|
114 | #: forms.py:335 templates/boards/all_threads.html:129 | |
|
115 | #: templates/boards/rss/post.html:10 templates/boards/tags.html:6 | |
|
116 | 116 | msgid "Tags" |
|
117 | 117 | msgstr "Метки" |
|
118 | 118 | |
@@ -152,6 +152,61 b' msgstr "\xd0\x9d\xd0\xb5 \xd0\xbd\xd0\xb0\xd0\xb9\xd0\xb4\xd0\xb5\xd0\xbd\xd0\xbe"' | |||
|
152 | 152 | msgid "This page does not exist" |
|
153 | 153 | msgstr "Этой страницы не существует" |
|
154 | 154 | |
|
155 | #: templates/boards/all_threads.html:35 | |
|
156 | msgid "Related message" | |
|
157 | msgstr "Связанное сообщение" | |
|
158 | ||
|
159 | #: templates/boards/all_threads.html:60 | |
|
160 | msgid "Edit tag" | |
|
161 | msgstr "Изменить метку" | |
|
162 | ||
|
163 | #: templates/boards/all_threads.html:63 | |
|
164 | #, python-format | |
|
165 | msgid "This tag has %(thread_count)s threads and %(post_count)s posts." | |
|
166 | msgstr "С этой меткой есть %(thread_count)s тем и %(post_count)s сообщений." | |
|
167 | ||
|
168 | #: templates/boards/all_threads.html:70 templates/boards/feed.html:30 | |
|
169 | #: templates/boards/notifications.html:17 templates/search/search.html:26 | |
|
170 | msgid "Previous page" | |
|
171 | msgstr "Предыдущая страница" | |
|
172 | ||
|
173 | #: templates/boards/all_threads.html:84 | |
|
174 | #, python-format | |
|
175 | msgid "Skipped %(count)s replies. Open thread to see all replies." | |
|
176 | msgstr "Пропущено %(count)s ответов. Откройте тред, чтобы увидеть все ответы." | |
|
177 | ||
|
178 | #: templates/boards/all_threads.html:102 templates/boards/feed.html:40 | |
|
179 | #: templates/boards/notifications.html:27 templates/search/search.html:37 | |
|
180 | msgid "Next page" | |
|
181 | msgstr "Следующая страница" | |
|
182 | ||
|
183 | #: templates/boards/all_threads.html:107 | |
|
184 | msgid "No threads exist. Create the first one!" | |
|
185 | msgstr "Нет тем. Создайте первую!" | |
|
186 | ||
|
187 | #: templates/boards/all_threads.html:113 | |
|
188 | msgid "Create new thread" | |
|
189 | msgstr "Создать новую тему" | |
|
190 | ||
|
191 | #: templates/boards/all_threads.html:118 templates/boards/preview.html:16 | |
|
192 | #: templates/boards/thread_normal.html:43 | |
|
193 | msgid "Post" | |
|
194 | msgstr "Отправить" | |
|
195 | ||
|
196 | #: templates/boards/all_threads.html:123 | |
|
197 | msgid "Tags must be delimited by spaces. Text or image is required." | |
|
198 | msgstr "" | |
|
199 | "Метки должны быть разделены пробелами. Текст или изображение обязательны." | |
|
200 | ||
|
201 | #: templates/boards/all_threads.html:126 | |
|
202 | #: templates/boards/thread_normal.html:48 | |
|
203 | msgid "Text syntax" | |
|
204 | msgstr "Синтаксис текста" | |
|
205 | ||
|
206 | #: templates/boards/all_threads.html:143 templates/boards/feed.html:53 | |
|
207 | msgid "Pages:" | |
|
208 | msgstr "Страницы: " | |
|
209 | ||
|
155 | 210 | #: templates/boards/authors.html:6 templates/boards/authors.html.py:12 |
|
156 | 211 | msgid "Authors" |
|
157 | 212 | msgstr "Авторы" |
@@ -168,7 +223,7 b' msgstr "\xd0\xbb\xd0\xb8\xd1\x86\xd0\xb5\xd0\xbd\xd0\xb7\xd0\xb8\xd0\xb5\xd0\xb9"' | |||
|
168 | 223 | msgid "Repository" |
|
169 | 224 | msgstr "Репозиторий" |
|
170 | 225 | |
|
171 | #: templates/boards/base.html:14 | |
|
226 | #: templates/boards/base.html:14 templates/boards/base.html.py:42 | |
|
172 | 227 | msgid "Feed" |
|
173 | 228 | msgstr "Лента" |
|
174 | 229 | |
@@ -184,37 +239,36 b' msgstr "\xd0\x94\xd0\xbe\xd0\xb1\xd0\xb0\xd0\xb2\xd0\xb8\xd1\x82\xd1\x8c \xd0\xbc\xd0\xb5\xd1\x82\xd0\xba\xd0\xb8"' | |||
|
184 | 239 | msgid "Tag management" |
|
185 | 240 | msgstr "Управление метками" |
|
186 | 241 | |
|
187 |
#: templates/boards/base.html:4 |
|
|
242 | #: templates/boards/base.html:45 templates/boards/base.html.py:46 | |
|
188 | 243 | #: templates/boards/notifications.html:8 |
|
189 | 244 | msgid "Notifications" |
|
190 | 245 | msgstr "Уведомления" |
|
191 | 246 | |
|
192 |
#: templates/boards/base.html:5 |
|
|
247 | #: templates/boards/base.html:53 templates/boards/settings.html:8 | |
|
193 | 248 | msgid "Settings" |
|
194 | 249 | msgstr "Настройки" |
|
195 | 250 | |
|
196 |
#: templates/boards/base.html:6 |
|
|
251 | #: templates/boards/base.html:66 | |
|
197 | 252 | msgid "Admin" |
|
198 | 253 | msgstr "Администрирование" |
|
199 | 254 | |
|
200 |
#: templates/boards/base.html:6 |
|
|
255 | #: templates/boards/base.html:68 | |
|
201 | 256 | #, python-format |
|
202 | 257 | msgid "Speed: %(ppd)s posts per day" |
|
203 | 258 | msgstr "Скорость: %(ppd)s сообщений в день" |
|
204 | 259 | |
|
205 |
#: templates/boards/base.html: |
|
|
260 | #: templates/boards/base.html:70 | |
|
206 | 261 | msgid "Up" |
|
207 | 262 | msgstr "Вверх" |
|
208 | 263 | |
|
209 |
#: templates/boards/ |
|
|
210 | #: templates/boards/posting_general.html:70 templates/search/search.html:26 | |
|
211 | msgid "Previous page" | |
|
212 | msgstr "Предыдущая страница" | |
|
264 | #: templates/boards/feed.html:11 | |
|
265 | msgid "feed" | |
|
266 | msgstr "" | |
|
213 | 267 | |
|
214 |
#: templates/boards/ |
|
|
215 | #: templates/boards/posting_general.html:102 templates/search/search.html:37 | |
|
216 | msgid "Next page" | |
|
217 | msgstr "Следующая страница" | |
|
268 | #: templates/boards/feed.html:45 | |
|
269 | #| msgid "No threads exist. Create the first one!" | |
|
270 | msgid "No posts exist. Create the first one!" | |
|
271 | msgstr "Нет сообщений. Создайте первое!" | |
|
218 | 272 | |
|
219 | 273 | #: templates/boards/post.html:24 |
|
220 | 274 | msgid "Open" |
@@ -244,52 +298,6 b' msgstr "\xd1\x81\xd0\xbe\xd0\xbe\xd0\xb1\xd1\x89\xd0\xb5\xd0\xbd\xd0\xb8\xd0\xb9"' | |||
|
244 | 298 | msgid "images" |
|
245 | 299 | msgstr "изображений" |
|
246 | 300 | |
|
247 | #: templates/boards/posting_general.html:35 | |
|
248 | #| msgid "messages" | |
|
249 | msgid "Related message" | |
|
250 | msgstr "Связанное сообщение" | |
|
251 | ||
|
252 | #: templates/boards/posting_general.html:60 | |
|
253 | msgid "Edit tag" | |
|
254 | msgstr "Изменить метку" | |
|
255 | ||
|
256 | #: templates/boards/posting_general.html:63 | |
|
257 | #, python-format | |
|
258 | msgid "This tag has %(thread_count)s threads and %(post_count)s posts." | |
|
259 | msgstr "С этой меткой есть %(thread_count)s тем и %(post_count)s сообщений." | |
|
260 | ||
|
261 | #: templates/boards/posting_general.html:84 | |
|
262 | #, python-format | |
|
263 | msgid "Skipped %(count)s replies. Open thread to see all replies." | |
|
264 | msgstr "Пропущено %(count)s ответов. Откройте тред, чтобы увидеть все ответы." | |
|
265 | ||
|
266 | #: templates/boards/posting_general.html:107 | |
|
267 | msgid "No threads exist. Create the first one!" | |
|
268 | msgstr "Нет тем. Создайте первую!" | |
|
269 | ||
|
270 | #: templates/boards/posting_general.html:113 | |
|
271 | msgid "Create new thread" | |
|
272 | msgstr "Создать новую тему" | |
|
273 | ||
|
274 | #: templates/boards/posting_general.html:118 templates/boards/preview.html:16 | |
|
275 | #: templates/boards/thread_normal.html:43 | |
|
276 | msgid "Post" | |
|
277 | msgstr "Отправить" | |
|
278 | ||
|
279 | #: templates/boards/posting_general.html:123 | |
|
280 | msgid "Tags must be delimited by spaces. Text or image is required." | |
|
281 | msgstr "" | |
|
282 | "Метки должны быть разделены пробелами. Текст или изображение обязательны." | |
|
283 | ||
|
284 | #: templates/boards/posting_general.html:126 | |
|
285 | #: templates/boards/thread_normal.html:48 | |
|
286 | msgid "Text syntax" | |
|
287 | msgstr "Синтаксис текста" | |
|
288 | ||
|
289 | #: templates/boards/posting_general.html:143 | |
|
290 | msgid "Pages:" | |
|
291 | msgstr "Страницы: " | |
|
292 | ||
|
293 | 301 | #: templates/boards/preview.html:6 templates/boards/staticpages/help.html:20 |
|
294 | 302 | msgid "Preview" |
|
295 | 303 | msgstr "Предпросмотр" |
@@ -360,11 +368,11 b' msgstr "\xd0\xa6\xd0\xb8\xd1\x82\xd0\xb0\xd1\x82\xd0\xb0"' | |||
|
360 | 368 | msgid "You can try pasting the text and previewing the result here:" |
|
361 | 369 | msgstr "Вы можете попробовать вставить текст и проверить результат здесь:" |
|
362 | 370 | |
|
363 |
#: templates/boards/tags.html:2 |
|
|
371 | #: templates/boards/tags.html:21 | |
|
364 | 372 | msgid "No tags found." |
|
365 | 373 | msgstr "Метки не найдены." |
|
366 | 374 | |
|
367 |
#: templates/boards/tags.html:2 |
|
|
375 | #: templates/boards/tags.html:24 | |
|
368 | 376 | msgid "All tags" |
|
369 | 377 | msgstr "Все метки" |
|
370 | 378 | |
@@ -405,4 +413,3 b' msgstr "\xd0\x9e\xd0\xb1\xd0\xbd\xd0\xbe\xd0\xb2\xd0\xb8\xd1\x82\xd1\x8c"' | |||
|
405 | 413 | #: templates/search/search.html:17 |
|
406 | 414 | msgid "Ok" |
|
407 | 415 | msgstr "Ок" |
|
408 |
@@ -38,7 +38,8 b'' | |||
|
38 | 38 | {% endif %} |
|
39 | 39 | <a href="{% url 'tags' 'required'%}" title="{% trans 'Tag management' %}" |
|
40 | 40 | >[...]</a>, |
|
41 |
<a href="{% url 'search' %}" title="{% trans 'Search' %}">[S]</a> |
|
|
41 | <a href="{% url 'search' %}" title="{% trans 'Search' %}">[S]</a>, | |
|
42 | <a href="{% url 'feed' %}" title="{% trans 'Feed' %}">[F]</a>. | |
|
42 | 43 | |
|
43 | 44 | {% if username %} |
|
44 | 45 | <a class="right-link link" href="{% url 'notifications' username %}" title="{% trans 'Notifications' %}"> |
@@ -4,7 +4,7 b' from django.views.i18n import javascript' | |||
|
4 | 4 | from boards import views |
|
5 | 5 | from boards.rss import AllThreadsFeed, TagThreadsFeed, ThreadPostsFeed |
|
6 | 6 | from boards.views import api, tag_threads, all_threads, \ |
|
7 | settings, all_tags | |
|
7 | settings, all_tags, feed | |
|
8 | 8 | from boards.views.authors import AuthorsView |
|
9 | 9 | from boards.views.notifications import NotificationView |
|
10 | 10 | from boards.views.search import BoardSearchView |
@@ -35,6 +35,10 b" urlpatterns = patterns(''," | |||
|
35 | 35 | name='thread'), |
|
36 | 36 | url(r'^thread/(?P<post_id>\d+)/mode/gallery/$', views.thread.gallery.GalleryThreadView.as_view(), |
|
37 | 37 | name='thread_gallery'), |
|
38 | # /feed/ | |
|
39 | url(r'^feed/$', views.feed.FeedView.as_view(), name='feed'), | |
|
40 | url(r'^feed/page/(?P<page>\w+)/$', views.feed.FeedView.as_view(), | |
|
41 | name='feed'), | |
|
38 | 42 | |
|
39 | 43 | url(r'^settings/$', settings.SettingsView.as_view(), name='settings'), |
|
40 | 44 | url(r'^tags/(?P<query>\w+)?/?$', all_tags.AllTagsView.as_view(), name='tags'), |
General Comments 0
You need to be logged in to leave comments.
Login now