From 5e45c12dfa90bf5f3ddd4b6955159df90c9ed18c Mon Sep 17 00:00:00 2001 From: George Katsikas <giorgakis.katsikas@gmail.com> Date: Fri, 23 Feb 2024 16:07:29 +0100 Subject: [PATCH] refactor and reorder select referee table --- .../_hx_select_referee_email_table_row.html | 31 +++++++++ .../_hx_select_referee_table_row.html | 63 ++++--------------- .../templates/submissions/select_referee.html | 10 +-- 3 files changed, 49 insertions(+), 55 deletions(-) create mode 100644 scipost_django/submissions/templates/submissions/_hx_select_referee_email_table_row.html diff --git a/scipost_django/submissions/templates/submissions/_hx_select_referee_email_table_row.html b/scipost_django/submissions/templates/submissions/_hx_select_referee_email_table_row.html new file mode 100644 index 000000000..d34e62245 --- /dev/null +++ b/scipost_django/submissions/templates/submissions/_hx_select_referee_email_table_row.html @@ -0,0 +1,31 @@ +<tr> + <td> + + {% if profile_email.primary %} + <span class="text-primary" title="Primary">{% include "bi/check-circle-fill.html" %}</span> + {% else %} + <span class="text-secondary" title="Alternative">{% include "bi/x-circle-fill.html" %}</span> + {% endif %} + + </td> + <td> + + {% if profile_email.still_valid %} + <span class="text-success" title="Valid">{% include "bi/check-circle-fill.html" %}</span> + {% else %} + <span class="text-danger" title="Deprecated">{% include "bi/x-circle-fill.html" %}</span> + {% endif %} + + </td> + <td> + + {% if profile_email.verified %} + <span class="text-success" title="Verified">{% include "bi/check-circle-fill.html" %}</span> + {% else %} + <span class="text-warning" title="Unverified">{% include "bi/question-circle-fill.html" %}</span> + {% endif %} + + </td> + + <td>{{ profile_email.email }}</td> +</tr> diff --git a/scipost_django/submissions/templates/submissions/_hx_select_referee_table_row.html b/scipost_django/submissions/templates/submissions/_hx_select_referee_table_row.html index 965935838..50012d20f 100644 --- a/scipost_django/submissions/templates/submissions/_hx_select_referee_table_row.html +++ b/scipost_django/submissions/templates/submissions/_hx_select_referee_table_row.html @@ -13,66 +13,29 @@ </td> <td> - <table> - - {% for email in profile.emails.all %} - <tr> - <td> - - {% if email.primary %} - <span class="text-primary" title="Primary">{% include "bi/check-circle-fill.html" %}</span> - {% else %} - <span class="text-secondary" title="Alternative">{% include "bi/x-circle-fill.html" %}</span> - {% endif %} + {% if profile.accepts_refereeing_requests %} + <span class="text-success">{% include "bi/check-circle-fill.html" %}</span> + {% else %} + <span class="text-danger">{% include "bi/x-circle-fill.html" %}</span> + {% endif %} - </td> - <td> + </td> + <td> - {% if email.still_valid %} - <span class="text-success" title="Valid">{% include "bi/check-circle-fill.html" %}</span> - {% else %} - <span class="text-danger" title="Deprecated">{% include "bi/x-circle-fill.html" %}</span> - {% endif %} + <table id="profile-{{ profile.id }}-emails-table"> - </td> + {% for profile_email in profile.emails.all %} + {% include "submissions/_hx_select_referee_email_table_row.html" %} + {% empty %} + <tr> <td> - - {% if email.verified %} - <span class="text-success" title="Verified">{% include "bi/check-circle-fill.html" %}</span> - {% else %} - <span class="text-warning" title="Unverified">{% include "bi/question-circle-fill.html" %}</span> - {% endif %} - + <span class="invisible">{% include "bi/x-circle-fill.html" %}</span> </td> - - <td>{{ email.email }}</td> </tr> - {% empty %} - <td> - <span class="invisible">{% include "bi/x-circle-fill.html" %}</span> - </td> - <td> - <span class="invisible">{% include "bi/x-circle-fill.html" %}</span> - </td> - <td> - <span class="invisible">{% include "bi/x-circle-fill.html" %}</span> - </td> - <td> - <a href="{{ profile.get_absolute_url }}">Add new email address</a> - </td> {% endfor %} </table> - </td> - <td> - - {% if profile.accepts_refereeing_requests %} - <span class="text-success">{% include "bi/check-circle-fill.html" %}</span> - {% else %} - <span class="text-danger">{% include "bi/x-circle-fill.html" %}</span> - {% endif %} - </td> <td> diff --git a/scipost_django/submissions/templates/submissions/select_referee.html b/scipost_django/submissions/templates/submissions/select_referee.html index 63d69c17b..178cd4af6 100644 --- a/scipost_django/submissions/templates/submissions/select_referee.html +++ b/scipost_django/submissions/templates/submissions/select_referee.html @@ -106,18 +106,18 @@ <th> Name <br /> - <small class="text-muted">Click to add emails etc.</small> + <small class="text-muted">Click to visit Profile</small> </th> <th>Registered</th> <th> - Emails + Accepts <br /> - <small class="text-muted">Primary, Valid, Verified, Address</small> + requests? </th> <th> - Accepts + Emails <br /> - requests? + <small class="text-muted">Primary, Valid, Verified, Address</small> </th> <th>Action</th> </tr> -- GitLab