ZuluPro/myblog

View on GitHub
myblog/myapp/templates/zinnia/entry_list.html

Summary

Maintainability
Test Coverage
{% extends "zinnia/base.html" %}
{% load i18n zinnia %}

{% block meta-description %}{% spaceless %}
{% if category %}
{% if category.description %}
{{ category.description|striptags|safe }}
{% else %}
{% blocktrans with object=category %}The latest entries categorized under {{ object }}{% endblocktrans %}
{% endif %}
{% endif %}

{% if tag %}
{% blocktrans with object=tag %}The latest entries tagged with {{ object }}{% endblocktrans %}
{% endif %}

{% if author %}
{% blocktrans with object=author %}The latest entries by {{ object }}{% endblocktrans %}
{% endif %}

{% endspaceless %}{% endblock meta-description %}

{% block meta-description-page %}{% if page_obj %}{% ifnotequal page_obj.number 1 %} {% blocktrans with object=page_obj.number %}page {{ object }}{% endblocktrans %}{% endifnotequal %}{% endif %}{% endblock meta-description-page %}

{% block title %}{% spaceless %}
{% if category %}
{% blocktrans with object=category %}Category {{ object }}{% endblocktrans %}
{% endif %}

{% if tag %}
{% blocktrans with object=tag %}Tag {{ object }}{% endblocktrans %}
{% endif %}

{% if author %}
{% blocktrans with object=author %}Author {{ object }}{% endblocktrans %}
{% endif %}

{% endspaceless %}{% endblock title %}

{% block title-page %}{% if page_obj %}{% ifnotequal page_obj.number 1 %} - {% blocktrans with object=page_obj.number %}Page {{ object }}{% endblocktrans %}{% endifnotequal %}{% endif %}{% endblock title-page %}

{% block link %}
  {{ block.super }}
  {% if category %}
    <link rel="alternate" type="application/rss+xml" title="{% blocktrans with object=category %}RSS feed of {{ object }}{% endblocktrans %}" href="{% url 'zinnia:category_feed' category.tree_path %}" />
  {% endif %}
  {% if tag %}
    <link rel="alternate" type="application/rss+xml" title="{% blocktrans with object=tag %}RSS feed of {{ object }}{% endblocktrans %}" href="{% url 'zinnia:tag_feed' tag.name %}" />
  {% endif %}
  {% if author %}
    <link rel="alternate" type="application/rss+xml" title="{% blocktrans with object=author %}RSS feed of {{ object }}{% endblocktrans %}" href="{% url 'zinnia:author_feed' author.get_username %}" />
  {% endif %}
{% endblock link %}

{% block body-class %}entry-list{% if page_obj %} paginated page-{{ page_obj.number }}{% endif %}{% if category %} category category-{{ category.slug }}{% endif %}{% if tag %} tag tag-{{ tag|slugify }}{% endif %}{% if author %} author author-{{ author|slugify }}{% endif %}{% endblock body-class %}

{% block content %}

{% block content-title %}
{% if category %}
<section>
<div>
<h2>{% blocktrans %}Category archives: {{ category }}{% endblocktrans %}</h2>
{% if category.description %}
<p>{{ category.description|striptags|safe }}</p>
{% endif %}
<p class="feed">
  <a href="{% url 'zinnia:category_feed' category.tree_path %}" title="{% blocktrans with object=category %}RSS feed of {{ object }}{% endblocktrans %}">
    {% blocktrans with object=category %}RSS feed of {{ object }}{% endblocktrans %}
  </a>
</p>
</div>
</section>
{% endif %}

{% if tag %}
<section>
<div>
<h2>{% blocktrans %}Tag archives: {{ tag }}{% endblocktrans %}</h2>
<p class="feed">
  <a href="{% url 'zinnia:tag_feed' tag.name %}" title="{% blocktrans with object=tag %}RSS feed of {{ object }}{% endblocktrans %}">
    {% blocktrans with object=tag %}RSS feed of {{ object }}{% endblocktrans %}
  </a>
</p>
</div>
</section>
{% endif %}

{% if author %}
<section>
<div>
<h2>{% blocktrans %}Author archives: {{ author }}{% endblocktrans %}</h2>
<p class="feed">
  <a href="{% url 'zinnia:author_feed' author.get_username %}" title="{% blocktrans with object=author %}RSS feed of {{ object }}{% endblocktrans %}">
    {% blocktrans with object=author %}RSS feed of {{ object }}{% endblocktrans %}
  </a>
</p>
</div>
</section>
{% endif %}
{% endblock content-title %}

{% block content-loop %}
{% for object in object_list %}
  {% include object.content_template with object_content=object.html_preview continue_reading=1 %}
{% empty %}
<section>
 <div>
  <p><a href="{% url 'admin:zinnia_entry_add' %}">{% trans "No entries yet." %}</a></p>
 </div>
</section>
{% endfor %}
{% endblock content-loop %}

{% block content-pagination %}
{% if is_paginated %}
<section class="pagination">
 <div>
  {% zinnia_pagination page_obj %}
 </div>
</section>
{% endif %}
{% endblock content-pagination %}

{% block content-related %}
{% endblock content-related %}

{% endblock content %}

{% block admin-tools %}
  {% if category and perms.zinnia.change_category %}
  <li>
    <a href="{% url 'admin:zinnia_category_change' category.pk %}" title="{% trans "Edit the category" %}">
      {% trans "Edit the category" %}
    </a>
  </li>
  {% endif %}
  {% if tag and perms.tagging.change_tag %}
  <li>
    <a href="{% url 'admin:tagging_tag_change' tag.pk %}" title="{% trans "Edit the tag" %}">
      {% trans "Edit the tag" %}
    </a>
  </li>
  {% endif %}
  {% if author and perms.auth.change_user %}
  <li>
    <a href="{% url 'change'|user_admin_urlname author.pk %}" title="{% trans "Edit the author" %}">
      {% trans "Edit the author" %}
    </a>
  </li>
  {% endif %}
{% endblock admin-tools %}