{# staff profile sections and rows #} {# macros #} {# render a section #} {% macro renderSection(content, sectionName, readMore = false, headingType = 'h2') %} {% set section = attribute(content, sectionName) %} {% do setRendered(section) %} {{ block("section") }} {% endmacro %} {# render summary #} {% macro renderSummary(summary) %}

{{ summary }}

{% endmacro %} {# render sidebox #} {% macro renderSidebox(content, sectionName, staffName, readMore = false) %} {% set section = attribute(content, sectionName) %} {% do setRendered(section) %} {{ block("sidebox") }} {% endmacro %} {# render an inline accordion #} {% macro renderAccordion(content, sectionName, readMore = false) %} {% set section = attribute(content, sectionName) %} {% do setRendered(section) %} {{ block("accordion") }} {% endmacro %} {# render all sections not yet rendered #} {% macro renderRemainingSections(content) %} {% import _self as layout %} {% for section in content|to_array %} {# don't render intro sections too early #} {% if not section.rendered and not (section.sectionName ends with '_intro') %} {# remainder of sections should have readMore links #} {{ layout.renderSection(content, section.sectionName, true) }} {% endif %} {% endfor %} {% endmacro %} {# end of macros #} {# general section, not in sidebox or accordion #} {% block section %} {% if section.rows is defined and section.rows|length > 0 %} {# if there is only one row, readMore should always be false #} {% set readMore = (readMore is defined and section.rows|length > 1) ? readMore : false %}
{% if section.title %} <{{ headingType }}>{{ section.title }} {% endif %} {{ block("rows") }}
{% endif %} {% endblock section %} {# sidebox section #} {% block sidebox %} {% if section.rows is defined and section.rows|length > 0 %}

{{ section.title ?: section.sectionName|capitalize }}

{{ block("rows") }}
{% endif %} {% endblock sidebox %} {# accordion section #} {% block accordion %}

{{ (section.title ?: section.sectionName)|replace({'Teaching and Supervision': 'Teaching and supervision'}) }}

{{ block("rows") }}
{% endblock accordion %} {# rows within a section #} {% block rows %} {# look for an intro section #} {% set introSection = attribute(content, section.sectionName ~ '_intro') %} {% if introSection %} {# Render intro #} {% import _self as layout %} {{ layout.renderSection(content, introSection.sectionName) }} {% endif %} {% if block(section.sectionName) is defined %} {{ block(section.sectionName) }} {% elseif block(section.rowType) is defined %} {{ block(section.rowType) }} {% endif %} {% endblock rows %} {# html attributes for row container blocks #} {% block section_attributes %} {% set attr = readMore ? (attr ?: [])|merge({'class' : "read-more", 'data-initial-show' : "3"}) : attr %} {% for attrName,attrValue in attr %} {{ attrName }}="{{ attrValue }}" {% endfor %} {% endblock section_attributes %} {# html_block #} {% block html_block %} {# only allow the following tags, and remove any javascript href values #} {{ (row.text|striptags('