##// END OF EJS Templates
Fixed pagination in the archive
Fixed pagination in the archive

File last commit:

r571:1c1f004f 1.7-dev
r579:7bbdf3d0 default
Show More
board.py
76 lines | 1.8 KiB | text/x-python | PythonLexer
neko259
Added a template tag to get post link instead of using jumper
r320 from django.core.urlresolvers import reverse
from django.shortcuts import get_object_or_404
from boards.models import Post
neko259
Added template tag to render post the same way in all places (threads list, thread view, post view)
r537 from boards.views import thread, api
neko259
Added a template tag to get post link instead of using jumper
r320 from django import template
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]
post = get_object_or_404(Post, id=post_id)
neko259
Fixed some issues with post model migration
r400 if not post.is_opening():
neko259
Rewriting views to class-based
r542 link = reverse('thread', kwargs={
neko259
Fixed some issues with post model migration
r400 'post_id': post.thread_new.get_opening_post().id}) + '#' + str(
post_id)
neko259
Added a template tag to get post link instead of using jumper
r320 else:
neko259
Rewriting views to class-based
r542 link = reverse('thread', kwargs={'post_id': post_id})
neko259
Added a template tag to get post link instead of using jumper
r320
return link
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
@register.inclusion_tag('boards/post.html', name='post_view')
neko259
Fixed moderator panel
r540 def post_view(post, moderator=False):
neko259
Show images count in OP
r538 """
Get post
"""
neko259
Fixed moderator panel
r540 return {
'post': post,
'moderator': moderator,
}
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_truncated')
neko259
Fixed moderator panel
r540 def post_view_truncated(post, need_open_link=False, moderator=False):
neko259
Show images count in OP
r538 """
Get post with truncated text. If the 'open' or 'reply' link is needed, pass
the second parameter as True.
"""
neko259
Added template tag to render post the same way in all places (threads list, thread view, post view)
r537 return {
'post': post,
'truncated': True,
neko259
Fixed moderator panel
r540 'need_open_link': need_open_link,
'moderator': moderator,
neko259
Some more optimization to the post html
r571 }