{% extends "blog/blog_post_list.html" %}
{% load mezzanine_tags comment_tags keyword_tags rating_tags i18n %}

{% block meta_title %}{{ blog_post.title }}{% endblock %}

{% block meta_keywords %}{% metablock %}
{% for keyword in blog_post.keywords.all %}
    {% if not forloop.first %}, {% endif %}
    {{ keyword }}
{% endfor %}
{% endmetablock %}{% endblock %}

{% block meta_description %}{% metablock %}
{{ blog_post.description }}
{% endmetablock %}{% endblock %}

{% block title %}
{% editable blog_post.title %}{{ blog_post.title }}{% endeditable %}
{% endblock %}

{% block extra_head %}
<script type="text/javascript"
    src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js">
</script>
<script type="text/javascript">
    $(function() {
        $('.reply').click(function() {
            $(this).next('.comment').toggle();
        });
    });
</script>
{% endblock %}

{% block breadcrumb_menu %}
<ul>
    <li><a href="{% url home %}">{% trans "Home" %}</a> &gt;</li>
    <li><a href="{% url blog_post_list %}">{{ blog_page.title }}</a> &gt;</li>
    <li>{{ blog_post.title }}</li>
</ul><br />
{% endblock %}

{% block main %}

<p>
    <em>
        {% trans "Posted by" %}:
        <strong>
            {% with blog_post.user as author %}
            <a href="{% url blog_post_list_author author %}"
                >{{ author.get_full_name|default:author.username }}</a>
            {% endwith %}
        </strong>
        {{ blog_post.publish_date|timesince }} {% trans "ago" %}
    </em>
    (<a href="#comments">{% spaceless %}
        {% blocktrans count blog_post.comments_count as comments_count %}
        1 comment
        {% plural %}
        {{ comments_count }} comments
        {% endblocktrans %}
    {% endspaceless %}</a>)
</p>

{% editable blog_post.content %}
{{ blog_post.content|safe }}
{% endeditable %}

{% keywords_for blog_post as tags %}
{% if tags %}
<div class="tags">
    {% trans "Tags" %}:
    <ul>
        {% for tag in tags %}
        <li><a href="{% url blog_post_list_tag tag.slug %}"
            class="tag-weight-{{ tag.weight }}">{{ tag }}</a></li>
        {% endfor %}
    </ul>
</div>
{% endif %}

<div class="rating">{% rating_for blog_post %}</div>

<div class="share">
{% set_short_url_for blog_post %}
{% trans "Share this on" %}:
<a target=_"blank" href="http://twitter.com/home?status={{ blog_post.short_url|urlencode }}%20{{ blog_post.title|urlencode }}">Twitter</a>
 /
<a target=_"blank" href="http://facebook.com/sharer.php?u={{ request.build_absolute_uri }}&t={{ blog_post.title|urlencode }}">Facebook</a>
</div>

<div id="comments">
{% if use_disqus %}
{% include "generic/includes/disqus_comments.html" %}
{% else %}
{% comments_for blog_post %}
{% endif %}
</div>

{% endblock %}
