##// END OF EJS Templates
Truncate post texts by words preserving html tags, not just by chars.
Truncate post texts by words preserving html tags, not just by chars.

File last commit:

r61:4d743e53 default
r61:4d743e53 default
Show More
posting_general.html
141 lines | 5.2 KiB | text/html | HtmlLexer
{% extends "base.html" %}
{% load i18n %}
{% load markup %}
{% block head %}
<title>Neboard</title>
{% endblock %}
{% block content %}
{% if threads %}
{% for thread in threads %}
<div class="thread">
{% if thread.can_bump %}
<div class="post">
{% else %}
<div class="post dead_post">
{% endif %}
{% if thread.image %}
<div class="image">
<a href="{{ thread.image.url }}"><img
src="{{ thread.image.url_200x150 }}" />
</a>
</div>
{% endif %}
<div class="message">
<div class="post-info">
<span class="title">{{ thread.title }}</span>
<a class="post_id" href="{% url 'thread' thread.id %}">
(#{{ thread.id }})</a>
[{{ thread.pub_time }}]
[<a class="link" href="{% url 'thread' thread.id %}#form"
>{% trans "Reply" %}</a>]
</div>
{% autoescape off %}
{{ thread.text.rendered|truncatewords_html:50 }}
{% endautoescape %}
</div>
<div class="metadata">
{{ thread.get_reply_count }} {% trans 'replies' %},
{{ thread.get_images_count }} {% trans 'images' %}.
{% if thread.tags.all %}
<span class="tags">{% trans 'Tags' %}:
{% for tag in thread.tags.all %}
<a class="tag" href="
{% url 'tag' tag_name=tag.name %}">
{{ tag.name }}</a>
{% endfor %}
</span>
{% endif %}
</div>
</div>
{% if thread.get_last_replies %}
<div class="last-replies">
{% for post in thread.get_last_replies %}
{% if thread.can_bump %}
<div class="post">
{% else %}
<div class="post dead_post">
{% endif %}
{% if post.image %}
<div class="image">
<a href="{{ post.image.url }}"><img
src="{{ post.image.url_200x150 }}" />
</a>
</div>
{% endif %}
<div class="message">
<div class="post-info">
<span class="title">{{ post.title }}</span>
<a class="post_id" href="
{% url 'thread' thread.id %}#{{ post.id }}">
(#{{ post.id }})</a>
[{{ post.pub_time }}]
</div>
{% autoescape off %}
{{ post.text.rendered|truncatewords_html:50 }}
{% endautoescape %}
</div>
</div>
{% endfor %}
</div>
{% endif %}
</div>
{% endfor %}
{% else %}
No threads found.
<hr />
{% endif %}
<form enctype="multipart/form-data" method="post">{% csrf_token %}
<div class="post-form-w">
<div class="form-title">{% trans "Create new thread" %}</div>
<div class="post-form">
<div class="form-row">
<div class="form-label">{% trans 'Title' %}</div>
<div class="form-input">{{ form.title }}</div>
</div>
<div class="form-row">
<div class="form-label">{% trans 'Text' %}</div>
<div class="form-input">{{ form.text }}</div>
</div>
<div class="form-row">
<div class="form-label">{% trans 'Image' %}</div>
<div class="form-input">{{ form.image }}</div>
</div>
<div class="form-row">
<div class="form-label">{% trans 'Tags' %}</div>
<div class="form-input">{{ form.tags }}</div>
</div>
</div>
<div class="form-submit"><input type="submit"
value="{% trans "Post" %}"/></div>
<div>Tags must be delimited by spaces. Text or image is required
</div>
<div>Use <a
href="http://daringfireball.net/projects/markdown/basics">
markdown</a> syntax for posting.</div>
</div>
</form>
{% endblock %}
{% block metapanel %}
<span class="metapanel">
<b><a href="https://bitbucket.org/neko259/neboard/">Neboard</a>
2013-05 (dev)</b>
{% trans "Pages:" %}
{% for page in pages %}
[<a href="
{% if tag %}
{% url "tag" tag_name=tag page=page %}
{% else %}
{% url "index" page=page %}
{% endif %}
">{{ page }}</a>]
{% endfor %}
</span>
{% endblock %}