_proposal_list.html 3.19 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
{% 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 %}

Nicolas Joyard's avatar
Nicolas Joyard committed
12
{% if not proposals %}
Nicolas Joyard's avatar
Nicolas Joyard committed
13

Nicolas Joyard's avatar
Nicolas Joyard committed
14
15
16
  <p class="no-links empty text-center">
    {% trans "No proposal has been recorded yet." %}
  </p>
Nicolas Joyard's avatar
Nicolas Joyard committed
17

Nicolas Joyard's avatar
Nicolas Joyard committed
18
19
20
21
22
23
24
25
26
27
28
29
30
{% else %}

  <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 %}
Nicolas Joyard's avatar
Nicolas Joyard committed
31
      {% endif %}
Nicolas Joyard's avatar
Nicolas Joyard committed
32
33
34
35
36
      <th>{% trans "Status" %}</th>
      <th>{{ "for"|position_icon }}</th>
      <th>{{ "against"|position_icon }}</th>
      <th>{{ "abstain"|position_icon }}</th>
    </tr>
Nicolas Joyard's avatar
Nicolas Joyard committed
37

Nicolas Joyard's avatar
Nicolas Joyard committed
38
39
40
41
42
43
44
45
    {% for proposal in proposals %}
      <tr class="proposal">
        {% if show_dossier %}
          <td class="lead">
            {% for chamber in proposal.dossier.chambers %}
              {{ chamber | chamber_icon }}
            {% endfor %}
          </td>
Nicolas Joyard's avatar
Nicolas Joyard committed
46

Nicolas Joyard's avatar
Nicolas Joyard committed
47
48
49
50
          <td>
            <a href="{% url 'dossier-detail' proposal.dossier.pk %}">
              {{ proposal.dossier.title }}
            </a>
Nicolas Joyard's avatar
Nicolas Joyard committed
51
          </td>
Nicolas Joyard's avatar
Nicolas Joyard committed
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
        {% 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">
              {{ proposal.recommendation.weight }}&nbsp;<a data-toggle="tooltip" data-placement="top" title="{{ proposal.recommendation.title }}">{% fontawesome_icon "info-circle" %}</a>
            </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 %}
Nicolas Joyard's avatar
Nicolas Joyard committed
79
        {% else %}
Nicolas Joyard's avatar
Nicolas Joyard committed
80
81
          {% if user and user.is_staff %}
            <td>
Nicolas Joyard's avatar
Nicolas Joyard committed
82
83
84
              <a class="btn btn-default btn-sm" href="{% url 'admin:representatives_recommendations_recommendation_add' %}?proposal={{ proposal.pk }}">
                {% trans "Add recommendation" %}
              </a>
Nicolas Joyard's avatar
Nicolas Joyard committed
85
86
            </td>
          {% endif %}
Nicolas Joyard's avatar
Nicolas Joyard committed
87
        {% endif %}
Nicolas Joyard's avatar
Nicolas Joyard committed
88
89
90
91
92

        {% if show_recommendations %}
          <td>{{ proposal.status|proposal_status_label:proposal.recommendation }}</td>
        {% else %}
          <td>{{ proposal.status|proposal_status_label }}</td>
Nicolas Joyard's avatar
Nicolas Joyard committed
93
94
        {% endif %}

Nicolas Joyard's avatar
Nicolas Joyard committed
95
96
97
98
99
100
        <td>{{ proposal.total_for }}</td>
        <td>{{ proposal.total_against }}</td>
        <td>{{ proposal.total_abstain }}</td>
      </tr>
    {% endfor %}
  </table>
Nicolas Joyard's avatar
Nicolas Joyard committed
101

Nicolas Joyard's avatar
Nicolas Joyard committed
102
{% endif %}