##// END OF EJS Templates
Cosmetic changes to preview button in md theme
Cosmetic changes to preview button in md theme

File last commit:

r1185:ef257c39 default
r1218:449b2690 default
Show More
normal.py
30 lines | 811 B | text/x-python | PythonLexer
from boards.views.thread import ThreadView
TEMPLATE_NORMAL = 'boards/thread_normal.html'
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_mode(self):
return 'normal'
def get_data(self, thread):
params = dict()
bumpable = thread.can_bump()
params[CONTEXT_BUMPABLE] = bumpable
max_posts = thread.max_posts
if bumpable and thread.has_post_limit():
left_posts = max_posts - thread.get_reply_count()
params[CONTEXT_POSTS_LEFT] = left_posts
params[CONTEXT_BUMPLIMIT_PRG] = str(
float(left_posts) / max_posts * 100)
return params