##// END OF EJS Templates
Added tag 2.6.0 for changeset 1b631781ced3
Added tag 2.6.0 for changeset 1b631781ced3

File last commit:

r1052:a66b11af default
r1054:0a7a1aca default
Show More
normal.py
31 lines | 846 B | text/x-python | PythonLexer
neko259
Split thread view into separate views for each mode
r951 from boards import settings
from boards.views.thread import ThreadView
neko259
Made normal and gallery view use the same super-template with the same...
r1042 TEMPLATE_NORMAL = 'boards/thread_normal.html'
neko259
Split thread view into separate views for each mode
r951
CONTEXT_OP = 'opening_post'
CONTEXT_BUMPLIMIT_PRG = 'bumplimit_progress'
CONTEXT_POSTS_LEFT = 'posts_left'
CONTEXT_BUMPABLE = 'bumpable'
class NormalThreadView(ThreadView):
def get_template(self):
return TEMPLATE_NORMAL
def get_data(self, thread):
params = dict()
bumpable = thread.can_bump()
params[CONTEXT_BUMPABLE] = bumpable
neko259
Save bump limit separately for every thread
r1052 max_posts = thread.max_posts
neko259
Split thread view into separate views for each mode
r951 if bumpable:
neko259
Save bump limit separately for every thread
r1052 left_posts = max_posts - thread.get_reply_count()
neko259
Split thread view into separate views for each mode
r951 params[CONTEXT_POSTS_LEFT] = left_posts
params[CONTEXT_BUMPLIMIT_PRG] = str(
neko259
Save bump limit separately for every thread
r1052 float(left_posts) / max_posts * 100)
neko259
Split thread view into separate views for each mode
r951
params[CONTEXT_OP] = thread.get_opening_post()
return params