mail: display info notices in summary (#10455)

This commit is contained in:
Frédéric Péters 2016-03-28 18:24:00 +02:00
parent b71f85c927
commit 043012ac6e
2 changed files with 44 additions and 11 deletions

View File

@ -63,8 +63,14 @@ class Mail(models.Model):
def get_qualification_form_submit_url(cls):
return reverse('qualif-mail-save')
# TODO: get_avis() and get_mandatory_avis() are custom to alfortville,
# they shouldn't appear in this file.
# TODO: get_info_roles(), get_avis() and get_mandatory_avis() are custom to
# alfortville, they shouldn't appear in this file.
def get_info_roles(self):
from welco.contrib.alfortville.models import Inbox
return Inbox.objects.filter(subtype=Inbox.INFO,
source_type=ContentType.objects.get_for_model(Mail),
source_pk=self.id)
def get_avis(self):
from welco.contrib.alfortville.models import Inbox
return Inbox.objects.filter(subtype=Inbox.AVIS,

View File

@ -13,15 +13,6 @@
<p class="postit">
{{object.html_note|safe}}
</p>
<style>
p.postit {
background: rgba(241,231,103,1);
transform: rotate(2deg);
box-shadow: 3px 3px 3px #aaa;
padding: 1ex;
width: 90%;
}
</style>
{% endif %}
{% if object.associations.all|length > 1 %}
@ -57,3 +48,39 @@ p.postit {
</div>
{% endif %}
{% if object.get_mandatory_avis|length %}
<div class="bo-block
{% for avis in object.get_mandatory_avis %}{% if not avis.comments %} important {% endif %}{% endfor %}">
<strong>{% trans "Mandatory Avis" %}</strong>
<ul>
{% for avis in object.get_mandatory_avis %}
<li>{{avis.role_name}}:
{% if avis.comments %}{{ avis.comments }}{% else %}{% trans 'Waiting for avis.' %}{% endif %}</li>
{% endfor %}
</ul>
</div>
{% endif %}
{% if object.get_info_roles|length %}
<div class="bo-block visas">
<strong>{% trans "Visas" %}</strong>
<ul>
{% for info in object.get_info_roles %}
<li>{{info.role_name}} {% if not info.done %}{% trans "(not yet seen)" %}{% endif %}</li>
{% endfor %}
</ul>
</div>
{% endif %}
<style>
p.postit {
background: rgba(241,231,103,1);
transform: rotate(2deg);
box-shadow: 3px 3px 3px #aaa;
padding: 1ex;
width: 90%;
}
div.visas ul {
margin-bottom: 0;
}
</style>