Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DWPF-740 Profile page tweaks #438

Merged
merged 9 commits into from
Sep 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions assets/stylesheets/components/_peoplefinder.scss
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,10 @@
}
}

.pf-secondary-colour {
color: $govuk-secondary-text-colour;
}

.profile-photo {
--bubble-color: rgba(var(--color-1), var(--color-2), var(--color-3), 0.1);

Expand Down
35 changes: 7 additions & 28 deletions src/peoplefinder/templates/peoplefinder/profile.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
{% endblock location %}

{% block content %}
<div class="govuk-grid-row">
<div class="govuk-grid-row govuk-!-margin-bottom-6">
<div class="govuk-grid-column-one-third">
{% if profile.photo %}
{% if is_ee %}
Expand All @@ -28,13 +28,15 @@
<div class="govuk-grid-column-two-thirds">
<h1 class="govuk-heading-l mb-0" data-testid="full-name">{{ profile.full_name }}</h1>
{% if profile.name_pronunciation or profile.pronouns %}
<p class="govuk-body-s">
<p class="govuk-body-m pf-secondary-colour">
{% if profile.name_pronunciation %}{{ profile.name_pronunciation }}{% endif %}
{% if profile.pronouns %}
{% if profile.name_pronunciation %}<br>{% endif %}
({{ profile.pronouns }})
{% endif %}
</p>
{% else %}
<div class="govuk-!-padding-bottom-4"></div>
{% endif %}
{% if not profile.is_active %}
<div class="govuk-warning-text">
Expand All @@ -46,21 +48,11 @@ <h1 class="govuk-heading-l mb-0" data-testid="full-name">{{ profile.full_name }}
</div>
{% endif %}

{% if profile.profile_completion < 100 %}
<div class="govuk-warning-text">
<span class="govuk-warning-text__icon" aria-hidden="true">!</span>
<strong class="govuk-warning-text__text">
<span class="govuk-warning-text__assistive">Warning</span>
Your profile is only {{ profile.profile_completion|floatformat:0 }}% complete.
</strong>
</div>
{% endif %}

{% for role in roles %}
{% include "peoplefinder/components/profile-role.html" with role=role %}
{% endfor %}

<dl class="ws-profile__primary-contact-list govuk-body-l">
<dl class="ws-profile__primary-contact-list govuk-body-m">
<dt class="govuk-visually-hidden">Preferred email</dt>
{% if profile.contact_email %}
<dd>
Expand Down Expand Up @@ -125,20 +117,7 @@ <h1 class="govuk-heading-l mb-0" data-testid="full-name">{{ profile.full_name }}
</strong>
</div>
{% else %}
<p class="govuk-body-s">Last edited {{ profile.edited_or_confirmed_at|naturalday:"j F Y" }}</p>
{% endif %}


{% if profile.is_active %}
{% if request.user == profile.user %}
<p class="govuk-body-s">
Let us know if you are <a href="{% url 'profile-leaving-dit' profile.slug %}">leaving DBT</a>.
</p>
{% else %}
<p class="govuk-body-s">
Let us know if {{ profile.full_name }} has <a href="{% url 'profile-leaving-dit' profile.slug %}">left DBT</a>.
</p>
{% endif %}
<p class="govuk-body-s pf-secondary-colour">Last edited {{ profile.edited_or_confirmed_at|naturalday:"j F Y" }}</p>
{% endif %}
</div>
</div>
Expand All @@ -147,7 +126,7 @@ <h1 class="govuk-heading-l mb-0" data-testid="full-name">{{ profile.full_name }}
{% if is_users_profile or profile_section.values %}
<div class="govuk-summary-card">
<div class="govuk-summary-card__title-wrapper">
<h2 class="govuk-summary-card__title">{{ profile_section.title }}</h2>
<h2 class="govuk-summary-card__title govuk-!-font-size-24">{{ profile_section.title }}</h2>
<ul class="govuk-summary-card__actions">
<li class="govuk-summary-card__action">
<a class="govuk-link" href="{{ profile_section.url }}">
Expand Down
7 changes: 0 additions & 7 deletions src/peoplefinder/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
ProfileDeleteView,
ProfileDetailView,
ProfileEditView,
ProfileLeavingDitView,
ProfileLegacyView,
ProfileUpdateUserView,
get_profile_by_staff_sso_id,
Expand Down Expand Up @@ -101,12 +100,6 @@
ProfileEditView.as_view(),
name="profile-edit-section",
),
# Leaving DIT
path(
"<uuid:profile_slug>/leaving-dbt",
ProfileLeavingDitView.as_view(),
name="profile-leaving-dit",
),
path(
"<uuid:profile_slug>/delete/",
ProfileDeleteView.as_view(),
Expand Down
39 changes: 2 additions & 37 deletions src/peoplefinder/views/profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@
from django.utils.decorators import method_decorator
from django.views.generic import TemplateView
from django.views.generic.detail import DetailView, SingleObjectMixin
from django.views.generic.edit import FormView, UpdateView
from django.views.generic.edit import UpdateView

from peoplefinder.forms.crispy_helper import RoleFormsetFormHelper
from peoplefinder.forms.profile import ProfileLeavingDitForm, ProfileUpdateUserForm
from peoplefinder.forms.profile import ProfileUpdateUserForm
from peoplefinder.forms.profile_edit import (
AdminProfileEditForm,
ContactProfileEditForm,
Expand Down Expand Up @@ -377,41 +377,6 @@ def get_field_locations(self):
return field_locations


class ProfileLeavingDitView(SuccessMessageMixin, ProfileView, FormView):
template_name = "peoplefinder/profile-leaving-dit.html"
form_class = ProfileLeavingDitForm

def setup(self, request, *args, **kwargs):
super().setup(request, *args, **kwargs)

self.profile = Person.active.get(slug=self.kwargs["profile_slug"])

def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)

context["profile"] = self.profile

return context

def form_valid(self, form):
person_service = PersonService()

person_service.left_dit(
request=self.request,
person=self.profile,
reported_by=self.request.user.profile,
comment=form.cleaned_data.get("comment"),
)

return super().form_valid(form)

def get_success_url(self):
return reverse("profile-view", kwargs={"profile_slug": self.profile.slug})

def get_success_message(self, cleaned_data):
return f"A deletion request for {self.profile} has been sent to support"


@method_decorator(transaction.atomic, name="post")
class ProfileDeleteView(SingleObjectMixin, ProfileView):
model = Person
Expand Down