{% extends 'blog.html' %}
{% load comment blog %}

{% block title %}{{ entity.title }}{% endblock %}

{% block content %}
  <h1><a href="/{{app}}/{{blog.details_url}}">{{ blog.name }}</a> &rarr; {{ entity.title }}</h1>

  <div class="blog entity">
    {% if entity.description %}<blockquote>{{ entity.description|default:""|escape }}</blockquote>{% endif %}
    {% autoescape off %}
      {{ entity.text|default:""|wiki }}
    {% endautoescape %}
    <div class="actions">
      <b>{{ entity.created|date:"j M Y, G:i" }}</b>
      {% if entity.changed.date != entity.created.date %}
      <i>(edited {{ entity.changed|date:"j M Y, G:i" }})</i>
      {% endif %}
      {% translate "from" %} <a href="/account/{{ entity.author.details_url }}">{{ entity.author }}</a>
      {% if entity.tags %}
        | Tags:
        {% for tag in entity.tags %}
          {{ tag.name }}
          {% if forloop.last %}, {% endif %}
        {% endfor %}
      {% endif %}
      {% if entity.manager %}
        | <a href="/{{ app }}/{{ entity.edit_url }}">{% translate "Edit" %}</a>
        | <a href="/{{ app }}/{{ entity.delete_url }}" class="confirm">{% translate "Delete" %}</a>
      {% endif %}
      <a href="http://twitter.com/share" class="twitter-share-button" data-count="horizontal" data-via="gaeframework">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script>
    </div>
  </div>
{% endblock %}

{% block sidebar %}
  {% get_comment_count for entity as comment_count %}
  <div>
    <h3><a name="comment_list">{% translate "Comments" %} ({{ comment_count }})</a></h3>
    {% render_comment_list for entity %}
    <a href="">Show all comments</a><br>
    <a href="">Add new comment</a>
  </div>
  <div>
    <h3><a name="add_comment">{% translate "Add comment" %}</a></h3>
    {% render_comment_form for entity %}
  </div>
{% endblock %}