Improve pagination

This commit is contained in:
L3D 2022-01-17 01:05:24 +01:00
parent 94a130c995
commit 15c60a2d48
Signed by: l3d
GPG key ID: CD08445BFF4313D1
7 changed files with 70 additions and 18 deletions

View file

@ -0,0 +1,22 @@
.pagination {
background: transparent;
font-size: $font_size_default;
text-align: center;
margin-top: 50px;
a, a:link, a:visited {
background: $font_accent_1;
padding: 3px 9px;
text-decoration: none;
color: $font_accent_4;
border-radius: 3px;
}
a:hover, a:active {
color: $font_accent_3;
background: $font_accent_2;
box-shadow: 0px 0px 2px 2px $font_accent_2;
}
.disabled {
background: $font_accent_2;
}
}

View file

@ -1,7 +1,8 @@
@import "_variables";
@import "_fonts";
@import "_events.scss";
@import "_events";
@import "_pagination";
@import "_general";
@import "_header";

View file

@ -0,0 +1,15 @@
title: Streaming von Freifunk Treffen
---
event_end_date: 2018-08-12
---
event_start_date: 2017-06-09
---
preview: Wir habe einige der Freifunk Treffen gestreamt
---
body:
Wir haben Friefunk treffen zum Anlass genommen um mehr Erfahrungen mit dem Streaming zu sammeln und immer mal wieder ein solches treffen gestreamt.
Das wurde von der Freifunk Community dankend angenommen da dies so auch eine remote Teilnahme an den Treffen ermöglicht hat.
Die treffen wurden ausschließlich gestreamt. Durch uns ist kein recording angefallen.

View file

@ -12,5 +12,5 @@ model = blog-post
order_by = -event_start_date,title
[pagination]
enabled = yes
per_page = 10
enabled = true
per_page = 7

View file

@ -34,7 +34,7 @@
</head>
<body>
<header>
<h1><a href="/">winkekatze.tv</a></h1>
<h1 id="top"><a href="/">winkekatze.tv</a></h1>
<nav>
<ul class="nav navbar-nav">
<li

View file

@ -1,4 +1,4 @@
{% macro render_blog_post(post, from_index=false) %}
{%- macro render_blog_post(post, from_index=false) %}
<div class="blog-post">
{% if from_index -%}
<h2 class="headline"><a href="{{ post|url }}">{{ post.title }}</a></h2>
@ -7,7 +7,7 @@
{% endif -%}
<p class="meta">
{% if post.event_start_date != post.event_end_date -%}
Vom {{ post.event_start_date | dateformat(('d. MMM'), locale=post.alt ) }} bis {{ post.event_end_date | dateformat('long', locale=post.alt) }}.
Vom {{ post.event_start_date | dateformat('long', locale=post.alt ) }} bis {{ post.event_end_date | dateformat('long', locale=post.alt) }}.
{%- else -%}
Am {{ post.event_start_date | dateformat('long', locale=post.alt) }}.
{%- endif %}
@ -18,4 +18,4 @@
{{ post.body }}
{% endif -%}
</div>
{% endmacro %}
{% endmacro -%}

View file

@ -1,15 +1,29 @@
{% macro render_pagination(pagination) %}
{%- macro render_pagination(pagination) %}
<div class="pagination">
{% if pagination.has_prev %}
{% if pagination.has_prev -%}
<a href="{{ pagination.prev|url }}">&laquo; Previous</a>
{% else %}
<span class="disabled">&laquo; Previous</span>
{% endif %}
| {{ pagination.page }} |
{% if pagination.has_next %}
{% else -%}
<a class="disabled">&laquo; Previous</a>
{% endif -%}
{% for site in range(pagination.pages) -%}
{% if site == 0 -%}
{%- if pagination.page == site + 1 -%}
<a class="disabled">{{ pagination.page }}</a>
{%- else -%}
<a href="{{ './'| url }}">{{ site + 1 }}</a>
{%- endif -%}
{%- else -%}
{%- if pagination.page == site + 1 -%}
<a class="disabled" >{{ pagination.page }}</a>
{%- else -%}
<a href="{{ './'| url }}page/{{ site + 1 }}/">{{ site + 1 }}</a>
{%- endif -%}
{%- endif %}
{% endfor -%}
{% if pagination.has_next -%}
<a href="{{ pagination.next|url }}">Next &raquo;</a>
{% else %}
<span class="disabled">Next &raquo;</span>
{% endif %}
{%- else -%}
<a class="disabled">Next &raquo;</a>
{%- endif %}
</div>
{% endmacro %}
{% endmacro -%}