Commit 0ff0ba01 authored by Nicolas Joyard's avatar Nicolas Joyard
Browse files

Add empty messages in lists

parent a73a2348
......@@ -2,61 +2,71 @@
{% load fontawesome %}
{% load memopol_tags %}
<div class="row card-list">
{% for dossier in dossiers %}
<div class="col-xs-12 col-md-4 dossier-card">
<div class="thumbnail">
<a href="{% url 'dossier-detail' dossier.pk %}" class="custom-thumbnail custom-invisible">
<div class="row">
<div class="col-xs-12">
<h4 class="text-center">{{ dossier.title }}</h4>
<div class="lead">
<div class="pull-right">
{% if dossier.nb_proposals > 0 %}
<span class="label label-default" data-toggle="tooltip" data-placement="bottom" title="{% trans 'Proposals' %}">
{% fontawesome_icon "pencil" %}
<span class="badge">{{ dossier.nb_proposals }}</span>
</span>
{% endif %}
{% if dossier.nb_recommendations > 0 %}
<span class="label label-default" data-toggle="tooltip" data-placement="bottom" title="{% trans 'Recommendations' %}">
{% fontawesome_icon "eye" %}
<span class="badge">{{ dossier.nb_recommendations }}</span>
</span>
{% endif %}
{% if dossier.nb_documents > 0 %}
<span class="label label-default" data-toggle="tooltip" data-placement="bottom" title="{% trans 'Documents' %}">
{% fontawesome_icon "file" %}
<span class="badge">{{ dossier.nb_documents }}</span>
</span>
{% endif %}
{% if not dossiers %}
&nbsp;
</div>
<p class="no-links empty text-center">
{% trans "No dossier has been recorded yet." %}
</p>
&nbsp;
{% else %}
{% for chamber in dossier.chambers %}
{{ chamber|chamber_icon }}
{% endfor %}
<div class="row card-list">
{% for dossier in dossiers %}
<div class="col-xs-12 col-md-4 dossier-card">
<div class="thumbnail">
<a href="{% url 'dossier-detail' dossier.pk %}" class="custom-thumbnail custom-invisible">
<div class="row">
</div>
<div class="col-xs-12">
<h4 class="text-center">{{ dossier.title }}</h4>
<div class="lead">
<div class="pull-right">
{% if dossier.nb_proposals > 0 %}
<span class="label label-default" data-toggle="tooltip" data-placement="bottom" title="{% trans 'Proposals' %}">
{% fontawesome_icon "pencil" %}
<span class="badge">{{ dossier.nb_proposals }}</span>
</span>
{% endif %}
{% if dossier.nb_recommendations > 0 %}
<span class="label label-default" data-toggle="tooltip" data-placement="bottom" title="{% trans 'Recommendations' %}">
{% fontawesome_icon "eye" %}
<span class="badge">{{ dossier.nb_recommendations }}</span>
</span>
{% endif %}
{% if dossier.nb_documents > 0 %}
<span class="label label-default" data-toggle="tooltip" data-placement="bottom" title="{% trans 'Documents' %}">
{% fontawesome_icon "file" %}
<span class="badge">{{ dossier.nb_documents }}</span>
</span>
{% endif %}
&nbsp;
</div>
{% if dossier.themes.all|length %}
<p class="text-right">
&nbsp;
{% include "blocks/_themetags.html" with themes=dossier.themes.all %}
&nbsp;
</p>
{% endif %}
{% for chamber in dossier.chambers %}
{{ chamber|chamber_icon }}
{% endfor %}
</div>
{% if dossier.themes.all|length %}
<p class="text-right">
&nbsp;
{% include "blocks/_themetags.html" with themes=dossier.themes.all %}
&nbsp;
</p>
{% endif %}
</div>
</div>
</a>
</div>
</a>
</div>
</div>
{% endfor %}
</div>
\ No newline at end of file
{% endfor %}
</div>
{% endif %}
......@@ -9,84 +9,94 @@
- '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>
{% if not proposals %}
{% for proposal in proposals %}
<tr class="proposal">
{% if show_dossier %}
<td class="lead">
{% for chamber in proposal.dossier.chambers %}
{{ chamber | chamber_icon }}
{% endfor %}
</td>
<p class="no-links empty text-center">
{% trans "No proposal has been recorded yet." %}
</p>
<td>
<a href="{% url 'dossier-detail' proposal.dossier.pk %}">
{{ proposal.dossier.title }}
</a>
</td>
{% 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 %}
{% endif %}
<th>{% trans "Status" %}</th>
<th>{{ "for"|position_icon }}</th>
<th>{{ "against"|position_icon }}</th>
<th>{{ "abstain"|position_icon }}</th>
</tr>
<td>
{{ proposal.title }}
<br>
<small>
{{ proposal.reference }}
</small>
</td>
{% for proposal in proposals %}
<tr class="proposal">
{% if show_dossier %}
<td class="lead">
{% for chamber in proposal.dossier.chambers %}
{{ chamber | chamber_icon }}
{% endfor %}
</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>
<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">
{{ 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 %}
{% else %}
<td class="text-center" colspan="2">
{% if user and user.is_staff %}
{% 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>
{% else %}
{% trans "None" %}
{% endif %}
</td>
</td>
{% endif %}
{% 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>
{% if show_recommendations %}
<td>{{ proposal.status|proposal_status_label:proposal.recommendation }}</td>
{% else %}
<td>{{ proposal.status|proposal_status_label }}</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>
<td>{{ proposal.total_for }}</td>
<td>{{ proposal.total_against }}</td>
<td>{{ proposal.total_abstain }}</td>
</tr>
{% endfor %}
</table>
\ No newline at end of file
{% endif %}
......@@ -5,17 +5,27 @@
{% block theme_content %}
<table class="table table-responsive">
{% for link in links %}
<tr class="link">
<td>
<a class="external" href="{{ link.link }}" target="_blank">
{{ link.title }}
</a>
</td>
<td>{{ link.datetime }}</td>
</tr>
{% endfor %}
</table>
{% if not links %}
<p class="no-links empty text-center">
{% trans "No link has been recorded for this theme yet." %}
</p>
{% else %}
<table class="table table-responsive">
{% for link in links %}
<tr class="link">
<td>
<a class="external" href="{{ link.link }}" target="_blank">
{{ link.title }}
</a>
</td>
<td>{{ link.datetime }}</td>
</tr>
{% endfor %}
</table>
{% endif %}
{% endblock %}
......@@ -6,62 +6,70 @@
{% block representative_content %}
<div class="panel-group" id="accordion-dossier" role="tablist" aria-multiselectable="true">
{% for pk, d in dossiers.items %}
{% with dossier=d.dossier %}
<div class="panel panel-default">
<div class="panel-heading" role="tab" id="dossier-heading-{{ pk }}">
<h4 class="panel-title">
<a role="button" data-toggle="collapse" data-parent="#accordion-dossier" href="#dossier-{{ pk }}" aria-expanded="false" aria-controls="dossier-{{ pk }}">
{{ dossier.title }}
<span class="pull-right">
{% trans "Score for the representative on this specific dossier" as tooltip %}
{{ d.score|score_badge:tooltip }}
</span>
</a>
</h4>
</div>
<div id="dossier-{{ pk }}" class="panel-collapse collapse" role="tabpanel" aria-labelledby="dossier-heading-{{ pk }}">
<div class="panel-body">
{% if not dossiers %}
<p class="no-votes empty text-center">
{% trans "No vote has been recorded for this representative yet." %}
</p>
{% else %}
<div class="panel-group" id="accordion-dossier" role="tablist" aria-multiselectable="true">
<table class="table table-striped table-responsive text-center">
{% for pk, d in dossiers.items %}
{% with dossier=d.dossier %}
<thead>
<tr>
<th class="text-center">{% trans "Proposal" %}</th>
<th class="text-center">{% trans "Recommendation" %}</th>
<th class="text-center">{% trans "Vote" %}</th>
<th class="text-center nowrap">Points&nbsp;<a data-toggle="tooltip" data-placement="top" title="{% trans "Score is negative or positive depending on whether the representative voted as recommended" %}">{% fontawesome_icon "info-circle" %}</a>
</th>
</tr>
</thead>
<div class="panel panel-default">
<div class="panel-heading" role="tab" id="dossier-heading-{{ pk }}">
<h4 class="panel-title">
<a role="button" data-toggle="collapse" data-parent="#accordion-dossier" href="#dossier-{{ pk }}" aria-expanded="false" aria-controls="dossier-{{ pk }}">
{{ dossier.title }}
<span class="pull-right">
{% trans "Score for the representative on this specific dossier" as tooltip %}
{{ d.score|score_badge:tooltip }}
</span>
</a>
</h4>
</div>
<div id="dossier-{{ pk }}" class="panel-collapse collapse" role="tabpanel" aria-labelledby="dossier-heading-{{ pk }}">
<div class="panel-body">
<tbody>
<table class="table table-striped table-responsive text-center">
{% for vote in d.votes %}
<thead>
<tr>
<th>{{ vote.proposal.title }}</th>
<td>{{ vote.proposal.recommendation.recommendation|position_icon }}</td>
<td>{{ vote.position|position_icon:vote.proposal.recommendation.recommendation }}</td>
<td>
{{ vote.score|score_badge:vote.proposal.recommendation.title }}
</td>
<th class="text-center">{% trans "Proposal" %}</th>
<th class="text-center">{% trans "Recommendation" %}</th>
<th class="text-center">{% trans "Vote" %}</th>
<th class="text-center nowrap">Points&nbsp;<a data-toggle="tooltip" data-placement="top" title="{% trans "Score is negative or positive depending on whether the representative voted as recommended" %}">{% fontawesome_icon "info-circle" %}</a>
</th>
</tr>
{% endfor %}
</thead>
</tbody>
<tbody>
</table>
{% for vote in d.votes %}
<tr>
<th>{{ vote.proposal.title }}</th>
<td>{{ vote.proposal.recommendation.recommendation|position_icon }}</td>
<td>{{ vote.position|position_icon:vote.proposal.recommendation.recommendation }}</td>
<td>
{{ vote.score|score_badge:vote.proposal.recommendation.title }}
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
</div>
{% endwith %}
{% endfor %}
{% endwith %}
{% endfor %}
</div>
</div>
{% endif %}
{% endblock %}
......@@ -17,6 +17,7 @@
<dt>{% trans "Themes" %}</dt>
<dd>
{% include "blocks/_themetags.html" with themes=dossier.themes.all %}
{% if not dossier.themes.all|length %}{% trans "None" %}{% endif %}
</dd>
</dl>
</div>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment