{% macro btnContinue(includeDiv=true) -%} {% if includeDiv %} {% endif %} {%- endmacro %} {% macro conditionLabel(condition) -%} {%- if config['CONDITIONS'] and condition and condition > 0 and condition <= (config['CONDITIONS']|length) -%} {{ config['CONDITIONS'][condition - 1]['label'] }} {%- elif condition -%} {{ condition }} {%- endif -%} {%- endmacro %} {% macro adminControls() -%} {% if (session.get('loggedIn', False) or debug) and request.blueprint != 'admin' %} {%- set current_path = request.path.lstrip('/') -%} {%- set ns = namespace(current_idx=0) -%} {%- for page in flat_page_list -%} {%- if page['path'] == current_path -%}{% set ns.current_idx = loop.index %}{%- endif -%} {%- endfor -%} {%- set total_pages = flat_page_list|length -%} {%- set pid = session.get('participantID') -%} {%- set condition = session.get('condition') -%} {%- set condition_label = conditionLabel(condition)|trim -%}
{% if pid %} PID {{ pid }} {% else %} PID none yet {% endif %} {% if condition_label %} Condition: {{ condition_label }} {% endif %} {% if ns.current_idx %} {%- set current_page_name = flat_page_list[ns.current_idx - 1].get('name') or flat_page_list[ns.current_idx - 1]['path'] -%} Page {{ ns.current_idx }} of {{ total_pages }} — “{{ current_page_name }}” {% else %} Page — of {{ total_pages }} {% endif %} {% if not pid %} No participant session yet — page navigation is disabled until consent is submitted (or /create_participant is visited). {% endif %}
{%- set nav_disabled_reason = "Navigation requires an active participant session. Submit consent (or visit /create_participant) to begin." -%}
{% if pid %} {% else %} {% endif %}
{% if pid %} {% endif %}
Restart {% if pid and config.get('USE_ADMIN', True) %} My Data {% endif %} Admin Panel
{% if pid %} {% else %} {% endif %}
{% endif %} {%- endmacro %} {% macro checkUserActive() %} {%- endmacro %}