From 36333a5878942917b56d3f2d3d80958f07bba69f Mon Sep 17 00:00:00 2001 From: Yoan Le Clanche Date: Wed, 22 Jan 2020 18:14:47 +0100 Subject: [PATCH] Hide correctors names https://trackers.pilotsystems.net/probarreau/0650 --- teleforma/exam/templates/exam/inc/script_list.html | 4 +++- teleforma/templates/postman/base_write.html | 3 ++- teleforma/templates/postman/view.html | 8 ++++++-- teleforma/templatetags/teleforma_tags.py | 6 ++++++ 4 files changed, 17 insertions(+), 4 deletions(-) diff --git a/teleforma/exam/templates/exam/inc/script_list.html b/teleforma/exam/templates/exam/inc/script_list.html index ee5f474b..96f88ade 100644 --- a/teleforma/exam/templates/exam/inc/script_list.html +++ b/teleforma/exam/templates/exam/inc/script_list.html @@ -31,7 +31,9 @@ {% if script.author.username %}{{ script.author.first_name }}{% endif %} {{ script.date_added }} {% if script.date_marked %}{{ script.date_marked }}{% endif %} - {% if script.corrector %}{{ script.corrector }}{% endif %} + + {% if script.corrector %}{% if profile > 0 %}{{ script.corrector }}{% else %}#{{ script.corrector.id }}{% endif %}{% endif%} + {% if script.score %}{{ script.score|floatformat }}{% endif %} {% endfor %} diff --git a/teleforma/templates/postman/base_write.html b/teleforma/templates/postman/base_write.html index f140e0a5..41395ddd 100644 --- a/teleforma/templates/postman/base_write.html +++ b/teleforma/templates/postman/base_write.html @@ -82,7 +82,7 @@ {% get_all_correctors_with_courses as correctors %} {% for p in correctors %} + data-courses="{{ p.courses }}" {% if request.POST.correctors == p.username %}selected{% endif %}>#{{ p.id }} {% endfor %} @@ -205,6 +205,7 @@ // hide recipients fields {#$('#id_course').parent().parent().hide();#} + $("#id_recipients").parent().parent().hide(); $('[name="recipient_category"]').bind('change', update_desk_messages); $('[name="course"], [name="corrector_course"]').bind('change', update_desk_messages); diff --git a/teleforma/templates/postman/view.html b/teleforma/templates/postman/view.html index 3ce9f077..01dbc47f 100644 --- a/teleforma/templates/postman/view.html +++ b/teleforma/templates/postman/view.html @@ -15,14 +15,18 @@
{% if message.obfuscated_sender %} + {% if not message.obfuscated_sender|startswith:'#' %} + {% endif %} {{ message.obfuscated_sender|or_me:user }} - » + {% if not message.obfuscated_sender|startswith:'#' %}{% endif %}» {% endif %} {% if message.obfuscated_recipient %} + {% if not message.obfuscated_recipient|startswith:'#' %} + {% endif %} {{ message.obfuscated_recipient|or_me:user }} - | + {% if not message.obfuscated_recipient|startswith:'#' %}{% endif %} | {% endif %} {{ message.sent_at|date:"DATETIME_FORMAT"}} | {{ message.subject }} diff --git a/teleforma/templatetags/teleforma_tags.py b/teleforma/templatetags/teleforma_tags.py index 3a7b42ca..a30ce449 100644 --- a/teleforma/templatetags/teleforma_tags.py +++ b/teleforma/templatetags/teleforma_tags.py @@ -70,6 +70,11 @@ def parse_urls(text): output += block return output +@register.filter('startswith') +def startswith(text, starts): + if isinstance(text, basestring): + return text.startswith(starts) + return False @register.tag def value_from_settings(parser, token): @@ -186,6 +191,7 @@ def get_all_correctors_with_courses(): name = corrector.last_name + corrector.first_name if name: result.append({ + 'id': corrector.id, 'username':corrector.username, 'name':corrector.last_name + " " + corrector.first_name, 'courses':json.dumps(list(correctors[corrector])) -- 2.39.5