##// END OF EJS Templates
Added field to hold the "main" thread. When connecting reflinks, connect...
Added field to hold the "main" thread. When connecting reflinks, connect threads also

File last commit:

r951:225d57cf default
r980:3fbf1166 default
Show More
normal.py
38 lines | 980 B | text/x-python | PythonLexer
from boards import settings
from boards.views.thread import ThreadView
TEMPLATE_NORMAL = 'boards/thread.html'
CONTEXT_OP = 'opening_post'
CONTEXT_BUMPLIMIT_PRG = 'bumplimit_progress'
CONTEXT_POSTS_LEFT = 'posts_left'
CONTEXT_BUMPABLE = 'bumpable'
FORM_TITLE = 'title'
FORM_TEXT = 'text'
FORM_IMAGE = 'image'
MODE_GALLERY = 'gallery'
MODE_NORMAL = 'normal'
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
if bumpable:
left_posts = settings.MAX_POSTS_PER_THREAD \
- thread.get_reply_count()
params[CONTEXT_POSTS_LEFT] = left_posts
params[CONTEXT_BUMPLIMIT_PRG] = str(
float(left_posts) / settings.MAX_POSTS_PER_THREAD * 100)
params[CONTEXT_OP] = thread.get_opening_post()
return params