Skip to content

Commit

Permalink
Hide profile overlay for now
Browse files Browse the repository at this point in the history
  • Loading branch information
KevinEtchells committed Sep 18, 2024
1 parent 545263d commit 125cfdf
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 16 deletions.
2 changes: 1 addition & 1 deletion django_app/redbox_app/redbox_core/views/auth_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def sign_in_view(request: HttpRequest):

try:
user = models.User.objects.get(email=email)
link = MagicLink.objects.create(user=user, redirect_to="/chats")
link = MagicLink.objects.create(user=user, redirect_to="/check-demographics") # Switch this to "/chats" once profile overlay is added to Chats page
full_link = request.build_absolute_uri(link.get_absolute_url())
body = render_to_string("email/verification.txt", {"url": full_link})
send_mail(
Expand Down
11 changes: 11 additions & 0 deletions django_app/redbox_app/redbox_core/views/demographics_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,17 @@
logger = logging.getLogger(__name__)


# This can be removed once profile overlay added to /chats
class CheckDemographicsView(View):
@method_decorator(login_required)
def get(self, request: HttpRequest) -> HttpResponse:
user: User = request.user
if all([user.name, user.ai_experience, user.grade, user.business_unit, user.profession]):
return redirect("chats")
else:
return redirect("demographics")


class DemographicsView(LoginRequiredMixin, UpdateView):
model = User
template_name = "demographics.html"
Expand Down
28 changes: 15 additions & 13 deletions django_app/redbox_app/templates/chats.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@

{% block content %}

{# To be added back in once profile overlay is required
{% if not request.user.name %}
{{ profile_overlay(csrf_token, request.user, True) }}
{% endif %}
#}

<div class="govuk-width-container">

Expand All @@ -28,21 +30,21 @@ <h1 class="govuk-visually-hidden">Chats</h1>
New chat
</a>

<div class="iai-panel govuk-!-margin-top-5 govuk-!-padding-top-3">
<h2 class="govuk-body govuk-!-font-weight-bold">Recent chats</h2>
<div class="iai-panel__scrollable">
{% for date_group, chats in chat_grouped_by_date_group %}
<h3 class="rb-chat-history__date_group govuk-body-xs govuk-!-font-weight-bold govuk-!-margin-bottom-1">{{ date_group }}</h3>
<ul class="govuk-list govuk-list--spaced">
{% for chat in chats %}
<li class="govuk-!-margin-bottom-1">
<a class="govuk-link govuk-body-s" href="{{url('chats', chat.id)}}">{{ chat.name }}</a>
</li>
<div class="iai-panel govuk-!-margin-top-5 govuk-!-padding-top-3">
<h2 class="govuk-body govuk-!-font-weight-bold">Recent chats</h2>
<div class="iai-panel__scrollable">
{% for date_group, chats in chat_grouped_by_date_group %}
<h3 class="rb-chat-history__date_group govuk-body-xs govuk-!-font-weight-bold govuk-!-margin-bottom-1">{{ date_group }}</h3>
<ul class="govuk-list govuk-list--spaced">
{% for chat in chats %}
<li class="govuk-!-margin-bottom-1">
<a class="govuk-link govuk-body-s" href="{{url('chats', chat.id)}}">{{ chat.name }}</a>
</li>
{% endfor %}
</ul>
{% endfor %}
</ul>
{% endfor %}
</div>
</div>
</div>

<document-selector class="iai-panel govuk-!-margin-top-5 govuk-!-padding-top-3">
<fieldset class="govuk-fieldset">
Expand Down
2 changes: 2 additions & 0 deletions django_app/redbox_app/templates/demographics.html
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ <h1 class="govuk-heading-l">My details</h1>
</fieldset>
</div>

{# To be added in when profile overlay ready to go live
<div class="govuk-form-group">
<label class="govuk-label" for="{{ form.info_about_user.id_for_label }}">
{{ form.info_about_user.label }}
Expand All @@ -61,6 +62,7 @@ <h1 class="govuk-heading-l">My details</h1>
</label>
{{ form.redbox_response_preferences }}
</div>
#}

<div class="govuk-button-group">
{{ govukButton(text="Update") }}
Expand Down
5 changes: 3 additions & 2 deletions tests/test_journey.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,9 @@ def test_user_journey(page: Page, email_address: str):
my_details_page = chats_page.navigate_my_details()
my_details_page.name = "Roland Hamilton-Jones"
my_details_page.ai_experience = "Enthusiastic Experimenter"
my_details_page.info_about_user = "Information about user"
my_details_page.redbox_response_preferences = "Respond concisely"
# Add these in once profile overlay is added
#my_details_page.info_about_user = "Information about user"
#my_details_page.redbox_response_preferences = "Respond concisely"
chats_page = my_details_page.update()

# Documents page
Expand Down

0 comments on commit 125cfdf

Please sign in to comment.