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 %} {% block content %}
<article class="post"> <article class="post">
<header> <header>
<div class="title"> <div class="title">
<h2>{{ page.header.title }}</h2> <h2>{{ page.header.title }}</h2>
</div>
<div class="meta">
</div> </div>
</header> <div class="meta"></div>
</header>
{{ content|raw }} {{ content|raw }}
{% include "forms/form.html.twig" %} {% include "forms/form.html.twig" %}
</article> </article>

View file

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

View file

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

View file

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

View file

@ -5,84 +5,91 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="{{ grav.language.getActive ?: grav.config.site.default_lang }}"> <html lang="{{ grav.language.getActive ?: grav.config.site.default_lang }}">
<head> <head>
{% block head deferred %} {% block head deferred %}
<title>{% if page.title %}{{ page.title|e('html') }} | {% endif %}{{ site.title|e('html') }}</title> <title>
<meta charset="utf-8" /> {% if page.title %}
<meta http-equiv="X-UA-Compatible" content="IE=edge"> {{ page.title|e('html') }}
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=yes" /> {% endif %}
{% include 'partials/metadata.html.twig' %} {{ site.title|e('html') }}</title>
<link rel="icon" type="{{ favicon.type }}" href="{{ url( favicon.path ) }}"/> <meta charset="utf-8"/>
<link rel="canonical" href="{{ page.url(true, true) }}" /> <meta http-equiv="X-UA-Compatible" content="IE=edge">
{% endblock head %} <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 %} {% block stylesheets %}
{% do assets.addCss('theme://assets/css/main'~compress) %} {% do assets.addCss('theme://assets/css/main'~compress) %}
{% do assets.addCss('theme://assets/css/fontawesome-all.min.css') %} {% do assets.addCss('theme://assets/css/fontawesome-all.min.css') %}
{% do assets.addCss('theme://assets/css/misc.css') %} {% do assets.addCss('theme://assets/css/misc.css') %}
{% do assets.addCss('theme://assets/css/custom.css', 5) %} {% do assets.addCss('theme://assets/css/custom.css', 5) %}
{% if page.template() == 'portfolio' %} {% if page.template() == 'portfolio' %}
{% do assets.addCss('theme://assets/css/glightbox.min.css') %} {% do assets.addCss('theme://assets/css/glightbox.min.css') %}
{% endif %} {% endif %}
{% endblock %} {% endblock %}
{{ assets.css()|raw }} {{ 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 }}
</head> {% block javascripts %}
<body class="is-preload"> {% do assets.add('jquery',101) %}
<!-- Wrapper --> {% do assets.addJs('theme://assets/js/browser.min.js', {group:'bottom'}) %}
<div id="wrapper"> {% 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 %} </head>
{% include 'partials/header.html.twig' %} <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 %} {% endblock %}
{% block body %} {% endblock %}
{% block menu %}{% endblock %}
{% block main %}
<div id="main">
{% block content %}{% endblock %}
</div>
{% block sidebar %}{% 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 %} {% block bottom %}
{{ assets.js('bottom')|raw }} {{ assets.js('bottom')|raw }}
{% if page.template() == 'portfolio' %} {% if page.template() == 'portfolio' %}
<script> <script>
const lightbox = GLightbox({ const lightbox = GLightbox({
touchNavigation: true, touchNavigation: true,
loop: true, loop: true,
autoplayVideos: true, autoplayVideos: true,
openEffect: 'zoom', openEffect: 'zoom',
closeEffect: 'fade' closeEffect: 'fade'
}); });
</script> </script>
{% endif %} {% endif %}
{% endblock %} {% endblock %}
</div> </div>
</body> </body>
</html> </html>
<!-- <!--
Future Imperfect by HTML5 UP Future Imperfect by HTML5 UP
html5up.net | @ajlkn html5up.net | @ajlkn
Free for personal and commercial use under the CCA 3.0 license (html5up.net/license) 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"> <article class="post" itemprop="liveBlogUpdate" itemscope itemtype="http://schema.org/BlogPosting">
{% if page.header.metadata.author %} {% if page.header.metadata.author %}
{% set author = page.header.metadata.author %} {% set author = page.header.metadata.author %}
{% elseif page.header.author %} {% elseif page.header.author %}
{% set author = page.header.author %} {% set author = page.header.author %}
{% else %} {% else %}
{% set author = page.header.taxonomy.author[0] %} {% set author = page.header.taxonomy.author[0] %}
{% endif %} {% endif %}
{% if author %} {% if author %}
{% set avatar = author|replace(' ', '-')|lower %} {% set avatar = author|replace(' ', '-')|lower %}
{% endif %} {% endif %}
<header> <header>
<div class="title"> <div class="title">
{% if page.header.link %} {% if page.header.link %}
<h2 itemprop="headline"> <h2 itemprop="headline">
{% if page.header.continue_link is not sameas(false) %} {% if page.header.continue_link is not sameas(false) %}
<a href="{{ page.url }}"></a> <a href="{{ page.url }}"></a>
{% endif %} {% endif %}
<a href="{{ page.header.link }}">{{ page.title }}</a> <a href="{{ page.header.link }}">{{ page.title }}</a>
</h2> </h2>
{% else %} {% else %}
<h2 itemprop="headline"><a href="{{ page.url }}">{{ page.title }}</a></h2> <h2 itemprop="headline">
{% endif %} <a href="{{ page.url }}">{{ page.title }}</a>
{% if page.header.subtitle %} </h2>
{% endif %}
{% if page.header.subtitle %}
<p itemprop="alternativeHeadline">{{ page.header.subtitle|raw }}</p> <p itemprop="alternativeHeadline">{{ page.header.subtitle|raw }}</p>
{% endif %} {% endif %}
</div> </div>
<div class="meta"> <div class="meta">
{% if plugin.translate_date.enabled %} {% if plugin.translate_date.enabled %}
<time class="published" itemprop="datePublished" datetime="{{ page.date|td(null, "Y-m-d") }}">{{ page.date|td }}</time> <time class="published" itemprop="datePublished" datetime="{{ page.date|td(null, "Y-m-d") }}">{{ page.date|td }}</time>
{% else %} {% else %}
<time class="published" itemprop="datePublished" datetime="{{ page.date|date("Y-m-d") }}">{{ page.date|date("M j, Y") }}</time> <time class="published" itemprop="datePublished" datetime="{{ page.date|date("Y-m-d") }}">{{ page.date|date("M j, Y") }}</time>
{% endif %} {% endif %}
{% if author %} {% 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> <a href="{{ base_url }}/author{{ config.system.param_sep }}{{ author }}" itemprop="keywords" class="author">{{ tag }}<span class="name" rel="author">{{ author }}</span>
{% endif %} {% if page.header.avatarImage %}<img src="{{ page.media[page.header.avatarImage].url|e}}" alt="{{ author }}"/>
{% endif %}
</a>
{% endif %}
</div> </div>
</header> </header>
{% if page.header.primaryImage %} {% 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> <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 %} {% 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> <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 %} {% endif %}
<div itemprop="articleBody"> <div itemprop="articleBody">
{% if page.header.continue_link is sameas(false) %} {% if page.header.continue_link is sameas(false) %}
{{ page.content|raw }} {{ page.content|raw }}
{% if not truncate %} {% if not truncate %}
{% set show_prev_next = true %} {% set show_prev_next = true %}
{% endif %} {% endif %}
{% elseif truncate and page.summary != page.content %} {% elseif truncate and page.summary != page.content %}
{{ page.summary|raw }} {{ page.summary|raw }}
{% elseif truncate %} {% elseif truncate %}
{{ page.content|truncate(550)|raw }} {{ page.content|truncate(550)|raw }}
{% else %} {% else %}
{{ page.content|raw }} {{ page.content|raw }}
{% set show_prev_next = true %} {% set show_prev_next = true %}
{% endif %} {% endif %}
</div>
</div> <footer>
<footer>
<ul class="actions"> <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> <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> <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 %} {% 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 %} {% endif %}
{% if not page.isFirst %} {% 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 %}
{% endif %}
</ul> </ul>
<ul class="stats"> <ul class="stats">
{% if page.taxonomy.tag %} {% if page.taxonomy.tag %}
{% for tag in 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 %} {% endfor %}
{% endif %} {% endif %}
<li><a href="https://twitter.com/share" data-url="{{ page.url(true) }}" data-text="{{ page.title }}" class="icon brands fa-twitter"> <li><a href="https://twitter.com/share" data-url="{{ page.url(true) }}" data-text="{{ page.title }}" class="icon brands fa-twitter"></a></li>
</a></li> <li><a href="http://www.facebook.com/sharer.php?u={{ page.url(true) }}" class="icon brands fa-facebook"></a></li>
<li><a href="http://www.facebook.com/sharer.php?u={{ page.url(true) }}" class="icon brands fa-facebook">
</a></li>
</ul> </ul>
</footer> </footer>
</article> </article>