{% extends "layout.html" %} {% block title %}{{ g.title }}{% endblock %} {% block subtitle %}{{ g.subtitle }}{% endblock %} {# Hides the view options when showing 1 job so users don't click on 'list' view. #} {% block view_options %} {{ super() }} {% endblock view_options %} {% set context = "JobContext" %} {% set num_enabled_modules = enabled_module_indices[context] | length %} {% set columns_per_card = (12 / CARDS_PER_ROW) | int %} {# Macro to render cards in vertical columns (masonry layout) #} {% macro render_cards(card_list) %} {% if card_list | length > 0 %}
{% for col_index in range(CARDS_PER_ROW) %}
{% for item in card_list %} {% if loop.index0 % CARDS_PER_ROW == col_index %} {% set card = item.card %} {% set job_details = item.job_details %}
{% if num_enabled_modules <= 1 and g.jobs | length > 1 %}
{{ job_details.title }}
{{ job_details.job | string }}
{% endif %} {{ card.name }}
{{ card.content | safe }}
{% endif %} {% endfor %}
{% endfor %}
{% endif %} {% endmacro %} {% block panels %} {# Global collection for single-module view #} {% set global_cards = [] %} {% for job_details in g.jobs %} {# Collect cards for the current job #} {% set job_cards = [] %} {% for module in modules_by_context[context] %} {% if loop.index0 in enabled_module_indices[context] %} {% for card in module.get_cards(job_details.job) %} {% if job_cards.append({'card': card, 'job_details': job_details}) %}{% endif %} {% endfor %} {% endif %} {% endfor %} {% if num_enabled_modules > 1 %}
{% if ( num_enabled_modules > 1 and g.jobs | length > 1 ) or ( g.jobs | length == 1 and query is defined ) %}

{{ job_details.title }}

{{ job_details.job | string }}
{% endif %} {% if job_cards | length > 0 %} {{ render_cards(job_cards) }} {% else %}
No cards to show.
{% endif %}
{% if not loop.last %}
{% endif %} {% else %} {% for item in job_cards %}{% if global_cards.append(item) %}{% endif %}{% endfor %} {% endif %} {% endfor %} {% if num_enabled_modules <= 1 %}
{{ render_cards(global_cards) }}
{% endif %} {% endblock %}