mirror of
https://github.com/pmoreno-rodriguez/grav-theme-future2021.git
synced 2025-06-07 20:08:54 +00:00
Add twigs for the events plugin (based on the ones from the plugin)
This commit is contained in:
parent
af8a941b9c
commit
2f644cfa1a
4 changed files with 316 additions and 0 deletions
163
templates/calendar.html.twig
Normal file
163
templates/calendar.html.twig
Normal file
|
@ -0,0 +1,163 @@
|
|||
{% 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 }}
|
||||
|
||||
{% set prevYearUrl = page.url ~ '/year:' ~ calendar.prevYear|date('Y') ~ '/month:' ~ calendar.prevYear|date('m') %}
|
||||
{% set nextYearUrl = page.url ~ '/year:' ~ calendar.nextYear|date('Y') ~ '/month:' ~ calendar.nextYear|date('m') %}
|
||||
{% set prevMonthUrl = page.url ~ '/year:' ~ calendar.prev.date|date('Y') ~ '/month:' ~ calendar.prev.date|date('m') %}
|
||||
{% set nextMonthUrl = page.url ~ '/year:' ~ calendar.next.date|date('Y') ~ '/month:' ~ calendar.next.date|date('m') %}
|
||||
{% set currMonthUrl = page.url ~ '/year:' ~ now|date('Y') ~ '/month:' ~ now|date('m') %}
|
||||
|
||||
{% set prevYearTitle = calendar.prevYear|dateTranslate(config.plugins.events.calendar.header) %}
|
||||
{% set nextYearTitle = calendar.nextYear|dateTranslate(config.plugins.events.calendar.header) %}
|
||||
{% set prevMonthTitle = calendar.prev.date|dateTranslate(config.plugins.events.calendar.header) %}
|
||||
{% set nextMonthTitle = calendar.next.date|dateTranslate(config.plugins.events.calendar.header) %}
|
||||
|
||||
<div class="calendar-container clear-user-agent-styles">
|
||||
<section class="calendar-table">
|
||||
<table class="calendar">
|
||||
<thead class="calendar-head">
|
||||
<tr class="calendar-controls">
|
||||
<th class="calendar-buttons">
|
||||
<a href="{{ prevYearUrl }}" class="calendar-button" title="{{ prevYearTitle }}">«</a>
|
||||
</th>
|
||||
<th class="calendar-buttons">
|
||||
<a href="{{ prevMonthUrl }}" class="calendar-button" title="{{ prevMonthTitle }}">‹</a>
|
||||
</th>
|
||||
<th colspan="3" class="calendar-title">
|
||||
<a href="{{ currMonthUrl }}" title="{{ 'PLUGIN_EVENTS.CALENDAR.TODAY'|t }}">
|
||||
{{ calendar.date|dateTranslate(config.plugins.events.calendar.header) }}
|
||||
</a>
|
||||
</th>
|
||||
<th class="calendar-buttons">
|
||||
<a href="{{ nextMonthUrl }}" class="calendar-button" title="{{ nextMonthTitle }}">›</a>
|
||||
</th>
|
||||
<th class="calendar-buttons">
|
||||
<a href="{{ nextYearUrl }}" class="calendar-button" title="{{ nextYearTitle }}">»</a>
|
||||
</th>
|
||||
</tr>
|
||||
<tr class="calendar-headings">
|
||||
{% set fdowOffset = config.plugins.events.calendar.first_dow %}
|
||||
{% set dayChar = config.plugins.events.calendar.day_char %}
|
||||
{% if dayChar == 0 %}
|
||||
{% set dayChar = 1000 %}
|
||||
{% endif %}
|
||||
{% for day in range(0,6) %}
|
||||
<th class="calendar-heading">{{ 'GRAV.DAYS_OF_THE_WEEK'|ta((fdowOffset+day) % 7)|slice(0, dayChar) }}</th>
|
||||
{% endfor %}
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody class="calendar-body">
|
||||
<tr class="calendar-line">
|
||||
{% set startDow = (calendar.date|date('w') +6-fdowOffset) % 7 %}
|
||||
{% set dow = startDow %}
|
||||
{% set month = "now"|date("F") %}
|
||||
{% set year = "now"|date("Y") %}
|
||||
{% for day in range(1,calendar.daysInMonth) %}
|
||||
{% if loop.first and startDow != 0 %}
|
||||
<td colspan="{{ startDow }}"></td>
|
||||
{% endif %}
|
||||
<td class="calendar-cell">
|
||||
<div class="calendar-events">
|
||||
{% if calendar.events[calendar.year][calendar.month][day] != null %}
|
||||
{% set title_date = calendar.month ~ '/' ~ day ~ '/' ~ calendar.year %}
|
||||
<div class="calendar-day">
|
||||
<a class="calendar-day-link{% if (day == calendar.currentDay) and (month == calendar.date|date("F")) and (year == calendar.date|date("Y")) %} calendar-active{% endif %}"
|
||||
href="#!" title="{{ title_date|dateTranslate(config.plugins.events.calendar.anchor_title) }}">
|
||||
{{ day }}
|
||||
</a>
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="calendar-day{% if (day == calendar.currentDay) and (month == calendar.date|date("F")) and (year == calendar.date|date("Y")) %} calendar-active{% endif %}">
|
||||
<span>{{ day }}</span>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<div class="calendar-day-details">
|
||||
{% set title_date = calendar.month ~ '/' ~ day ~ '/' ~ calendar.year %}
|
||||
<h4 class="calendar-day">{{ title_date|dateTranslate(config.plugins.events.calendar.details.title) }}</h4>
|
||||
<ul class="calendar-day-events">
|
||||
{% for event in calendar.events[calendar.year][calendar.month][day] %}
|
||||
{% if event.title %}
|
||||
<li class="calendar-event">
|
||||
{% include 'partials/event_calendar_item.html.twig' with { 'event': event } %}
|
||||
</li>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
{% if loop.last and dow != 6 %}
|
||||
<td colspan="{{ 6 - dow }}"> </td>
|
||||
{% endif %}
|
||||
{% if dow == 6 %}
|
||||
{% set dow = 0 %}
|
||||
</tr>
|
||||
<tr class="calendar-line">
|
||||
{% else %}
|
||||
{% set dow = dow + 1 %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</section>
|
||||
|
||||
<section class="calendar-details">
|
||||
<div class="calendar-day-details">
|
||||
{% set day = "now"|date("j") %}
|
||||
{% set month = "now"|date("n") %}
|
||||
{% set year = "now"|date("Y") %}
|
||||
<h4 class="calendar-day">{{ "now"|dateTranslate(config.plugins.events.calendar.details.title) }}</h4>
|
||||
<ul class="calendar-day-events">
|
||||
{% if calendar.events[year][month][day] == null %}
|
||||
<li>{{ "PLUGIN_EVENTS.CALENDAR.NO_EVENTS"|t }}</li>
|
||||
{% else %}
|
||||
{% for event in calendar.events[year][month][day] %}
|
||||
{% if event.title %}
|
||||
<li class="calendar-event">
|
||||
{% include 'partials/event_calendar_item.html.twig' with { 'event': event } %}
|
||||
</li>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<p class="events-view-all">
|
||||
<a href="{{ base_url_absolute ~ config.plugins.events.events_subpage }}">{{ "PLUGIN_EVENTS.CALENDAR.VIEW_ALL_EVENTS"|t }}</a>
|
||||
</p>
|
||||
</section>
|
||||
</div><!--.calendar-container-->
|
||||
</article>
|
||||
|
||||
<section id="footer" class="align-center">
|
||||
{% include 'partials/footer.html.twig' %}
|
||||
</section>
|
||||
{% endblock %}
|
40
templates/event.html.twig
Normal file
40
templates/event.html.twig
Normal file
|
@ -0,0 +1,40 @@
|
|||
{% 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>
|
||||
|
||||
<div class="event-container">
|
||||
<section class="event-listing">
|
||||
{% include 'partials/event_item.html.twig' with { 'event': page.parent, 'single': true } %}
|
||||
</section>
|
||||
{% include 'partials/events_sidebar.html.twig' with { 'page': page.parent } %}
|
||||
</div>
|
||||
|
||||
</article>
|
||||
|
||||
<section id="footer" class="align-center">
|
||||
{% include 'partials/footer.html.twig' %}
|
||||
</section>
|
||||
{% endblock %}
|
51
templates/events.html.twig
Normal file
51
templates/events.html.twig
Normal file
|
@ -0,0 +1,51 @@
|
|||
{% extends 'partials/base.html.twig' %}
|
||||
|
||||
{% set collection = page.collection() %}
|
||||
{% 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 }}
|
||||
|
||||
<div class="events-container">
|
||||
<section class="events-listing">
|
||||
{% if collection|length != 0 %}
|
||||
{% for event in collection %}
|
||||
{% include 'partials/event_item.html.twig' with { 'page': event, 'single': false } %}
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
<h3>{{ "PLUGIN_EVENTS.EVENTS.NO_EVENTS_TITLE"|t }}</h3>
|
||||
<p>{{ ("PLUGIN_EVENTS.EVENTS.NO_EVENTS_CONTENT"|t(uri.param('category')))|markdown }}</p>
|
||||
{% endif %}
|
||||
</section>
|
||||
</div>
|
||||
</article>
|
||||
|
||||
{% if show_pagination and config.plugins.pagination.enabled and collection.params.pagination %}
|
||||
{% include 'partials/pagination.html.twig' with {base_url: page.url, pagination: collection.params.pagination} %}
|
||||
{% endif %}
|
||||
|
||||
<section id="footer" class="align-center">
|
||||
{% include 'partials/footer.html.twig' %}
|
||||
</section>
|
||||
{% endblock %}
|
62
templates/partials/event_item.html.twig
Normal file
62
templates/partials/event_item.html.twig
Normal file
|
@ -0,0 +1,62 @@
|
|||
<article class="event-article">
|
||||
<header class="event-header">
|
||||
{% set image = page.media.images|first %}
|
||||
{% if image != null %}
|
||||
{{ image.cropZoom(960,280).html }}
|
||||
{% endif %}
|
||||
</header>
|
||||
|
||||
<section class="event">
|
||||
<div class="event-left-column"> {# date and time #}
|
||||
{% if single == true %} {# individual content page #}
|
||||
{% else %} {# main listing page #}
|
||||
<time class="event-datetime" datetime="{{ page.date|date("c") }}">
|
||||
<span class="event-day">{{ page.header.event.start|dateTranslate(config.plugins.events.event_item.day) }}</span>
|
||||
<span class="event-month">{{ page.header.event.start|dateTranslate(config.plugins.events.event_item.month) }}</span>
|
||||
<span class="event-year">{{ page.header.event.start|date("Y") }}</span>
|
||||
<span class="event-time">
|
||||
{{ page.header.event.start|dateTranslate(config.plugins.events.event_item.time) }}{{ " - " }}{{ page.header.event.end|dateTranslate(config.plugins.events.event_item.time) }}
|
||||
</span>
|
||||
</time>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<div class="event-right-column"> {# title and content #}
|
||||
{% if single == true %} {# individual content page #}
|
||||
{% if (config.plugins.events.event_meta.display_location) and (page.header.event.location is not empty) %}
|
||||
<h3 class="event-location"><span class="location-pin"></span>{{ page.header.event.location }}</h3>
|
||||
{% endif %}
|
||||
{% if page.content %}
|
||||
<div class="event-content">{{ page.content|raw }}</div>
|
||||
{% else %}
|
||||
{{ "PLUGIN_EVENTS.EVENTS.NO_MORE_INFORMATION"|t }}
|
||||
{% endif %}
|
||||
{% include 'partials/event_meta.html.twig' with { 'page': page } %}
|
||||
|
||||
{% else %} {# main listing page #}
|
||||
{# {% if page.content %} #}
|
||||
<h2 class="event-title"><a href="{{ page.url }}">{{ page.title }}</a></h2>
|
||||
{#} {% else %}
|
||||
<h2 class="event-title">{{ page.title }}</h2>
|
||||
{% endif %} #}
|
||||
{% if (config.plugins.events.event_meta.display_location) and (page.header.event.location is not empty) %}
|
||||
<h3 class="event-location"><span class="location-pin"></span>{{ page.header.event.location }}</h3>
|
||||
{% endif %}
|
||||
{% if page.content %}
|
||||
<span class="event-read-more"><a href="{{ page.url }}">{{ "PLUGIN_EVENTS.EVENTS.MORE_INFORMATION"|t }}</a></span>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
{% if page.taxonomy.category and config.plugins.events.event_sidebar.enable_categories %}
|
||||
<div class="event-categories">
|
||||
<span class="event-tags">
|
||||
{% for category in page.taxonomy.category %}
|
||||
<a href="{{ event.url|rtrim('/') }}/category{{ config.system.param_sep }}{{ category }}">{{ category }}</a>
|
||||
{% endfor %}
|
||||
</span>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</section>
|
||||
</article>
|
||||
<article class="event-separator"></article>
|
Loading…
Add table
Reference in a new issue