mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-08-14 13:34:10 +02:00
add static messages to admin confirmation messages
This commit is contained in:
parent
041ca70a8b
commit
e3e001fe0d
4 changed files with 49 additions and 0 deletions
|
@ -1326,6 +1326,7 @@ class UserPortfolioPermissionAdmin(ListHeaderAdmin):
|
|||
search_help_text = "Search by first name, last name, email, or portfolio."
|
||||
|
||||
change_form_template = "django/admin/user_portfolio_permission_change_form.html"
|
||||
delete_confirmation_template = "django/admin/user_portfolio_permission_delete_confirmation.html"
|
||||
|
||||
def get_roles(self, obj):
|
||||
readable_roles = obj.get_readable_roles()
|
||||
|
@ -1631,6 +1632,7 @@ class PortfolioInvitationAdmin(BaseInvitationAdmin):
|
|||
autocomplete_fields = ["portfolio"]
|
||||
|
||||
change_form_template = "django/admin/portfolio_invitation_change_form.html"
|
||||
delete_confirmation_template = "django/admin/portfolio_invitation_delete_confirmation.html"
|
||||
|
||||
# Select portfolio invitations to change -> Portfolio invitations
|
||||
def changelist_view(self, request, extra_context=None):
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
{% extends "admin/delete_confirmation.html" %}
|
||||
|
||||
{% block content_subtitle %}
|
||||
<div class="usa-alert usa-alert--info usa-alert--slim">
|
||||
<div class="usa-alert__body margin-left-1 maxw-none">
|
||||
<p class="usa-alert__text maxw-none">
|
||||
If you cancel the portfolio invitation here, it won't trigger any emails. It also won't remove the user's
|
||||
portfolio access if they already logged in. Go to the
|
||||
<a href="{% url 'admin:registrar_userportfoliopermission_changelist' %}">
|
||||
User Portfolio Permissions
|
||||
</a>
|
||||
table if you want to remove the user from a portfolio.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
{{ block.super }}
|
||||
{% endblock %}
|
|
@ -0,0 +1,12 @@
|
|||
{% extends "admin/delete_confirmation.html" %}
|
||||
|
||||
{% block content_subtitle %}
|
||||
<div class="usa-alert usa-alert--info usa-alert--slim">
|
||||
<div class="usa-alert__body margin-left-1 maxw-none">
|
||||
<p class="usa-alert__text maxw-none">
|
||||
If you remove someone from a portfolio here, it will not send any emails when you click "Save".
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
{{ block.super }}
|
||||
{% endblock %}
|
|
@ -1549,6 +1549,24 @@ class TestPortfolioInvitationAdmin(TestCase):
|
|||
request, "Could not send email notification to existing organization admins."
|
||||
)
|
||||
|
||||
@less_console_noise_decorator
|
||||
def test_delete_confirmation_page_contains_static_message(self):
|
||||
"""Ensure the custom message appears in the delete confirmation page."""
|
||||
self.client.force_login(self.superuser)
|
||||
# Create a test portfolio invitation
|
||||
self.invitation = PortfolioInvitation.objects.create(
|
||||
email="testuser@example.com",
|
||||
portfolio=self.portfolio,
|
||||
roles=["organization_member"]
|
||||
)
|
||||
delete_url = reverse(
|
||||
"admin:registrar_portfolioinvitation_delete", args=[self.invitation.pk]
|
||||
)
|
||||
response = self.client.get(delete_url)
|
||||
|
||||
# Check if the response contains the expected static message
|
||||
expected_message = "If you cancel the portfolio invitation here"
|
||||
self.assertIn(expected_message, response.content.decode("utf-8"))
|
||||
|
||||
class TestHostAdmin(TestCase):
|
||||
"""Tests for the HostAdmin class as super user
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue