From 4b0c924f71b4095d752cb3cff8494839afcbed40 Mon Sep 17 00:00:00 2001 From: "J.-S. Caux" <J.S.Caux@uva.nl> Date: Sat, 17 Nov 2018 20:12:30 +0100 Subject: [PATCH] Improvements --- profiles/admin.py | 2 +- profiles/templates/profiles/profile_list.html | 2 +- profiles/templates/profiles/profile_merge.html | 1 + scipost/forms.py | 4 ++-- scipost/templates/scipost/_public_info_as_table.html | 11 ++++++----- .../inform_contributor_duplicate_accounts_merged.html | 4 ++-- 6 files changed, 13 insertions(+), 11 deletions(-) diff --git a/profiles/admin.py b/profiles/admin.py index 1206b601e..771c7c3b1 100644 --- a/profiles/admin.py +++ b/profiles/admin.py @@ -13,7 +13,7 @@ class ProfileEmailInline(admin.TabularInline): class ProfileAdmin(admin.ModelAdmin): - list_display = ['__str__', 'email', 'discipline', 'expertises'] + list_display = ['__str__', 'email', 'discipline', 'expertises', 'has_active_contributor'] search_fields = ['first_name', 'last_name', 'emails__email', 'orcid_id'] inlines = [ProfileEmailInline] diff --git a/profiles/templates/profiles/profile_list.html b/profiles/templates/profiles/profile_list.html index 16abc13ff..edbcdb0d8 100644 --- a/profiles/templates/profiles/profile_list.html +++ b/profiles/templates/profiles/profile_list.html @@ -121,7 +121,7 @@ $(document).ready(function($) { <div class="single d-inline" data-specialization="{{expertise|lower}}" data-toggle="tooltip" data-placement="bottom" title="{{expertise|get_specialization_display}}">{{expertise|get_specialization_code}}</div> {% endfor %} </td> - <td>{% if profile.contributor %}<i class="fa fa-check-circle text-success"></i>{% else %}<i class="fa fa-times-circle text-danger"></i>{% endif %}</td> + <td>{% if profile.has_active_contributor %}<i class="fa fa-check-circle text-success"></i>{% else %}<i class="fa fa-times-circle text-danger"></i>{% endif %}</td> </tr> {% empty %} <tr> diff --git a/profiles/templates/profiles/profile_merge.html b/profiles/templates/profiles/profile_merge.html index 20dd5aea6..3952b44fd 100644 --- a/profiles/templates/profiles/profile_merge.html +++ b/profiles/templates/profiles/profile_merge.html @@ -42,6 +42,7 @@ {% csrf_token %} {{ merge_form|bootstrap }} <input class="btn btn-primary" type="submit" value="Confirm merge"> + <a class="text-warning" href="{% url 'profiles:merge' %}?to_merge={{ profile_to_merge_into.id }}&to_merge_into={{ profile_to_merge.id }}" method="get">Merge the other way around</a></p> </form> </div> </div> diff --git a/scipost/forms.py b/scipost/forms.py index 7842937a2..e4a3f09c1 100644 --- a/scipost/forms.py +++ b/scipost/forms.py @@ -440,7 +440,7 @@ class ContributorMergeForm(forms.Form): contrib_from = self.cleaned_data['to_merge'] contrib_into = self.cleaned_data['to_merge_into'] - both_contribs_active = contrib_from.is_active and contrib_info.is_active + both_contribs_active = contrib_from.is_active and contrib_into.is_active contrib_from_qs = Contributor.objects.filter(pk=contrib_from.id) contrib_into_qs = Contributor.objects.filter(pk=contrib_into.id) @@ -613,7 +613,7 @@ class ContributorMergeForm(forms.Form): if both_contribs_active: mail_sender = DirectMailUtil( mail_code='contributors/inform_contributor_duplicate_accounts_merged', - contrib_from=contrib_from) + contrib_from=Contributor.objects.get(id=contrib_from.id)) mail_sender.send() return Contributor.objects.get(id=contrib_into.id) diff --git a/scipost/templates/scipost/_public_info_as_table.html b/scipost/templates/scipost/_public_info_as_table.html index 9b2e85237..a3b73a41a 100644 --- a/scipost/templates/scipost/_public_info_as_table.html +++ b/scipost/templates/scipost/_public_info_as_table.html @@ -17,10 +17,11 @@ <tr><td>Personal web page: </td><td>{{ contributor.personalwebpage|default:'-' }}</td></tr> {% if perms.scipost.can_vet_registration_requests %} - <tr><td>Username</td><td>{{ contributor.user.username }}</td></tr> - <tr><td>Email (from User)</td><td>{{ contributor.user.email }}</td></tr> - <tr><td>Status</td><td>{{ contributor.get_status_display }}</td></tr> - <tr><td>User active?</td><td>{{ contributor.user.is_active }}</td></tr> - <tr><td>Id</td><td>{{ contributor.id }}{% if contributor.profile %} <a href="{% url 'profiles:profile_detail' pk=contributor.profile.id %}">View Profile <i class="fa fa-arrow-right"></i></a>{% endif %}</td></tr> + <tr class="text-muted"><td>Username</td><td>{{ contributor.user.username }}</td></tr> + <tr class="text-muted"><td>Email (from User)</td><td>{{ contributor.user.email }}</td></tr> + <tr class="text-muted"><td>Date joined / last login</td><td>{{ contributor.user.date_joined }} / {{ contributor.user.last_login }}</td></tr> + <tr class="text-muted"><td>Status</td><td>{{ contributor.get_status_display }}</td></tr> + <tr class="text-muted"><td>User active?</td><td>{{ contributor.user.is_active }}</td></tr> + <tr class="text-muted"><td>Id</td><td>{{ contributor.id }}{% if contributor.profile %} <a href="{% url 'profiles:profile_detail' pk=contributor.profile.id %}">View Profile <i class="fa fa-arrow-right"></i></a>{% endif %}</td></tr> {% endif %} </table> diff --git a/templates/email/contributors/inform_contributor_duplicate_accounts_merged.html b/templates/email/contributors/inform_contributor_duplicate_accounts_merged.html index fe79c1490..3562b77b7 100644 --- a/templates/email/contributors/inform_contributor_duplicate_accounts_merged.html +++ b/templates/email/contributors/inform_contributor_duplicate_accounts_merged.html @@ -2,10 +2,10 @@ Dear {{ contrib_from.duplicate_of.get_title_display }} {{ contrib_from.duplicate_of.user.last_name }}, </p> <p> - We noticed that you had two separate registrations at SciPost, and have consolidated your two accounts into a single active one, namely your account with username <strong>{{ contrib_from.duplicate_of.user.username }}</strong>. + We noticed that you had two separate registrations at SciPost, and have consolidated your two accounts into a single active one, namely your account with username <strong><em style="color: green;">{{ contrib_from.duplicate_of.user.username }}</em></strong>. </p> <p> - Your alternate account with username <strong>{{ contrib_from.user.username }}</strong> has been deactivated, but all the data associated to it has been transferred to your active account. + Your alternate account with username <strong><em style="color: red;">{{ contrib_from.user.username }}</em></strong> has been deactivated, but all the data associated to it has been transferred to your active account. </p> <p> Please get in touch with us at <a href="mailto:techsupport@scipost.org">SciPost techsupport</a> if you have any questions. -- GitLab