_proposal_list.html 2.89 KB
Newer Older
Nicolas Joyard's avatar
Nicolas Joyard committed
1
{% load i18n %}
2
{% load fontawesome %}
Nicolas Joyard's avatar
Nicolas Joyard committed
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
{% load memopol_tags %}

{% comment %}
  Expected variables
  - 'proposals': proposal list
  - 'show_recommendations': display recommendations in the list
  - 'show_dossier': include a "dossier" column in the list
{% endcomment %}

<table class="table table-responsive table-striped">
  <tr>
    {% if show_dossier %}
      <th>{% trans "Chambers" %}</th>
      <th>{% trans "Dossier" %}</th>
    {% endif %}
    <th>{% trans "Proposal" %}</th>
    {% if show_recommendations %}
      <th colspan="2">{% trans "Recommendation" %}</th>
    {% else %}
      {% if user and user.is_staff %}<th></th>{% endif %}
    {% endif %}
    <th>{% trans "Status" %}</th>
    <th>{{ "for"|position_icon }}</th>
    <th>{{ "against"|position_icon }}</th>
    <th>{{ "abstain"|position_icon }}</th>
  </tr>

  {% for proposal in proposals %}
    <tr class="proposal">
      {% if show_dossier %}
Nicolas Joyard's avatar
Nicolas Joyard committed
33
        <td class="lead">
Nicolas Joyard's avatar
Nicolas Joyard committed
34
          {% for chamber in proposal.dossier.chambers %}
Nicolas Joyard's avatar
Nicolas Joyard committed
35
            {{ chamber | chamber_icon }}
Nicolas Joyard's avatar
Nicolas Joyard committed
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
          {% endfor %}
        </td>

        <td>
          <a href="{% url 'dossier-detail' proposal.dossier.pk %}">
            {{ proposal.dossier.title }}
          </a>
        </td>
      {% endif %}

      <td>
        {{ proposal.title }}
        <br>
        <small>
          {{ proposal.reference }}
        </small>
      </td>

      {% if show_recommendations %}
        {% if proposal.recommendation %}
          <td class="text-center">{{ proposal.recommendation.recommendation|position_icon }}</td>
          <td class="text-center">
58
            {{ proposal.recommendation.weight }}&nbsp;<a data-toggle="tooltip" data-placement="top" title="{{ proposal.recommendation.title }}">{% fontawesome_icon "info-circle" %}</a>
Nicolas Joyard's avatar
Nicolas Joyard committed
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
          </td>
        {% else %}
          <td class="text-center" colspan="2">
            {% if user and user.is_staff %}
              <a class="btn btn-default btn-sm" href="{% url 'admin:representatives_recommendations_recommendation_add' %}?proposal={{ proposal.pk }}">
                {% trans "Add recommendation" %}
              </a>
            {% else %}
              {% trans "None" %}
            {% endif %}
          </td>
        {% endif %}
      {% else %}
        {% if user and user.is_staff %}
          <td>
            <a class="btn btn-default btn-sm" href="{% url 'admin:representatives_recommendations_recommendation_add' %}?proposal={{ proposal.pk }}">
              {% trans "Add recommendation" %}
            </a>
          </td>
        {% endif %}
      {% endif %}

      {% if show_recommendations %}
        <td>{{ proposal.status|proposal_status_label:proposal.recommendation }}</td>
      {% else %}
        <td>{{ proposal.status|proposal_status_label }}</td>
      {% endif %}

      <td>{{ proposal.total_for }}</td>
      <td>{{ proposal.total_against }}</td>
      <td>{{ proposal.total_abstain }}</td>
    </tr>
  {% endfor %}
</table>