_position_list.html 5.03 KB
Newer Older
1
{% load i18n %}
2
{% load fontawesome %}
3
{% load humanize %}
4
{% load memopol_tags %}
5 6 7 8 9
{% load representatives_positions_tags %}

{% comment %}
  Expected variables
  - 'positions': positions list
10
  - 'show_representatives': show representatives
11 12 13
{% endcomment %}

{% if not positions %}
14
  <p class="no-positions empty text-center">
15 16 17
    {% trans "No public position has been recorded yet." %}
    <br><br>
    <a class="btn btn-primary hidden-print" data-toggle="modal" data-target="#add-position-form" aria-expanded="false" aria-controls="add-position-form">
18
      {% fontawesome_icon "bullhorn" %}
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
      {% trans "Add a public position" %}
    </a>
  </p>
{% else %}

  <table class="table table-responsive custom-timeline text-center">
    <thead>
      <tr>
        <th class="text-center">{% trans "Before" %}</th>
        <th class="text-center">{% trans "Last year" %}</th>
        <th class="text-center">{% trans "Last 6 months" %}</th>
        <th class="text-center">{% trans "This month" %}</th>
      </tr>
    </thead>

    <tbody>
      <tr>
36
        {% trans "Untitled" as untitled %}
37 38 39 40
        {% for timeframe in positions|regroup_by_age %}
          <td>
            {% for position in timeframe %}
              <button class="btn btn-default position-button" id="position-button-{{ position.pk }}" type="button" data-toggle="modal" data-target="#position-modal-{{ position.pk }}" aria-expanded="false" aria-controls="position-modal-{{ position.pk }}">
41 42 43 44 45 46
                {% if show_representatives %}
                  <h5>{{ position.representative }}</h5>
                {% endif %}

                <div class="text-center">{{ position.datetime|naturalday }}</div>
                {% include "blocks/_themetags.html" with themes=position.themes.all exclude=theme.pk %}
47

48
                {{ position.position_score.score|score_badge }}
49 50 51 52 53 54 55
              </button>

              <div class="modal fade" id="position-modal-{{ position.pk }}" tabindex="-1" role="dialog" aria-labelledby="position-button-{{ position.pk }}">
                <div class="modal-dialog modal-lg position-details" role="document">
                  <div class="modal-content">
                    <div class="modal-header">
                      <button type="button" class="close" data-dismiss="modal" aria-label="{% trans 'Close' %}"><span aria-hidden="true">&times;</span></button>
56 57 58 59 60 61
                      {% if position.title %}
                        <h4>
                          <div class="col-sm-12">{{ position.title|default:untitled }}</div>
                        </h4>
                      {% endif %}
                      <{% if position.title %}h5{% else %}h4{% endif %} class="modal-title">
62 63 64 65 66 67 68
                        {% if show_representative %}
                          {% trans "Public position" %}
                        {% else %}
                          {% blocktrans with rep=position.representative %}
                            Public position by {{ rep }}
                          {% endblocktrans %}
                        {% endif %}
69
                      </{% if position.title %}h5{% else %}h4{% endif %}>
70 71 72
                    </div>

                    <div class="modal-body">
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92
                      <div class="row">
                        <dl class="dl-horizontal col-sm-6 text-left">
                          <dt>{% trans "Date" %}</dt>
                          <dd>
                            {{ position.datetime|naturalday }}
                          </dd>

                          <dt>{% trans "Kind" %}</dt>
                          <dd>
                            {{ position.kind }}
                          </dd>
                        </dl>
                        <dl class="dl-horizontal col-sm-6 text-left">
                          <dt>{% trans "Themes" %}</dt>
                          <dd>
                            {% include "blocks/_themetags.html" with themes=position.themes.all %}
                          </dd>

                          <dt>{% trans "Score" %}</dt>
                          <dd>
93
                            {{ position.position_score.score|score_badge }}
94 95 96
                          </dd>
                        </dl>
                      </div>
97 98
                      <div class="row">
                        <div class="col-sm-12 text-justify">
99
                          <blockquote class="position-text">
100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122
                            <p>{{ position.text }}</p>
                          </blockquote>
                        </div>
                      </div>
                    </div>
                    <div class="modal-footer">
                      {% if position.link %}
                        <a class="btn btn-primary" href="{{ position.link }}" target="_blank">Check the source &raquo;</a>
                      {% endif %}

                      <button type="button" class="btn btn-default" data-dismiss="modal">{% trans "Close" %}</button>
                    </div>
                  </div>
                </div>
              </div>
            {% endfor %}
          </td>
        {% endfor %}
      </tr>
    </tbody>
  </table>

{% endif %}