Autoformatted some twigs

This commit is contained in:
pikim 2023-01-19 23:01:41 +01:00
parent 0cd5ea1b28
commit e970f998e4
6 changed files with 234 additions and 222 deletions

View file

@ -2,12 +2,11 @@
{% block content %}
<article class="post">
<header>
<div class="title">
<h2>{{ page.header.title }}</h2>
</div>
<div class="meta">
<div class="title">
<h2>{{ page.header.title }}</h2>
</div>
</header>
<div class="meta"></div>
</header>
{{ content|raw }}
{% include "forms/form.html.twig" %}
</article>

View file

@ -1,22 +1,22 @@
{% extends 'partials/base.html.twig' %}
{% block content %}
<article class="post">
<article class="post">
<header>
<div class="title">
<h2>{{ form.message }}</h2>
</div>
<div class="meta">
{% if plugin.translate_date.enabled %}
<time class="published" datetime="{{ form.date|td(null, "Y-m-d") }}">{{ form.date|td }}</time>
{% else %}
<time class="published" datetime="{{ form.date|date("Y-m-d") }}">{{ form.date|date("M j, Y") }}</time>
{% endif %}
</div>
</header>
<p>{{'FUTURE.FORM_SUMMARY'|t}}</p>
<div class="title">
<h2>{{ form.message }}</h2>
</div>
<div class="meta">
{% if plugin.translate_date.enabled %}
<time class="published" datetime="{{ form.date|td(null, "Y-m-d") }}">{{ form.date|td }}</time>
{% else %}
<time class="published" datetime="{{ form.date|date("Y-m-d") }}">{{ form.date|date("M j, Y") }}</time>
{% endif %}
</div>
</header>
<p>{{'FUTURE.FORM_SUMMARY'|t}}</p>
{{ content|raw }}
{{ content|raw }}
{% include "forms/data.html.twig" %}
</article>
{% include "forms/data.html.twig" %}
</article>
{% endblock %}

View file

@ -1,51 +1,48 @@
{% macro render_field(form, fields, scope) %}
{% import _self as self %}
{% import _self as self %}
{% for index, field in fields %}
{% set input = attribute(field, "input@") %}
{% for index, field in fields %}
{% set input = attribute(field, "input@") %}
{% if input is null or input == true %}
{% if input is null or input == true %}
{% if form.value(scope ~ field.name) %}
{% block field %}
<div>
{% block field_name %}
<strong>{{ field.name|t|e }}</strong>:
{% endblock %}
{% if form.value(scope ~ field.name) %}
{% block field %}
<div>
{% block field_name %}
<strong>{{ field.name|t|e }}</strong>:
{% endblock %}
{% block field_value %}
{% if field.type == 'checkboxes' %}
<ul>
{% set use_keys = field.use is defined and field.use == 'keys' %}
{% for key,value in form.value(scope ~ field.name) %}
{% set index = (use_keys ? key : value) %}
<li>{{ field.options[index]|e }}</li>
{% endfor %}
</ul>
{% elseif field.type == 'checkbox' %}
{{ (form.value(scope ~ field.name) == 1) ? "GRAV.YES"|t|e : "GRAV.NO"|t|e }}
{% elseif field.type == 'privacy' %}
{{ (form.value(scope ~ field.name) == 1) ? "Acepta la Política de Privacidad, Si"|t|e : "GRAV.NO"|t|e }}
{% elseif field.type == 'select' %}
{{ field.options[form.value(scope ~ field.name)]|e }}
{% else %}
{{ string(form.value(scope ~ field.name))|nl2br }}
{% endif %}
{% endblock %}
</div>
{% endblock %}
{% endif %}
{% else %}
{% if field.fields %}
{% set new_scope = field.nest_id ? scope ~ field.name ~ '.' : scope %}
{{ self.render_field(form, field.fields, new_scope) }}
{% endif %}
{% endif %}
{% endfor %}
{% block field_value %}
{% if field.type == 'checkboxes' %}
<ul>
{% set use_keys = field.use is defined and field.use == 'keys' %}
{% for key,value in form.value(scope ~ field.name) %}
{% set index = (use_keys ? key : value) %}
<li>{{ field.options[index]|e }}</li>
{% endfor %}
</ul>
{% elseif field.type == 'checkbox' %}
{{ (form.value(scope ~ field.name) == 1) ? "GRAV.YES"|t|e : "GRAV.NO"|t|e }}
{% elseif field.type == 'privacy' %}
{{ (form.value(scope ~ field.name) == 1) ? "Acepta la Política de Privacidad, Si"|t|e : "GRAV.NO"|t|e }}
{% elseif field.type == 'select' %}
{{ field.options[form.value(scope ~ field.name)]|e }}
{% else %}
{{ string(form.value(scope ~ field.name))|nl2br }}
{% endif %}
{% endblock %}
</div>
{% endblock %}
{% endif %}
{% else %}
{% if field.fields %}
{% set new_scope = field.nest_id ? scope ~ field.name ~ '.' : scope %}
{{ self.render_field(form, field.fields, new_scope) }}
{% endif %}
{% endif %}
{% endfor %}
{% endmacro %}
{% import _self as macro %}
{{ macro.render_field(form, form.fields, '') }}

View file

@ -1,27 +1,28 @@
<section>
<ul class="posts">
<ul class="posts">
{% for p in page.find(theme_config.blog_page).children.order('date', 'desc').slice(0, 5) %}
{% if p.header.primaryImage %}
{% set bannerimage = p.media[p.header.primaryImage]%}
{% else %}
{% set bannerimage = p.media.images|first %}
{% endif %}
<li>
{% if p.header.primaryImage %}
{% set bannerimage = p.media[p.header.primaryImage]%}
{% else %}
{% set bannerimage = p.media.images|first %}
{% endif %}
<li>
<article>
<header>
<h3><a href="{{p.url}}">{{ p.title }}</a></h3>
{% if plugin.translate_date.enabled %}
<time class="published" datetime="{{ p.date|td(null, "Y-m-d") }}">{{ p.date|td }}</time>
{% else %}
<time class="published" datetime="{{ p.date|date("Y-m-d") }}">{{ p.date|date("M j, Y") }}</time>
{% endif %}
</header>
<a href="{{p.url}}" class="image">
<header>
<h3>
<a href="{{p.url}}">{{ p.title }}</a>
</h3>
{% if plugin.translate_date.enabled %}
<time class="published" datetime="{{ p.date|td(null, "Y-m-d") }}">{{ p.date|td }}</time>
{% else %}
<time class="published" datetime="{{ p.date|date("Y-m-d") }}">{{ p.date|date("M j, Y") }}</time>
{% endif %}
</header>
<a href="{{p.url}}" class="image">
{{ bannerimage.cropZoom(64,64).quality(60).loading('lazy').html('',p.title)|raw }}
</a>
</article>
</li>
{% endfor %}
</ul>
</a>
</article>
</li>
{% endfor %}
</ul>
</section>

View file

@ -5,84 +5,91 @@
<!DOCTYPE html>
<html lang="{{ grav.language.getActive ?: grav.config.site.default_lang }}">
<head>
{% block head deferred %}
<title>{% if page.title %}{{ page.title|e('html') }} | {% endif %}{{ site.title|e('html') }}</title>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=yes" />
{% include 'partials/metadata.html.twig' %}
<link rel="icon" type="{{ favicon.type }}" href="{{ url( favicon.path ) }}"/>
<link rel="canonical" href="{{ page.url(true, true) }}" />
{% endblock head %}
<head>
{% block head deferred %}
<title>
{% if page.title %}
{{ page.title|e('html') }}
{% endif %}
{{ site.title|e('html') }}</title>
<meta charset="utf-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=yes"/>
{% include 'partials/metadata.html.twig' %}
<link rel="icon" type="{{ favicon.type }}" href="{{ url( favicon.path ) }}"/>
<link rel="canonical" href="{{ page.url(true, true) }}"/>
{% endblock head %}
{% block stylesheets %}
{% do assets.addCss('theme://assets/css/main'~compress) %}
{% do assets.addCss('theme://assets/css/fontawesome-all.min.css') %}
{% do assets.addCss('theme://assets/css/misc.css') %}
{% do assets.addCss('theme://assets/css/custom.css', 5) %}
{% if page.template() == 'portfolio' %}
{% do assets.addCss('theme://assets/css/glightbox.min.css') %}
{% endif %}
{% endblock %}
{{ assets.css()|raw }}
{% block javascripts %}
{% do assets.add('jquery',101) %}
{% do assets.addJs('theme://assets/js/browser.min.js', {group:'bottom'}) %}
{% do assets.addJs('theme://assets/js/breakpoints.min.js', {group:'bottom'}) %}
{% do assets.addJs('theme://assets/js/util.js', {group:'bottom'}) %}
{% do assets.addJs('theme://assets/js/main.js', {group:'bottom'}) %}
{% do assets.addJs('theme://assets/js/custom.js', {group:'bottom'}) %}
{% if page.template() == 'portfolio' %}
{% do assets.addJs('theme://assets/js/glightbox.min.js', {group:'bottom'}) %}
{% endif %}
{% endblock %}
{{ assets.js()|raw }}
{% block stylesheets %}
{% do assets.addCss('theme://assets/css/main'~compress) %}
{% do assets.addCss('theme://assets/css/fontawesome-all.min.css') %}
{% do assets.addCss('theme://assets/css/misc.css') %}
{% do assets.addCss('theme://assets/css/custom.css', 5) %}
{% if page.template() == 'portfolio' %}
{% do assets.addCss('theme://assets/css/glightbox.min.css') %}
{% endif %}
{% endblock %}
{{ assets.css()|raw }}
</head>
<body class="is-preload">
<!-- Wrapper -->
<div id="wrapper">
{% block javascripts %}
{% do assets.add('jquery',101) %}
{% do assets.addJs('theme://assets/js/browser.min.js', {group:'bottom'}) %}
{% do assets.addJs('theme://assets/js/breakpoints.min.js', {group:'bottom'}) %}
{% do assets.addJs('theme://assets/js/util.js', {group:'bottom'}) %}
{% do assets.addJs('theme://assets/js/main.js', {group:'bottom'}) %}
{% do assets.addJs('theme://assets/js/custom.js', {group:'bottom'}) %}
{% if page.template() == 'portfolio' %}
{% do assets.addJs('theme://assets/js/glightbox.min.js', {group:'bottom'}) %}
{% endif %}
{% endblock %}
{{ assets.js()|raw }}
{% block header %}
{% include 'partials/header.html.twig' %}
</head>
<body
class="is-preload">
<!-- Wrapper -->
<div id="wrapper">
{% block header %}
{% include 'partials/header.html.twig' %}
{% endblock %}
{% block body %}
{% block menu %}{% endblock %}
{% block main %}
<div id="main">
{% block content %}{% endblock %}
</div>
{% block sidebar %}{% endblock %}
{% endblock %}
{% block body %}
{% block menu %}{% endblock %}
{% block main %}
<div id="main">
{% block content %}{% endblock %}
</div>
{% block sidebar %}{% endblock %}
{% endblock %}
{% endblock %}
{% endblock %}
<a id="back-to-top" href="#"><i class="fa fa-chevron-up"></i></a>
<a id="back-to-top" href="#">
<i class="fa fa-chevron-up"></i>
</a>
{% block bottom %}
{{ assets.js('bottom')|raw }}
{% if page.template() == 'portfolio' %}
<script>
const lightbox = GLightbox({
touchNavigation: true,
loop: true,
autoplayVideos: true,
openEffect: 'zoom',
closeEffect: 'fade'
});
</script>
{% endif %}
{% endblock %}
</div>
</body>
{% block bottom %}
{{ assets.js('bottom')|raw }}
{% if page.template() == 'portfolio' %}
<script>
const lightbox = GLightbox({
touchNavigation: true,
loop: true,
autoplayVideos: true,
openEffect: 'zoom',
closeEffect: 'fade'
});
</script>
{% endif %}
{% endblock %}
</div>
</body>
</html>
<!--
Future Imperfect by HTML5 UP
html5up.net | @ajlkn
Free for personal and commercial use under the CCA 3.0 license (html5up.net/license)
Future Imperfect by HTML5 UP
html5up.net | @ajlkn
Free for personal and commercial use under the CCA 3.0 license (html5up.net/license)
-->

View file

@ -1,98 +1,106 @@
<article class="post" itemprop="liveBlogUpdate" itemscope itemtype="http://schema.org/BlogPosting">
{% if page.header.metadata.author %}
{% set author = page.header.metadata.author %}
{% elseif page.header.author %}
{% set author = page.header.author %}
{% else %}
{% set author = page.header.taxonomy.author[0] %}
{% endif %}
{% if author %}
<article class="post" itemprop="liveBlogUpdate" itemscope itemtype="http://schema.org/BlogPosting">
{% if page.header.metadata.author %}
{% set author = page.header.metadata.author %}
{% elseif page.header.author %}
{% set author = page.header.author %}
{% else %}
{% set author = page.header.taxonomy.author[0] %}
{% endif %}
{% if author %}
{% set avatar = author|replace(' ', '-')|lower %}
{% endif %}
<header>
{% endif %}
<header>
<div class="title">
{% if page.header.link %}
{% if page.header.link %}
<h2 itemprop="headline">
{% if page.header.continue_link is not sameas(false) %}
<a href="{{ page.url }}"></a>
{% endif %}
<a href="{{ page.header.link }}">{{ page.title }}</a>
{% if page.header.continue_link is not sameas(false) %}
<a href="{{ page.url }}"></a>
{% endif %}
<a href="{{ page.header.link }}">{{ page.title }}</a>
</h2>
{% else %}
<h2 itemprop="headline"><a href="{{ page.url }}">{{ page.title }}</a></h2>
{% endif %}
{% if page.header.subtitle %}
{% else %}
<h2 itemprop="headline">
<a href="{{ page.url }}">{{ page.title }}</a>
</h2>
{% endif %}
{% if page.header.subtitle %}
<p itemprop="alternativeHeadline">{{ page.header.subtitle|raw }}</p>
{% endif %}
{% endif %}
</div>
<div class="meta">
{% if plugin.translate_date.enabled %}
<time class="published" itemprop="datePublished" datetime="{{ page.date|td(null, "Y-m-d") }}">{{ page.date|td }}</time>
{% else %}
<time class="published" itemprop="datePublished" datetime="{{ page.date|date("Y-m-d") }}">{{ page.date|date("M j, Y") }}</time>
{% endif %}
{% if author %}
<a href="{{ base_url }}/author{{ config.system.param_sep }}{{ author }}" itemprop="keywords" class="author">{{ tag }}<span class="name" rel="author">{{ author }}</span>{% if page.header.avatarImage %}<img src="{{ page.media[page.header.avatarImage].url|e}}" alt="{{ author }}" />{% endif %}</a>
{% endif %}
{% if plugin.translate_date.enabled %}
<time class="published" itemprop="datePublished" datetime="{{ page.date|td(null, "Y-m-d") }}">{{ page.date|td }}</time>
{% else %}
<time class="published" itemprop="datePublished" datetime="{{ page.date|date("Y-m-d") }}">{{ page.date|date("M j, Y") }}</time>
{% endif %}
{% if author %}
<a href="{{ base_url }}/author{{ config.system.param_sep }}{{ author }}" itemprop="keywords" class="author">{{ tag }}<span class="name" rel="author">{{ author }}</span>
{% if page.header.avatarImage %}<img src="{{ page.media[page.header.avatarImage].url|e}}" alt="{{ author }}"/>
{% endif %}
</a>
{% endif %}
</div>
</header>
</header>
{% if page.header.primaryImage %}
<a href="{{ page.url }}" class="image featured">{{ page.media[page.header.primaryImage].cropZoom(1038,437).loading('lazy').html(page.title, page.title, 'image featured')|raw }}</a>
{% elseif page.media.images %}
<a href="{{ page.url }}" class="image featured">{{ page.media.images|first.cropZoom(1038,437).loading('lazy').html(page.title, page.title, 'image featured')|raw }}</a>
{% endif %}
{% if page.header.primaryImage %}
<a href="{{ page.url }}" class="image featured">{{ page.media[page.header.primaryImage].cropZoom(1038,437).loading('lazy').html(page.title, page.title, 'image featured')|raw }}</a>
{% elseif page.media.images %}
<a href="{{ page.url }}" class="image featured">{{ page.media.images|first.cropZoom(1038,437).loading('lazy').html(page.title, page.title, 'image featured')|raw }}</a>
{% endif %}
<div itemprop="articleBody">
<div itemprop="articleBody">
{% if page.header.continue_link is sameas(false) %}
{{ page.content|raw }}
{% if not truncate %}
{{ page.content|raw }}
{% if not truncate %}
{% set show_prev_next = true %}
{% endif %}
{% endif %}
{% elseif truncate and page.summary != page.content %}
{{ page.summary|raw }}
{{ page.summary|raw }}
{% elseif truncate %}
{{ page.content|truncate(550)|raw }}
{{ page.content|truncate(550)|raw }}
{% else %}
{{ page.content|raw }}
{% set show_prev_next = true %}
{{ page.content|raw }}
{% set show_prev_next = true %}
{% endif %}
</div>
</div>
<footer>
<footer>
<ul class="actions">
{% if truncate and page.summary != page.content %}
{% if truncate and page.summary != page.content %}
<li><a href="{{ page.url }}" class="button">{{'FUTURE.BLOG.ITEM.CONTINUE_READING'|t}}</a></li>
{% elseif truncate %}
{% elseif truncate %}
<li><a href="{{ page.url }}" class="button">{{'FUTURE.BLOG.ITEM.CONTINUE_READING'|t}}</a></li>
{% endif %}
{% endif %}
{% if show_prev_next %}
{% if show_prev_next %}
{% if not page.isLast %}
<li><a class="button" href="{{ page.prevSibling.url }}"><i class="fa fa-chevron-left"></i> {{'FUTURE.BLOG.ITEM.PREV_POST'|t}}</a></li>
<li>
<a class="button" href="{{ page.prevSibling.url }}">
<i class="fa fa-chevron-left"></i>
{{'FUTURE.BLOG.ITEM.PREV_POST'|t}}</a>
</li>
{% endif %}
{% if not page.isFirst %}
<li><a class="button" href="{{ page.nextSibling.url }}">{{'FUTURE.BLOG.ITEM.NEXT_POST'|t}} <i class="fa fa-chevron-right"></i></a></li>
<li>
<a class="button" href="{{ page.nextSibling.url }}">{{'FUTURE.BLOG.ITEM.NEXT_POST'|t}}
<i class="fa fa-chevron-right"></i>
</a>
</li>
{% endif %}
{% endif %}
{% endif %}
</ul>
<ul class="stats">
{% if page.taxonomy.tag %}
{% if page.taxonomy.tag %}
{% for tag in page.taxonomy.tag %}
<li><a href="{{ base_url }}/tag{{ config.system.param_sep }}{{ tag }}" itemprop="keywords">{{ tag }}</a></li>
<li><a href="{{ base_url }}/tag{{ config.system.param_sep }}{{ tag }}" itemprop="keywords">{{ tag }}</a></li>
{% endfor %}
{% endif %}
<li><a href="https://twitter.com/share" data-url="{{ page.url(true) }}" data-text="{{ page.title }}" class="icon brands fa-twitter">
</a></li>
<li><a href="http://www.facebook.com/sharer.php?u={{ page.url(true) }}" class="icon brands fa-facebook">
</a></li>
{% endif %}
<li><a href="https://twitter.com/share" data-url="{{ page.url(true) }}" data-text="{{ page.title }}" class="icon brands fa-twitter"></a></li>
<li><a href="http://www.facebook.com/sharer.php?u={{ page.url(true) }}" class="icon brands fa-facebook"></a></li>
</ul>
</footer>
</footer>
</article>