]> git.parisson.com Git - teleforma.git/commitdiff
Hide correctors names https://trackers.pilotsystems.net/probarreau/0650
authorYoan Le Clanche <yoanl@pilotsystems.net>
Wed, 22 Jan 2020 17:14:47 +0000 (18:14 +0100)
committerYoan Le Clanche <yoanl@pilotsystems.net>
Wed, 22 Jan 2020 17:14:47 +0000 (18:14 +0100)
teleforma/exam/templates/exam/inc/script_list.html
teleforma/templates/postman/base_write.html
teleforma/templates/postman/view.html
teleforma/templatetags/teleforma_tags.py

index ee5f474b6529609cbb6a1c2955a9c2fbfde9831e..96f88adec05d12a3fb4178559f3721a95950764d 100644 (file)
@@ -31,7 +31,9 @@
      <td>{% if script.author.username %}<a href="{% url teleforma-profile-detail script.author.username %}">{{ script.author.first_name }}</a>{% endif %}</td>
      <td>{{ script.date_added }}</td>
      <td>{% if script.date_marked %}{{ script.date_marked }}{% endif %}</td>
-     <td>{% if script.corrector %}{{ script.corrector }}{% endif %}</td>
+     <td>
+       {% if script.corrector %}{% if profile > 0 %}{{ script.corrector }}{% else %}#{{ script.corrector.id }}{% endif %}{% endif%}
+     </td>
      <td>{% if script.score %}{{ script.score|floatformat }}{% endif %}</td>
     </tr>
     {% endfor %}
index f140e0a553b9de13bf879ebc72451243c0a44256..41395ddde1f2566a68798c77a5f89438fc8d8fc9 100644 (file)
@@ -82,7 +82,7 @@
                         {% get_all_correctors_with_courses as correctors %}
                         {% for p in correctors %}
                             <option value="{{ p.username }}"
-                                    data-courses="{{ p.courses }}" {% if request.POST.correctors == p.username %}selected{% endif %}>{{ p.name }}</option>
+                                    data-courses="{{ p.courses }}" {% if request.POST.correctors == p.username %}selected{% endif %}>#{{ p.id }}</option>
                         {% endfor %}
                     </select>
                 </div>
         // 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);
index 3ce9f077a06b9db555533acd1c48f4f2053aae93..01dbc47fa907f01f504e0c54883a5518ed1caba8 100644 (file)
 <div class="pm_message{% if message.is_pending %} pm_pending{% endif %}{% if message.is_rejected %} pm_rejected{% endif %}{% if message.sender == user and message.sender_archived or message.recipient == user and message.recipient_archived %} pm_archived{% endif %}{% if message.sender == user and message.sender_deleted_at or message.recipient == user and message.recipient_deleted_at %} pm_deleted{% endif %}{% if message.recipient == user and not message.read_at %} pm_unread{% endif %}">
  <div class="pm_header">
   {% if message.obfuscated_sender %}
+    {% if not message.obfuscated_sender|startswith:'#' %}
          <a href="{% url telemeta-profile-detail message.obfuscated_sender %}" title="{% get_training_profile message.sender %}">
+    {% endif %}
          <span class="pm_sender">{{ message.obfuscated_sender|or_me:user }}</span>
-         </a>&raquo;
+         {% if not message.obfuscated_sender|startswith:'#' %}</a>{% endif %}&raquo;
   {% endif %}
   {% if message.obfuscated_recipient %}
+    {% if not message.obfuscated_recipient|startswith:'#' %}
          <a href="{% url telemeta-profile-detail message.obfuscated_recipient %}" title="{% get_training_profile message.recipient %}">
+    {% endif %}
          <span class="pm_recipient">{{ message.obfuscated_recipient|or_me:user }}</span>
-         </a> |
+         {% if not message.obfuscated_recipient|startswith:'#' %}</a>{% endif %} |
   {% endif %}
   <span class="pm_date">{{ message.sent_at|date:"DATETIME_FORMAT"}}</span> |
   <span class="pm_subject">{{ message.subject }}</span>
index 3a7b42cae3ec5af66a9855640dd09a80924796f0..a30ce449c89bcf025eebe6ed56d33316cca56e68 100644 (file)
@@ -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]))