update theme

This commit is contained in:
thisLight 2020-12-29 17:33:08 +08:00
parent ea0939fdd1
commit 95fd7d229c
6 changed files with 79 additions and 30 deletions

View file

@ -39,6 +39,7 @@
<noscript><link rel="stylesheet" href="{{ url }}"></noscript>
{% endfor %}
{% endif %}
<link rel="stylesheet" href="/materialize/css/materialize.css">
{% block add_head %}{% endblock %}

View file

@ -0,0 +1,11 @@
{% macro Paginiation() %}
<ul class="pagination center">
<li class="{% if page.current == 1 %}disabled{% else %}waves-effect{% endif %}"><a href="{% if (page.current-1) == 1 %}{{url_for('/')}}{% else %}{{ page.prev_link }}{% endif %}"><i class="mdi mdi-chevron-left"></i></a></li>
<li class="{% if page.current == 1 %}active{% else %}waves-effect{% endif %}"><a href="{{ url_for('/') }}">1</a></li>
{% for n in range(2, page.total, 1) %}
<li class="{% if page.current == n %}active{% else %}waves-effect{% endif %}"><a href="{{ url_for('page/'+n+'/') }}">{{n}}</a></li>
{% endfor %}
<li class="{% if page.current == page.total %}disabled{% else %}waves-effect{% endif %}"><a href="{{ page.next_link }}"><i class="mdi mdi-chevron-right"></i></a></li>
</ul>
{% endmacro %}

View file

@ -77,16 +77,7 @@
</div>
{% endmacro %}
{% macro Paginiation() %}
<ul class="pagination">
<li class="{% if page.current == 1 %}disabled{% else %}waves-effect{% endif %}"><a href="{% if (page.current-1) == 1 %}{{url_for('/')}}{% else %}{{ page.prev_link }}{% endif %}"><i class="mdi mdi-chevron-left"></i></a></li>
<li class="{% if page.current == 1 %}active{% else %}waves-effect{% endif %}"><a href="{{ url_for('/') }}">1</a></li>
{% for n in range(2, page.total, 1) %}
<li class="{% if page.current == n %}active{% else %}waves-effect{% endif %}"><a href="{{ url_for('page/'+n+'/') }}">{{n}}</a></li>
{% endfor %}
<li class="{% if page.current == page.total %}disabled{% else %}waves-effect{% endif %}"><a href="{{ page.next_link }}"><i class="mdi mdi-chevron-right"></i></a></li>
</ul>
{% endmacro %}
{% import "includes/paginator.swig" as P%}
{% block body %}
<div class="row">
@ -100,7 +91,7 @@
<span>No Post Here...</span>
{% endif %}
<div class="center">
{{ Paginiation() }}
{{ P.Paginiation() }}
</div>
</div>
<div class="col m4 l3 hide-on-small-only">

View file

@ -1,9 +1,45 @@
{% extends 'includes/layout.swig' %}
{% macro PostTags(post) %}
<div>
{% for k in Object.keys(post.tags.data) %}
<a href="{{ url_for(post.tags.data[k].path)}}"><div class="chip">
{{post.tags.data[k].name}}
</div></a>
{% endfor %}
</div>
{% endmacro %}
{% macro Gallery(photos) %}
<div class="row">
<div class="col">
{% set i = 0 %}
{% for p in photos %}
{% set i = i + 1 %}
<img onerror="M.toast({ html: 'Some photos could not be showed at the moment, please try again later.' });" src="{{p}}" data-caption="{{i}}" class="responsive-img materialboxed gallery-img" async />
{% endfor %}
</div>
</div>
{% endmacro %}
{% block body %}
<article id="page">
<h1>{{ page.title }}</h1>
<article id="post">
<div class="card">
<div class="card-content">
<span class="card-title">{{ page.title }}</span>
<div class="row">
<div class="col" style="padding-left:0;"><span class="mdi mdi-account">{{config.author}}</span></div>
<div class="col"><span class="mdi mdi-clock">{{date(page.date, 'YYYY/M/D')}}</span></div>
</div>
{{ PostTags(page) }}
{% if page.photos && page.photos.length > 0%}
{{Gallery(page.photos)}}
{% endif %}
<div class="entry">
{% autoescape false %}{{ page.content }}{% endautoescape %}
</div>
</div>
</div>
</article>
<div id="paginator">

View file

@ -1,21 +1,27 @@
{% extends 'includes/layout.swig' %}
{% block body %}
<div id="tag">
<h1>{{ page.tag }}</h1>
{% for article in page.posts.toArray() %}
<div class="tag-item">
<a href="{{ url_for(article.path) }}">
{{ article.title }}
</a>
<time datetime="{{ date_xml(article.date) }}">
{{ date(article.date) }}
</time>
</div>
{% endfor %}
</div>
{% import "includes/paginator.swig" as P %}
<div id="paginator">
{{ paginator() }}
{% block body %}
<h2 style="margin-left: 1rem">{{page.tag}}</h2>
<ul class="collapsible popout">
{% for article in page.posts.toArray() %}
<li>
<div class="collapsible-header">{{article.title}}</div>
<div class="collapsible-body small-padding">
<div class="mdi mdi-clock" style="padding-left: 1rem; padding-bottom: 8px;">{{ date(article.date) }}</div>
<div class="entry">{{article.excerpt}}</div>
<div class="card z-depth-0">
<div class="card-action" style="padding-bottom: 0; padding-left: 14px;">
<a href="{{url_for(article.path)}}">Go To "{{article.title}}"</a>
</div>
</div>
</div>
</li>
{% endfor %}
</ul>
<div id="center">
{{ P.Paginiation() }}
</div>
{% endblock %}

View file

@ -20,3 +20,7 @@ main
@media only screen and (min-width: 992px)
.card .card-content
padding: 12px
.collapsible .small-padding
padding: 1rem !important
padding-bottom: 0 !important