Fix templates

This commit is contained in:
Iacopo Spalletti 2014-01-10 06:39:36 +01:00
parent 1ac18873a0
commit 52f8f1486a
15 changed files with 131 additions and 71 deletions

View File

View File

@ -1,7 +0,0 @@
{% extends "admin/parler/change_form.html" %}
{% load static %}
{% block extrahead %}
{{ block.super }}
<link href="{% static 'css/djangocms_blog_admin.css' %}" media="screen, projection" rel="stylesheet" type="text/css">
{% endblock %}

View File

@ -1,7 +1,7 @@
{% extends "base.html" %}
{% block application %}
<div class="app app-blog">
{% block content %}
<div class="app app-blog span8">
{% block content_blog %}{% endblock %}
</div>
{% endblock %}

View File

@ -3,27 +3,38 @@
<article id="post-{{ post.slug }}" class="post-item">
<header>
<h3><a href="{{ post.get_absolute_url }}">{% show_editable_model post "title" %}</a></h3>
<h3><a href="{{ post.get_absolute_url }}">{{ post.title }}</a></h3>
{% block blog_meta %}
{{ post.date_published|date:"d F Y" }}
<div class="blog-author">{% trans "by" %} <a href="{% url 'djangocms_blog:author-posts' post.author.username %}">{{ post.author }}</a></div>
{% if post.tags.exists %}
<nav class="blog-tags">
{% for tag in post.tags.all %}
<a href="{% url 'djangocms_blog:tagged-posts' tag=tag.slug %}" class="blog-tag blog-tag-{{ tag.count }}">{{ tag.name }}</a>{% if not forloop.last %}, {% endif %}
{% endfor %}
</nav>
{% endif %}
<ul class="post-detail">
<li>
{% trans "by" %} <a href="{% url 'djangocms_blog:author-posts' post.author.username %}">{{ post.author.get_full_name }}</a>
</li>
<li>
{{ post.date_published|date:"M d, Y" }}
</li>
</ul>
<ul class="post-detail tags">
{% if post.categories.exists %}
{% for category in post.categories.all %}
<li class="category_{{ forloop.counter }}"><a href="{% url 'djangocms_blog:category-posts' category=category.slug %}" class="blog-categories-{{ category.count }}">{{ category.name }}</a>{% if not forloop.last %}, {% endif %}</li>
{% endfor %}
{% endif %}
{% if post.tags.exists %}
{% for tag in post.tags.all %}
<li class="tag_{{ forloop.counter }}"><a href="{% url 'djangocms_blog:tagged-posts' tag=tag.slug %}" class="blog-tag blog-tag-{{ tag.count }}">{{ tag.name }}</a>{% if not forloop.last %}, {% endif %}</li>
{% endfor %}
{% endif %}
</ul>
{% endblock %}
</header>
{% if image and post.main_image_id %}
{% if image and post.main_image %}
<div class="blog-visual">
{% thumbnail post.main_image thumbnail_options.size crop=thumbnail_options.crop upscale=thumbnail_options.upscale as thumb %}
<img src="{{ thumb.url }}" alt="" width="{{ thumb.width }}" height="{{ thumb.height }}" />
{% thumbnail post.main_image post.thumbnail_options.size crop=post.thumbnail_options.crop upscale=post.thumbnail_options.upscale as thumb %}
<img src="{{ thumb.url }}" alt="{{ post.main_image.default_alt_text }}" width="{{ thumb.width }}" height="{{ thumb.height }}" />
</div>
{% endif %}
<div class="blog-lead">{% show_editable_model post "abstract" "abstract" "" safe %}</div>
<footer>
<a href="{{ post.get_absolute_url }}">{% trans "read more" %}</a>
<div class="blog-lead">{% show_editable_model post "abstract" %}</div>
<footer class="read-more">
<a href="{{ post.get_absolute_url }}">{% trans "read more" %} &raquo;</a>
</footer>
</article>

View File

@ -1,7 +1,7 @@
{% load i18n %}
{% load url from future %}
{% load url from future %}{% spaceless %}
<div class="plugin plugin-blog">
<h3>{% trans "Archive" %}</h3>
{% regroup dates by date.year as years %}
{% with current_year=year current_month=month %}
<ul class="blog-archive">
@ -10,15 +10,23 @@
<a href="{% url 'djangocms_blog:archive-year' year=year.grouper %}">{{ year.grouper }}</a>
<ul>
{% for month in year.list %}
<li{% if year.grouper == current_year and month.date.month == current_month %} class="active"{% endif %}>
<a href="{% url 'djangocms_blog:archive-month' year=year.grouper month=month.date|date:"n" %}">{{ month.date|date:"F" }} <span>({{ month.count }})</span></a>
<li{% if year.grouper == current_year and month.date.month == current_month %} class="active"{% else %} class="month"{% endif %}>
<a href="{% url 'djangocms_blog:archive-month' year=year.grouper month=month.date|date:"n" %}">
{{ month.date|date:"F" }}
<span>(
{% if month.count > 0 %}
{% blocktrans count articles=month.count %}1 article{% plural %}{{ articles }} articles{% endblocktrans %}
{% else %}{% trans "0 articles" %}{% endif %}
)</span>
</a>
</li>
{% endfor %}
</ul>
</li>
{% empty %}
<li class="blog-empty"><p>{% trans "No entry found." %}</p></li>
<li class="blog-empty"><p>{% trans "No article found." %}</p></li>
{% endfor %}
</ul>
{% endwith %}
</div>
{% endspaceless %}

View File

@ -1,11 +1,19 @@
{% load i18n %}
{% load i18n thumbnail %}{% spaceless %}
<div class="plugin plugin-blog">
<h3>{% trans "Authors" %}</h3>
<ul class="blog-authors">
{% for author in instance.get_authors %}
<li><a href="{% url 'djangocms_blog:author-posts' author.username %}">{{ author.get_full_name }} <span>{% if author.count %}({{ author.count }}{% else %}0{% endif %} articles</span></a></li>
<li><a href="{% url 'djangocms_blog:author-posts' author.username %}">
{{ author.get_full_name }}
<span>(
{% if author.count > 0 %}
{% blocktrans count articles=author.count %}1 article{% plural %}{{ articles }} articles{% endblocktrans %}
{% else %}{% trans "0 articles" %}{% endif %}
)</span>
</a></li>
{% empty %}
<li class="blog-empty"><p>{% trans "No entry found." %}</p></li>
<li class="blog-empty"><p>{% trans "No article found." %}</p></li>
{% endfor %}
</ul>
</div>
</div>
{% endspaceless %}

View File

@ -1,13 +1,20 @@
{% load i18n %}
{% load url from future %}
{% load url from future %}{% spaceless %}
<div class="plugin plugin-blog">
<h3>{% trans "Categories" %}</h3>
<ul class="blog-categories">
{% for category in categories %}
<li><a href="{% url 'djangocms_blog:category-posts' category=category.slug %}" class="blog-categories-{{ category.count }}">{{ category.name }} <span>({{ category.count }} {% trans "articles" %})</span></a></li>
<li><a href="{% url 'djangocms_blog:category-posts' category=category.slug %}" class="blog-categories-{{ category.count }}">
{{ category.name }}
<span>(
{% if category.count > 0 %}
{% blocktrans count articles=category.count %}1 article{% plural %}{{ articles }} articles{% endblocktrans %}
{% else %}{% trans "0 articles" %}{% endif %}
)</span>
</a></li>
{% empty %}
<li class="blog-empty"><p>{% trans "No entry found." %}</p></li>
<li class="blog-empty"><p>{% trans "No article found." %}</p></li>
{% endfor %}
</ul>
</div>
</div>
{% endspaceless %}

View File

@ -1,10 +1,11 @@
{% load i18n %}
{% load i18n %}{% spaceless %}
<div class="plugin plugin-blog">
<div class="blog-latest-entries">
{% for post in instance.get_posts %}
{% include "djangocms_blog/includes/blog_item.html" with post=post %}
{% include "djangocms_blog/includes/blog_item.html" with post=post %}
{% empty %}
<p class="blog-empty">{% trans "No post found." %}</p>
<p class="blog-empty">{% trans "No article found." %}</p>
{% endfor %}
</div>
</div>
</div>
{% endspaceless %}

View File

@ -1,12 +1,20 @@
{% load i18n %}
{% load url from future %}
{% load url from future %}{% spaceless %}
<div class="plugin plugin-blog">
<h3>{% trans "Tags" %}</h3>
<ul class="blog-tags">
{% for tag in tags %}
<li><a href="{% url 'djangocms_blog:tagged-posts' tag=tag.slug %}" class="blog-tag-{{ tag.count }}">{{ tag.name }} <span>({{ tag.count }})</span></a></li>
<li><a href="{% url 'djangocms_blog:tagged-posts' tag=tag.slug %}" class="blog-tag-{{ tag.count }}">
{{ tag.name }}
<span>(
{% if tag.count > 0 %}
{% blocktrans count articles=tag.count %}1 article{% plural %}{{ articles }} articles{% endblocktrans %}
{% else %}{% trans "0 articles" %}{% endif %}
)</span>
</a></li>
{% empty %}
<li class="blog-empty"><p>{% trans "No entry found." %}</p></li>
<li class="blog-empty"><p>{% trans "No article found." %}</p></li>
{% endfor %}
</ul>
</div>
</div>
{% endspaceless %}

View File

@ -1 +1,2 @@
{% extends "djangocms_blog/post_list.html" %}
{% extends "djangocms_blog/post_list.html" %}

View File

@ -2,31 +2,40 @@
{% load i18n thumbnail cms_tags %}
{% load url from future %}
{% block content_blog %}
{% block content_blog %}{% spaceless %}
<article id="post-{{ post.slug }}" class="post-item post-detail">
<header>
<h2>{% show_editable_model post "title" %}</h2>
{% block blog_meta %}
<div class="blog-meta">
{{ post.date_published|date:"d F Y" }}
<div class="blog-author">{% trans "by" %} <a href="{% url 'djangocms_blog:author-posts' post.author.username %}">{{ post.author }}</a></div>
{% if post.tags.exists %}
<nav class="blog-tags">
{% for tag in post.tags.all %}
<a href="{% url 'djangocms_blog:tagged-posts' tag=tag.slug %}" class="blog-tag blog-tag-{{ tag.count }}">{{ tag.name }}</a>{% if not forloop.last %}, {% endif %}
{% endfor %}
</nav>
{% endif %}
</div>
<ul class="post-detail">
<li>
{% trans "by" %} <a href="{% url 'djangocms_blog:author-posts' post.author.username %}">{{ post.author.get_full_name }}</a>
</li>
<li>
{{ post.date_published|date:"M d, Y" }}
</li>
</ul>
<ul class="post-detail tags">
{% if post.categories.exists %}
{% for category in post.categories.all %}
<li class="category_{{ forloop.counter }}"><a href="{% url 'djangocms_blog:category-posts' category=category.slug %}" class="blog-categories-{{ category.count }}">{{ category.name }}</a>{% if not forloop.last %}, {% endif %}</li>
{% endfor %}
{% endif %}
{% if post.tags.exists %}
{% for tag in post.tags.all %}
<li class="tag_{{ forloop.counter }}"><a href="{% url 'djangocms_blog:tagged-posts' tag=tag.slug %}" class="blog-tag blog-tag-{{ tag.count }}">{{ tag.name }}</a>{% if not forloop.last %}, {% endif %}</li>
{% endfor %}
{% endif %}
</ul>
{% endblock %}
</header>
{% if image and post.main_image_id %}
{% if post.main_image_id %}
<div class="blog-visual">
{% thumbnail post.main_image thumbnail_options.size crop=thumbnail_options.crop upscale=thumbnail_options.upscale as thumb %}
<img src="{{ thumb.url }}" alt="" width="{{ thumb.width }}" height="{{ thumb.height }}" />
{% thumbnail post.main_image post.thumbnail_options.size crop=post.thumbnail_options.crop upscale=post.thumbnail_options.upscale as thumb %}
<img src="{{ thumb.url }}" alt="{{ post.main_image.default_alt_text }}" width="{{ thumb.width }}" height="{{ thumb.height }}" />
</div>
{% endif %}
<div class="blog-lead">{% show_editable_model post "abstract" "abstract" "" safe %}</div>
<div class="blog-lead">{% show_editable_model post "abstract" "abstract" %}</div>
<div class="blog-content">{% render_placeholder post.content %}</div>
</article>
{% endblock content_blog %}
{% endspaceless %}{% endblock content_blog %}

View File

@ -5,22 +5,36 @@
<section class="blog-list">
{% block blog_title %}
<header>
<h3>
{% if author %}{% trans "Entries by" %} {{ author.get_full_name }}
<h2>
{% if author %}{% trans "Articles by" %} {{ author.get_full_name }}
{% elif archive_date %}{% trans "Archive" %} &ndash; {% if month %}{{ archive_date|date:'F' }} {% endif %}{{ year }}
{% elif tagged_entries %}{% trans "Tag" %} &ndash; {{ tagged_entries|capfirst }}
{% elif category %}{% trans "Category" %} &ndash; {{ category }}{% endif %}
</h3>
</h2>
</header>
{% endblock %}
{% for post in post_list %}
{% include "djangocms_blog/includes/blog_item.html" with post=post image="true" %}
{% empty %}
<p class="blog-empty">{% trans "No post found." %}</p>
<p class="blog-empty">{% trans "No article found." %}</p>
{% endfor %}
{% if author or archive_date or tagged_entries %}
<p class="blog-back"><a href="{% url 'djangocms_blog:latest-posts' %}">{% trans "Back" %}</a></p>
{% endif %}
{% if is_paginated %}
<nav class="{% firstof css_grid instance.css_grid %} pagination">
{% if page_obj.has_previous %}
<a href="?{{ page_name }}={{ page_obj.previous_page_number }}">&laquo; {% trans "previous" %}</a>
{% endif %}
<span class="current">
{% trans "Page" %} {{ page_obj.number }} {% trans "of" %} {{ paginator.num_pages }}
</span>
{% if page_obj.has_next %}
<a href="?{{ page_name }}={{ page_obj.next_page_number }}">{% trans "next" %} &raquo;</a>
{% endif %}
</nav>
{% endif %}
</section>
{% endblock %}
{% endspaceless %}