pedf
/
fakulta-online
Archived
1
0
Fork 0

Výpis nástrojů pomocí makra

Aby bylo možné, dle požadavku, řadit nástroje podle toho, jestli mají
seznam pozitiv a negativ, je třeba vypisovat je ve dvou cyklech. Aby se
neopakoval kód v šabloně, probíhá vypsání nástroje pomocí makra.
master
Emil Miler 4 years ago
parent f0b9638611
commit 6af2af38a2

@ -0,0 +1,30 @@
{% macro print_tool(program) %}
<div class="program">
{% if program.extra.linkto and program.extra.directlink %}
<a href="{{ program.extra.linkto }}">
{% else %}
<a href="{{ program.permalink }}">
{% endif %}
<h4>{{ program.title }}</h4>
{% if program.extra.logo %}
<img src="/software/{{ program.extra.logo }}" alt="{{ program.title }}">
{% endif %}
</a>
<p>{{ program.description | safe }}</p>
{% if program.extra.positive_short and program.extra.negative_short %}
<div class="stats">
<ul class="positive">
{% for item in program.extra.positive_short %}
<li>{{ item }}</li>
{% endfor %}
</ul>
<ul class="negative">
{% for item in program.extra.negative_short %}
<li>{{ item }}</li>
{% endfor %}
</ul>
</div>
{% endif %}
</div>
{% endmacro print_tool %}

@ -1,4 +1,5 @@
{% extends "index.html" %} {% extends "index.html" %}
{% import "macros.html" as macros %}
{% block content %} {% block content %}
<section class="meta"> <section class="meta">
@ -19,33 +20,16 @@
<section class="software"> <section class="software">
{% for program in section.pages %} {% for program in section.pages %}
{% if program.taxonomies.categories and program.taxonomies.categories is containing(page.slug) %} {% if program.taxonomies.categories and program.taxonomies.categories is containing(page.slug) %}
<div class="program"> {% if program.extra.positive_short and program.extra.negative_short %}
{% if program.extra.linkto and program.extra.directlink %} {{ macros::print_tool(program=program) }}
<a href="{{ program.extra.linkto }}"> {% endif %}
{% else %} {% endif %}
<a href="{{ program.permalink }}"> {% endfor %}
{% endif %} {% for program in section.pages %}
<h4>{{ program.title }}</h4> {% if program.taxonomies.categories and program.taxonomies.categories is containing(page.slug) %}
{% if program.extra.logo %} {% if not program.extra.positive_short or not program.extra.negative_short %}
<img src="/software/{{ program.extra.logo }}" alt="{{ program.title }}"> {{ macros::print_tool(program=program) }}
{% endif %} {% endif %}
</a>
<p>{{ program.description | safe }}</p>
{% if program.extra.positive_short and program.extra.negative_short %}
<div class="stats">
<ul class="positive">
{% for item in program.extra.positive_short %}
<li>{{ item }}</li>
{% endfor %}
</ul>
<ul class="negative">
{% for item in program.extra.negative_short %}
<li>{{ item }}</li>
{% endfor %}
</ul>
</div>
{% endif %}
</div>
{% endif %} {% endif %}
{% endfor %} {% endfor %}
</section> </section>