tempaltes: Added blog templates.
An override of the djangocms_blog templates. Signed-off-by: rscnt <rascnt@gmail.com>
This commit is contained in:
parent
d57a8dc338
commit
280e30ad15
5 changed files with 149 additions and 0 deletions
37
templates/djangocms_blog/_header_post_detail.html
Normal file
37
templates/djangocms_blog/_header_post_detail.html
Normal file
|
@ -0,0 +1,37 @@
|
|||
{% load cms_tags staticfiles %}
|
||||
<!-- Page Header -->
|
||||
<!-- Set your background image for this header on the line below. -->
|
||||
<header class="intro-header"
|
||||
{% if post.main_image_id %}
|
||||
style="background-image: url('{{ post.main_image.url }}');"
|
||||
{% else %}
|
||||
style="background-image: url('{% static 'blog.ungleich.ch/img/home-bg.jpg' %}');"
|
||||
{% endif %}
|
||||
>
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-lg-8 col-lg-offset-2 col-md-10 col-md-offset-1">
|
||||
<div class="post-heading">
|
||||
<h1> {% render_model post "title" %} </h1>
|
||||
<h2 class="subheading">
|
||||
{% render_model post "abstract" "" "" 'truncatewords_html:10' %}
|
||||
</h2>
|
||||
<span class="meta">
|
||||
Posted
|
||||
{% if post.author %}
|
||||
by
|
||||
<a href="{% url 'djangocms_blog:posts-author' post.author.get_username %}">
|
||||
{% if post.author.get_full_name %}
|
||||
{{ post.author.get_full_name }}
|
||||
{% else %}
|
||||
{{ post.author }}
|
||||
{% endif %}
|
||||
</a>
|
||||
{% endif %}
|
||||
on {{ post.date_published|date:"DATE_FORMAT" }}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
11
templates/djangocms_blog/base.html
Normal file
11
templates/djangocms_blog/base.html
Normal file
|
@ -0,0 +1,11 @@
|
|||
{% extends CMS_TEMPLATE %}
|
||||
{% block meta %}
|
||||
{% if meta %}
|
||||
{% include "meta_mixin/meta.html" %}
|
||||
{% endif %}
|
||||
{% endblock meta %}
|
||||
{% block content %}
|
||||
<div class="app app-blog span8">
|
||||
{% block content_blog %}{% endblock %}
|
||||
</div>
|
||||
{% endblock content %}
|
32
templates/djangocms_blog/includes/blog_item.html
Normal file
32
templates/djangocms_blog/includes/blog_item.html
Normal file
|
@ -0,0 +1,32 @@
|
|||
{% load i18n thumbnail cms_tags %}
|
||||
{% load url from future %}
|
||||
|
||||
<div class="post-preview">
|
||||
<a href=" {{ post.get_absolute_url }} ">
|
||||
<h2 class="post-title">
|
||||
{{ post.title }}
|
||||
</h2>
|
||||
<h3 class="post-subtitle">
|
||||
{% if not TRUNCWORDS_COUNT %}
|
||||
{% render_model post "abstract" %}
|
||||
{% else %}
|
||||
{% render_model post "abstract" "" "" 'truncatewords_html:TRUNCWORDS_COUNT' %}
|
||||
{% endif %}
|
||||
</h3>
|
||||
</a>
|
||||
<p class="post-meta">
|
||||
Posted
|
||||
{% if post.author %}
|
||||
by
|
||||
<a href="{% url 'djangocms_blog:posts-author' post.author.get_username %}">
|
||||
{% if post.author.get_full_name %}
|
||||
{{ post.author.get_full_name }}
|
||||
{% else %}
|
||||
{{ post.author }}
|
||||
{% endif %}
|
||||
</a>
|
||||
{% endif %}
|
||||
on {{ post.date_published|date:"DATE_FORMAT" }}
|
||||
</p>
|
||||
</div>
|
||||
<hr>
|
22
templates/djangocms_blog/post_detail.html
Normal file
22
templates/djangocms_blog/post_detail.html
Normal file
|
@ -0,0 +1,22 @@
|
|||
{% extends "djangocms_blog/base.html" %}
|
||||
{% load i18n thumbnail cms_tags %}
|
||||
{% load url from future %}
|
||||
|
||||
{% block meta_description %}{{ post.meta_description }}{% endblock meta_description %}
|
||||
{% block meta_keywords %}{{ post.meta_keywords }}{% endblock meta_keywords %}
|
||||
{% block canonical_url %}<link rel="canonical" href="{{ SITE.domain }}{{ view.get_view_url }}"/>{% endblock canonical_url %}
|
||||
{% block title %}{{ post.get_title }}{% endblock %}
|
||||
<!-- page header -->
|
||||
{% block base_header %}
|
||||
{% include "djangocms_blog/_header_post_detail.html" %}
|
||||
{% endblock %}
|
||||
<!-- page header -->
|
||||
{% block content_blog %}
|
||||
<article>
|
||||
{% if use_placeholder %}
|
||||
<div class="blog-content">{% render_placeholder post.content %}</div>
|
||||
{% else %}
|
||||
<div class="blog-content">{% render_model post "post_text" "post_text" %}</div>
|
||||
{% endif %}
|
||||
</article>
|
||||
{% endblock content_blog %}
|
47
templates/djangocms_blog/post_list.html
Normal file
47
templates/djangocms_blog/post_list.html
Normal file
|
@ -0,0 +1,47 @@
|
|||
{% extends "djangocms_blog/base.html" %}
|
||||
{% load i18n thumbnail %}{% spaceless %}
|
||||
|
||||
{% block canonical_url %}<link rel="canonical" href="{{ SITE.domain }}{{ view.get_view_url }}"/>{% endblock canonical_url %}
|
||||
|
||||
{% block content_blog %}
|
||||
<section class="blog-list">
|
||||
{% block blog_title %}
|
||||
<header>
|
||||
<h2>
|
||||
{% if author %}{% trans "Articles by" %} {{ author.get_full_name }}
|
||||
{% elif archive_date %}{% trans "Archive" %} – {% if month %}{{ archive_date|date:'F' }} {% endif %}{{ year }}
|
||||
{% elif tagged_entries %}{% trans "Tag" %} – {{ tagged_entries|capfirst }}
|
||||
{% elif category %}{% trans "Category" %} – {{ category }}{% endif %}
|
||||
</h2>
|
||||
</header>
|
||||
{% endblock %}
|
||||
{% for post in post_list %}
|
||||
{% include "djangocms_blog/includes/blog_item.html" with post=post image="true" TRUNCWORDS_COUNT=TRUNCWORDS_COUNT %}
|
||||
{% empty %}
|
||||
<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:posts-latest' %}">{% trans "Back" %}</a></p>
|
||||
{% endif %}
|
||||
{% if is_paginated %}
|
||||
<!-- Pager -->
|
||||
<ul class="pager">
|
||||
{% if page_obj.has_previous %}
|
||||
<li class="previous">
|
||||
<a href="?{{ view.page_kwarg }}={{ page_obj.previous_page_number }}">
|
||||
« {% trans "Newer Posts" %}
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% if page_obj.has_next %}
|
||||
<li class="next">
|
||||
<a href="?{{ view.page_kwarg }}={{ page_obj.next_page_number }}">
|
||||
{% trans "Older Posts" %} →
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
</section>
|
||||
{% endblock %}
|
||||
{% endspaceless %}
|
Loading…
Reference in a new issue