Skip to content

Commit

Permalink
Move all buttons on the profile to the same area
Browse files Browse the repository at this point in the history
  • Loading branch information
CamLamb committed Nov 29, 2024
1 parent a288430 commit 3cbbc24
Showing 1 changed file with 38 additions and 38 deletions.
76 changes: 38 additions & 38 deletions src/peoplefinder/templates/peoplefinder/profile.html
Original file line number Diff line number Diff line change
Expand Up @@ -80,40 +80,6 @@ <h1 class="text-large" data-testid="full-name">{{ profile.full_name }}</h1>
</div>
</div>

{% if show_confirm_my_details or show_activate_profile %}
<div class="dwds-button-group">
{% if show_confirm_my_details %}
<button class="dwds-button dwds-button--transactional"
hx-post="{% url 'profile-confirm-details' profile.slug %}"
hx-headers='{"X-CSRFToken": "{{ csrf_token }}"}'>
Confirm my details are still correct
</button>
{% endif %}

{% if show_activate_profile %}
<button class="dwds-button dwds-button--transactional"
hx-post="{% url 'profile-activate' profile.slug %}"
hx-headers='{"X-CSRFToken": "{{ csrf_token }}"}'
hx-confirm="Are you sure you want to activate this profile?">
Activate profile
</button>
{% endif %}
</div>
{% endif %}

{% if profile.is_active and perms.peoplefinder.delete_person and request.user != profile.user %}
<form action="{% url 'profile-delete' profile.slug %}"
style="display: contents"
method="post"
onsubmit="javascript:return confirm('Are you sure? This cannot be undone.')">
{% csrf_token %}
<input class="dwds-button dwds-button--warning"
type="submit"
id="delete-profile"
value="Delete profile" />
</form>
{% endif %}

<div class="content-stack">
{% if profile.is_active %}
{% if request.user == profile.user %}
Expand All @@ -129,10 +95,44 @@ <h1 class="text-large" data-testid="full-name">{{ profile.full_name }}</h1>
<p>This profile is inactive since {{ profile.became_inactive|naturaltime }}.</p>
{% endif %}
</div>
{% if profile.is_active %}
<a class="dwds-button dwds-button--inline dwds-button--secondary"
href="{% url 'profile-edit' profile.slug %}">Edit profile</a>
{% endif %}


<div class="dwds-button-group">
{% if profile.is_active %}
<a class="dwds-button dwds-button--inline dwds-button--secondary"
href="{% url 'profile-edit' profile.slug %}">Edit profile</a>
{% endif %}

{% if show_confirm_my_details %}
<button class="dwds-button dwds-button--inline dwds-button--transactional"
hx-post="{% url 'profile-confirm-details' profile.slug %}"
hx-headers='{"X-CSRFToken": "{{ csrf_token }}"}'>
Confirm my details are still correct
</button>
{% endif %}

{% if show_activate_profile %}
<button class="dwds-button dwds-button--inline dwds-button--transactional"
hx-post="{% url 'profile-activate' profile.slug %}"
hx-headers='{"X-CSRFToken": "{{ csrf_token }}"}'
hx-confirm="Are you sure you want to activate this profile?">
Activate profile
</button>
{% endif %}

{% if profile.is_active and perms.peoplefinder.delete_person and request.user != profile.user %}
<form action="{% url 'profile-delete' profile.slug %}"
style="display: contents"
method="post"
onsubmit="javascript:return confirm('Are you sure? This cannot be undone.')">
{% csrf_token %}
<input class="dwds-button dwds-button--inline dwds-button--warning"
type="submit"
id="delete-profile"
value="Delete profile" />
</form>
{% endif %}
</div>
</div>
</div>
</div>
Expand Down

0 comments on commit 3cbbc24

Please sign in to comment.