##// END OF EJS Templates
Run js highlight on the new posts only, not on all page each time. Add...
Run js highlight on the new posts only, not on all page each time. Add highlight to the reflink popups

File last commit:

r692:d0013853 1.8-dev
r709:e6788412 default
Show More
board.py
89 lines | 2.0 KiB | text/x-python | PythonLexer
neko259
Added a template tag to get post link instead of using jumper
r320 from django.shortcuts import get_object_or_404
from django import template
neko259
Added tag search. Refactored search to show any model results in a list.
r692
neko259
Added a template tag to get post link instead of using jumper
r320 register = template.Library()
neko259
Added metadata to the gallery. Added links to search the image by the online search engines
r460 actions = [
{
'name': 'google',
'link': 'http://google.com/searchbyimage?image_url=%s',
},
{
'name': 'iqdb',
'link': 'http://iqdb.org/?url=%s',
},
]
neko259
Added a template tag to get post link instead of using jumper
r320
@register.simple_tag(name='post_url')
def post_url(*args, **kwargs):
post_id = args[0]
neko259
Added tag search. Refactored search to show any model results in a list.
r692 post = get_object_or_404('Post', id=post_id)
neko259
Added a template tag to get post link instead of using jumper
r320
neko259
Using opening post ID from cache, not passing it to the post view
r621 return post.get_url()
neko259
Speed up thread loading
r614
@register.simple_tag(name='post_object_url')
def post_object_url(*args, **kwargs):
post = args[0]
neko259
Some more speedups to the post view
r625 if 'thread' in kwargs:
post_thread = kwargs['thread']
else:
post_thread = None
return post.get_url(thread=post_thread)
neko259
Added metadata to the gallery. Added links to search the image by the online search engines
r460
@register.simple_tag(name='image_actions')
def image_actions(*args, **kwargs):
image_link = args[0]
if len(args) > 1:
image_link = 'http://' + args[1] + image_link # TODO https?
result = ''
for action in actions:
result += '[<a href="' + action['link'] % image_link + '">' + \
action['name'] + '</a>]'
return result
neko259
Added template tag to render post the same way in all places (threads list, thread view, post view)
r537
neko259
Added tag search. Refactored search to show any model results in a list.
r692 # TODO Use get_view of a post instead of this
neko259
Added template tag to render post the same way in all places (threads list, thread view, post view)
r537 @register.inclusion_tag('boards/post.html', name='post_view')
neko259
Removed truncated post view, using an argument for this mode. Fixed bumpable argument in thread
r594 def post_view(post, moderator=False, need_open_link=False, truncated=False,
**kwargs):
neko259
Show images count in OP
r538 """
Get post
"""
neko259
Added debug suffix to the site name when DEBUG is set to true. Optimized post...
r583 if 'is_opening' in kwargs:
is_opening = kwargs['is_opening']
else:
is_opening = post.is_opening()
if 'thread' in kwargs:
thread = kwargs['thread']
else:
neko259
Made getting post thread more generic and scalable
r617 thread = post.get_thread()
neko259
Added debug suffix to the site name when DEBUG is set to true. Optimized post...
r583
if 'can_bump' in kwargs:
can_bump = kwargs['can_bump']
else:
can_bump = thread.can_bump()
neko259
Using opening post ID from cache, not passing it to the post view
r621 opening_post_id = thread.get_opening_post_id()
neko259
Speed up thread loading
r614
neko259
Added template tag to render post the same way in all places (threads list, thread view, post view)
r537 return {
'post': post,
neko259
Fixed moderator panel
r540 'moderator': moderator,
neko259
Added debug suffix to the site name when DEBUG is set to true. Optimized post...
r583 'is_opening': is_opening,
'thread': thread,
'bumpable': can_bump,
neko259
Removed truncated post view, using an argument for this mode. Fixed bumpable argument in thread
r594 'need_open_link': need_open_link,
'truncated': truncated,
neko259
Speed up thread loading
r614 'opening_post_id': opening_post_id,
}