##// END OF EJS Templates
Show max file size in the posting templates
neko259 -
r1396:52abbcde default
parent child Browse files
Show More
1 NO CONTENT: modified file, binary diff hidden
NO CONTENT: modified file, binary diff hidden
@@ -499,3 +499,7 b' msgstr[2] "\xd0\x9f\xd0\xbe\xd0\xb6\xd0\xb0\xd0\xbb\xd1\x83\xd0\xb9\xd1\x81\xd1\x82\xd0\xb0 \xd0\xbf\xd0\xbe\xd0\xb4\xd0\xbe\xd0\xb6\xd0\xb4\xd0\xb8\xd1\x82\xd0\xb5 %(delay)d \xd1\x81\xd0\xb5\xd0\xba\xd1\x83\xd0\xbd\xd0\xb4 \xd0\xbf\xd0\xb5\xd1\x80\xd0\xb5\xd0\xb4 \xd0\xbe\xd1\x82\xd0\xbf\xd1\x80\xd0\xb0\xd0\xb2\xd0\xba\xd0\xbe\xd0\xb9 \xd1\x81\xd0\xbe\xd0\xbe\xd0\xb1\xd1\x89\xd0\xb5\xd0\xbd\xd0\xb8\xd1\x8f"'
499
499
500 msgid "New threads"
500 msgid "New threads"
501 msgstr "Новые темы"
501 msgstr "Новые темы"
502
503 #, python-format
504 msgid "Max file size is %(size)s."
505 msgstr "Максимальный размер файла %(size)s."
@@ -148,6 +148,9 b''
148 </div>
148 </div>
149 <div>
149 <div>
150 {% trans 'Tags must be delimited by spaces. Text or image is required.' %}
150 {% trans 'Tags must be delimited by spaces. Text or image is required.' %}
151 {% with size=max_file_size|filesizeformat %}
152 {% blocktrans %}Max file size is {{ size }}.{% endblocktrans %}
153 {% endwith %}
151 </div>
154 </div>
152 <div id="preview-text"></div>
155 <div id="preview-text"></div>
153 <div><a href="{% url "staticpage" name="help" %}">{% trans 'Text syntax' %}</a></div>
156 <div><a href="{% url "staticpage" name="help" %}">{% trans 'Text syntax' %}</a></div>
@@ -54,6 +54,11 b''
54 </form>
54 </form>
55 </div>
55 </div>
56 <div id="preview-text"></div>
56 <div id="preview-text"></div>
57 <div>
58 {% with size=max_file_size|filesizeformat %}
59 {% blocktrans %}Max file size is {{ size }}.{% endblocktrans %}
60 {% endwith %}
61 </div>
57 <div><a href="{% url "staticpage" name="help" %}">
62 <div><a href="{% url "staticpage" name="help" %}">
58 {% trans 'Text syntax' %}</a></div>
63 {% trans 'Text syntax' %}</a></div>
59 <div><a id="form-close-button" href="#" onClick="resetFormPosition(); return false;">{% trans 'Close form' %}</a></div>
64 <div><a id="form-close-button" href="#" onClick="resetFormPosition(); return false;">{% trans 'Close form' %}</a></div>
@@ -15,6 +15,7 b' from boards.models import Post, Thread, '
15 from boards.views.banned import BannedView
15 from boards.views.banned import BannedView
16 from boards.views.base import BaseBoardView, CONTEXT_FORM
16 from boards.views.base import BaseBoardView, CONTEXT_FORM
17 from boards.views.posting_mixin import PostMixin
17 from boards.views.posting_mixin import PostMixin
18 from boards.views.mixins import FileUploadMixin
18
19
19
20
20 FORM_TAGS = 'tags'
21 FORM_TAGS = 'tags'
@@ -30,6 +31,7 b" PARAMETER_PAGINATOR = 'paginator'"
30 PARAMETER_THREADS = 'threads'
31 PARAMETER_THREADS = 'threads'
31 PARAMETER_BANNERS = 'banners'
32 PARAMETER_BANNERS = 'banners'
32 PARAMETER_ADDITIONAL = 'additional_params'
33 PARAMETER_ADDITIONAL = 'additional_params'
34 PARAMETER_MAX_FILE_SIZE = 'max_file_size'
33
35
34 PARAMETER_PREV_LINK = 'prev_page_link'
36 PARAMETER_PREV_LINK = 'prev_page_link'
35 PARAMETER_NEXT_LINK = 'next_page_link'
37 PARAMETER_NEXT_LINK = 'next_page_link'
@@ -38,7 +40,7 b" TEMPLATE = 'boards/all_threads.html'"
38 DEFAULT_PAGE = 1
40 DEFAULT_PAGE = 1
39
41
40
42
41 class AllThreadsView(PostMixin, BaseBoardView):
43 class AllThreadsView(PostMixin, FileUploadMixin, BaseBoardView):
42
44
43 def __init__(self):
45 def __init__(self):
44 self.settings_manager = None
46 self.settings_manager = None
@@ -74,6 +76,7 b' class AllThreadsView(PostMixin, BaseBoar'
74 params[PARAMETER_THREADS] = threads
76 params[PARAMETER_THREADS] = threads
75 params[CONTEXT_FORM] = form
77 params[CONTEXT_FORM] = form
76 params[PARAMETER_BANNERS] = Banner.objects.order_by('-id').all()
78 params[PARAMETER_BANNERS] = Banner.objects.order_by('-id').all()
79 params[PARAMETER_MAX_FILE_SIZE] = self.get_max_upload_size()
77
80
78 paginator.set_url(self.get_reverse_url(), request.GET.dict())
81 paginator.set_url(self.get_reverse_url(), request.GET.dict())
79 self.get_page_context(paginator, params, page)
82 self.get_page_context(paginator, params, page)
@@ -1,3 +1,6 b''
1 import boards
2
3
1 PARAM_NEXT = 'next'
4 PARAM_NEXT = 'next'
2 PARAMETER_METHOD = 'method'
5 PARAMETER_METHOD = 'method'
3
6
@@ -24,3 +27,8 b' class DispatcherMixin:'
24
27
25 if method_name:
28 if method_name:
26 return getattr(self, method_name)(*args, **kwargs)
29 return getattr(self, method_name)(*args, **kwargs)
30
31
32 class FileUploadMixin:
33 def get_max_upload_size(self):
34 return boards.settings.get_int('Forms', 'MaxFileSize')
@@ -1,13 +1,15 b''
1 from boards.views.thread import ThreadView
1 from boards.views.thread import ThreadView
2 from boards.views.mixins import FileUploadMixin
2
3
3 TEMPLATE_NORMAL = 'boards/thread_normal.html'
4 TEMPLATE_NORMAL = 'boards/thread_normal.html'
4
5
5 CONTEXT_BUMPLIMIT_PRG = 'bumplimit_progress'
6 CONTEXT_BUMPLIMIT_PRG = 'bumplimit_progress'
6 CONTEXT_POSTS_LEFT = 'posts_left'
7 CONTEXT_POSTS_LEFT = 'posts_left'
7 CONTEXT_BUMPABLE = 'bumpable'
8 CONTEXT_BUMPABLE = 'bumpable'
9 PARAM_MAX_FILE_SIZE = 'max_file_size'
8
10
9
11
10 class NormalThreadView(ThreadView):
12 class NormalThreadView(ThreadView, FileUploadMixin):
11
13
12 def get_template(self):
14 def get_template(self):
13 return TEMPLATE_NORMAL
15 return TEMPLATE_NORMAL
@@ -26,5 +28,6 b' class NormalThreadView(ThreadView):'
26 params[CONTEXT_POSTS_LEFT] = left_posts
28 params[CONTEXT_POSTS_LEFT] = left_posts
27 params[CONTEXT_BUMPLIMIT_PRG] = str(
29 params[CONTEXT_BUMPLIMIT_PRG] = str(
28 float(left_posts) / max_posts * 100)
30 float(left_posts) / max_posts * 100)
31 params[PARAM_MAX_FILE_SIZE] = self.get_max_upload_size()
29
32
30 return params
33 return params
General Comments 0
You need to be logged in to leave comments. Login now