mirror of
https://github.com/pmoreno-rodriguez/grav-theme-future2021.git
synced 2025-07-19 08:28:54 +00:00
Add twigs for downloads, gallery (unite) and guestbook
This commit is contained in:
parent
c7064f9863
commit
af8a941b9c
5 changed files with 214 additions and 0 deletions
45
templates/downloads.html.twig
Normal file
45
templates/downloads.html.twig
Normal file
|
@ -0,0 +1,45 @@
|
|||
{% extends 'partials/base.html.twig' %}
|
||||
|
||||
{% if page.header.show_breadcrumbs is defined %}
|
||||
{% set show_breadcrumbs = page.header.show_breadcrumbs %}
|
||||
{% else %}
|
||||
{% set show_breadcrumbs = true %}
|
||||
{% endif %}
|
||||
|
||||
{% block menu %}
|
||||
{% include 'partials/sidebar_right.html.twig' %}
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
{% if show_breadcrumbs and config.plugins.breadcrumbs.enabled %}
|
||||
{% include 'partials/breadcrumbs.html.twig' %}
|
||||
{% endif %}
|
||||
|
||||
<article class="post">
|
||||
<header>
|
||||
<div class="title">
|
||||
<h2>{{ page.header.title }}</h2>
|
||||
{% if page.header.subtitle %}
|
||||
<p>{{ page.header.subtitle }}</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
</header>
|
||||
{{ page.content|raw}}
|
||||
|
||||
<table>
|
||||
{% for file in page.media.files %}
|
||||
{% for type in page.header.file_types %}
|
||||
{% if file.extension == type.extension or type.extension == '*' %}
|
||||
<tr>
|
||||
{% include 'partials/download_item.html.twig' with {file: file} %}
|
||||
</tr>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
</table>
|
||||
</article>
|
||||
|
||||
<section id="footer" class="align-center">
|
||||
{% include 'partials/footer.html.twig' %}
|
||||
</section>
|
||||
{% endblock %}
|
39
templates/gallery.html.twig
Normal file
39
templates/gallery.html.twig
Normal file
|
@ -0,0 +1,39 @@
|
|||
{% extends 'partials/base.html.twig' %}
|
||||
|
||||
{% if page.header.show_breadcrumbs is defined %}
|
||||
{% set show_breadcrumbs = page.header.show_breadcrumbs %}
|
||||
{% else %}
|
||||
{% set show_breadcrumbs = true %}
|
||||
{% endif %}
|
||||
|
||||
{% block menu %}
|
||||
{% include 'partials/sidebar_right.html.twig' %}
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
{% if show_breadcrumbs and config.plugins.breadcrumbs.enabled %}
|
||||
{% include 'partials/breadcrumbs.html.twig' %}
|
||||
{% endif %}
|
||||
|
||||
<article class="post">
|
||||
<header>
|
||||
<div class="title">
|
||||
<h2>{{ page.header.title }}</h2>
|
||||
{% if page.header.subtitle %}
|
||||
<p>{{ page.header.subtitle }}</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
</header>
|
||||
{{ page.content|raw}}
|
||||
|
||||
<section>
|
||||
<div class="modular-row gallery-container {{ page.header.class }}">
|
||||
{{ unite_gallery(page.media.images) }}
|
||||
</div>
|
||||
</section>
|
||||
</article>
|
||||
|
||||
<section id="footer" class="align-center">
|
||||
{% include 'partials/footer.html.twig' %}
|
||||
</section>
|
||||
{% endblock %}
|
88
templates/guestbook.html.twig
Normal file
88
templates/guestbook.html.twig
Normal file
|
@ -0,0 +1,88 @@
|
|||
{% extends 'partials/base.html.twig' %}
|
||||
|
||||
{% if page.header.show_breadcrumbs is defined %}
|
||||
{% set show_breadcrumbs = page.header.show_breadcrumbs %}
|
||||
{% else %}
|
||||
{% set show_breadcrumbs = true %}
|
||||
{% endif %}
|
||||
|
||||
{% block menu %}
|
||||
{% include 'partials/sidebar_right.html.twig' %}
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
{% if show_breadcrumbs and config.plugins.breadcrumbs.enabled %}
|
||||
{% include 'partials/breadcrumbs.html.twig' %}
|
||||
{% endif %}
|
||||
|
||||
<article class="post">
|
||||
<header>
|
||||
<div class="title">
|
||||
<h2>{{ page.header.title }}</h2>
|
||||
{% if page.header.subtitle %}
|
||||
<p>{{ page.header.subtitle }}</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
</header>
|
||||
{{ page.content|raw}}
|
||||
|
||||
{% include "forms/form.html.twig" %}
|
||||
|
||||
<script>
|
||||
$(function() {
|
||||
var currentPage = 0;
|
||||
|
||||
$(document).on('click tap', '.js__load-more', function(event) {
|
||||
$.getJSON(window.location + '/page:' + (currentPage + 1))
|
||||
.success(function(response) {
|
||||
currentPage = parseInt(response.page);
|
||||
|
||||
response.messages.forEach(function(message) {
|
||||
$('.js__messages-container').append('<tr>' +
|
||||
'<td>' + message.text + '<br />{{'PLUGIN_GUESTBOOK.WRITTEN_ON'|t}} ' + message.date + ' {{'PLUGIN_GUESTBOOK.BY'|t}} ' + message.author + '</td></tr>');
|
||||
});
|
||||
|
||||
var totalRetrieved = response.itemsPerPage * (parseInt(response.page) + 1);
|
||||
|
||||
$('.totalRetrieved').html(totalRetrieved);
|
||||
$('.totalAvailable').html(response.totalAvailable);
|
||||
|
||||
if (totalRetrieved >= response.totalAvailable) {
|
||||
$('.totalRetrieved').html($('.totalAvailable').html());
|
||||
$('.js__load-more').hide();
|
||||
}
|
||||
})
|
||||
.error(function() {
|
||||
alert('Unexpected error');
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
{% block item %}
|
||||
{% if grav.twig.guestbookMessages|length %}
|
||||
<h2>{{'PLUGIN_GUESTBOOK.MESSAGES'|t}}</h2>
|
||||
|
||||
{% for child in grav.twig.guestbookMessages.messages %}
|
||||
{% set child = child|merge({'title': child.author}) %}
|
||||
{% set child = child|merge({'content': child.text}) %}
|
||||
{% include 'partials/guestbook_item.html.twig' with {'page':child, 'truncate':false} %}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
{% if grav.twig.guestbookMessages.totalRetrieved < grav.twig.guestbookMessages.totalAvailable %}
|
||||
<form>
|
||||
<div class="buttons">
|
||||
<button type="button" class="button js__load-more">
|
||||
Load more
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
</article>
|
||||
|
||||
<section id="footer" class="align-center">
|
||||
{% include 'partials/footer.html.twig' %}
|
||||
</section>
|
||||
{% endblock %}
|
21
templates/partials/download_item.html.twig
Normal file
21
templates/partials/download_item.html.twig
Normal file
|
@ -0,0 +1,21 @@
|
|||
{% set size = file.size/1024 %}
|
||||
{% set unit = "kB" %}
|
||||
{% if size > 1023 %}
|
||||
{% set size = size/1024 %}
|
||||
{% set unit = "MB" %}
|
||||
{% endif %}
|
||||
<td style="text-align: right; vertical-align: middle;">
|
||||
<a href="{{ file.url }}">
|
||||
<!--<ul class="icons">
|
||||
<li><i class="fa fa-file-pdf"></i></li>
|
||||
</ul>-->
|
||||
<img src="https://github.com/r00t0vi4/mime-icons-packs/raw/master/mime-icons-pack-1/src/{{file.extension}}.png">
|
||||
</a>
|
||||
</td>
|
||||
<td style="text-align: left; vertical-align: middle;">
|
||||
<a href="{{ file.url }}">
|
||||
{{ file.filename }}<br/>
|
||||
{{ size|number_format(2, '.', ',') }}{{ unit }} |
|
||||
{{ file.modified|dateTranslate(grav.config.system.pages.dateformat.long) }}
|
||||
</a>
|
||||
</td>
|
21
templates/partials/guestbook_item.html.twig
Normal file
21
templates/partials/guestbook_item.html.twig
Normal file
|
@ -0,0 +1,21 @@
|
|||
{# based on future2021 blog_item.html.twig and heavily stripped down #}
|
||||
|
||||
<article class="post" itemprop="liveBlogUpdate" itemscope itemtype="http://schema.org/BlogPosting">
|
||||
<header>
|
||||
<div class="title">
|
||||
<h2 itemprop="headline">{{ page.title }}</h2>
|
||||
</div>
|
||||
<div class="meta">
|
||||
<time class="published" itemprop="datePublished" datetime="{{page.date|dateTranslate(grav.config.system.pages.dateformat.short)}}">{{ page.date|dateTranslate(grav.config.system.pages.dateformat.short)}}</time>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<div itemprop="articleBody">
|
||||
{{ page.content|raw }}
|
||||
</div>
|
||||
|
||||
<footer>
|
||||
<ul class="stats"> {# for bottom spacing #}
|
||||
</ul>
|
||||
</footer>
|
||||
</article>
|
Loading…
Add table
Reference in a new issue