Skip to content
Snippets Groups Projects
organization_long.html 3.89 KiB
{%- comment -%}
    Inserts a full data set of an campus of an organization.
    The data will be formatted as postal address, followed by an external link
    to the organizations website.
    On error, a placeholder will be inserted to prevent messing up the
    formatting of pages that expect a block at this position.

    The parameter "campus" is expected to be a key into
    _data/helmholtz-centers.yml

    ! See also the documentation there for field-specific behaviour. !

    If the key is not valid, an informative HTML comment will be inserted.
    If available, the parameter "room" will be inserted verbatim at the
    appropriate position.
{%- endcomment -%}


{%- if include.location -%}

{%- assign campus-id = include.location.campus -%}
{%- assign room = include.location.room -%}

    {%- if campus-id -%}
        {%- assign organization-code = campus-id | split: "-" | first -%}
        {%- assign organization =  site.data.helmholtz-centers[organization-code] -%}
        {%- assign location = organization.campii[campus-id] -%}

        {%- if organization and location -%}
            <div class="org-long">
                <address>
                    <span class="org-name">{{ organization.name }}</span>
                    <span class="org-name">Campus
                    {%- if location.name -%}
                        {{ location.name }}
                    {%- else -%}
                        {{ location.city }}
                    {%- endif -%}
                    </span>

                    {%- if room -%}
                        <span> {{ room }} </span>
                    {%- endif -%}

                    <span> {{ location.street }} </span>
                    <span> {{ location.zip-code }} {{ location.city }} </span>
                    <span>
                    {%- if location.country -%}
                        {{ location.country }}
                    {%- else -%}
                        Germany
                    {%- endif -%}
                    </span>
                </address>

                <div>
                    {%- if location.website -%}
                        {%- assign website = location.website -%}
                    {%- else -%}
                        {%- if organization.website -%}
                            {%- assign website = organization.website -%}
                        {%- endif -%}
                    {%- endif -%}

                    {%- if website -%}
                    <a href="https://{{ website }}">
                        <i class="fas fa-external-link-alt"></i>
                        {{ website | split: "/" | first }}
                    </a>
                    {%- endif -%}

                    {%- comment -%}
                        Space for map button here
                    {%- endcomment -%}
                </div>
            </div>
        {%- else -%}
            <!--
                NOTE: team_card/organization_long.html was included,
                but parameter "location.campus" could not be matched
                with a known campus.
                "location.campus" was inserted verbatim.
            -->
            <div class="org-long">
                <address>
                    <span class="org-name">{{ campus-id }}</span>
                    {%- if room -%}
                        <span> {{ room }} </span>
                    {%- endif -%}
                </address>
            </div>
        {%- endif -%}
    {%- else -%}
        <!--
            NOTE: team_card/organization_long.html was included,
            but parameter "location.campus" was not valid.
            "location" was inserted verbatim.
        -->
        <div class="org-long-placeholder">
            {{ include.location }}
        </div>
    {%- endif -%}
{%- else -%}
    <!--
        NOTE: team_card/organization_long.html was included,
        but parameter "location" was not defined.
    -->
    <div class="org-long-placeholder"></div>
{%- endif -%}