job-location.njk 1.39 KB
Newer Older
Ken Hawkins's avatar
Ken Hawkins committed
1 2
{# Position location #}
{% set locations = {
3 4 5 6 7 8 9
    'barcelona': 'Barcelona',
    'grenoble': 'Grenoble',
    'hamburg': 'Hamburg',
    'heidelberg': 'Heidelberg',
    'EMBO': 'EMBO, Heidelberg',
    'hinxton': 'EMBL-EBI Hinxton',
    'rome': 'Rome'
Ken Hawkins's avatar
Ken Hawkins committed
10
} %}
11
<fieldset class="vf-form__fieldset | vf-stack vf-stack--400">
Ken Hawkins's avatar
Ken Hawkins committed
12
  <legend class="vf-form__legend">Position location</legend>
Ken Hawkins's avatar
Ken Hawkins committed
13
  {% spaceless %}
Ken Hawkins's avatar
Ken Hawkins committed
14 15 16 17
  {% for key, name in locations | dictsort %}
    {# count number of open positions #}
    {% set counter = 0 %}
    {%- for job in emblJobs %}
Ken Hawkins's avatar
Ken Hawkins committed
18 19 20 21
      {% if key == 'EMBO' and job.field_jobs_group == 'EMBO' %}
        {# EMBO is a special case as the duty station is Heidelberg #}
        {% set counter = counter + 1 %}
      {% elseif key | makeLowercase in job.field_jobs_duty_station | makeLowercase %}
Ken Hawkins's avatar
Ken Hawkins committed
22 23 24 25 26 27 28 29 30 31 32 33 34
        {% set counter = counter + 1 %}
      {% endif -%}
    {% endfor -%}

    <div class="vf-form__item vf-form__item--checkbox">
      <input type="checkbox" id="checkbox-{{ loop.index }}" class="vf-form__checkbox"
              data-jplist-control="checkbox-text-filter" data-path=".jplist-duty-station" data-group="data-group-1" data-name="location2" data-or="locations"
              data-id="location-{{ key }}"
              value="{{ key }}"
      >
      <label for="checkbox-{{ loop.index }}" class="vf-form__label">{{ name }} ({{ counter }})</label>
    </div>
  {% endfor %}
Ken Hawkins's avatar
Ken Hawkins committed
35
  {% endspaceless %}
Ken Hawkins's avatar
Ken Hawkins committed
36
</fieldset>