Code cleanup

This commit is contained in:
zandercymatics 2024-01-23 13:21:52 -07:00
parent 8c461942c8
commit 8417c77368
No known key found for this signature in database
GPG key ID: FF4636ABEC9682B7
6 changed files with 12 additions and 32 deletions

View file

@ -31,7 +31,7 @@ a.usa-button.disabled-link {
color: #454545 !important
}
a.usa-button.disabled-link:hover{
a.usa-button.disabled-link:hover {
background-color: #ccc !important;
cursor: not-allowed !important;
color: #454545 !important
@ -47,8 +47,8 @@ a.usa-button.disabled-link:focus {
a.usa-button--unstyled.disabled-link,
a.usa-button--unstyled.disabled-link:hover,
a.usa-button--unstyled.disabled-link:focus {
cursor: not-allowed !important;
outline: none !important;
cursor: not-allowed;
outline: none;
}
a.usa-button:not(.usa-button--unstyled, .usa-button--outline) {

View file

@ -11,10 +11,10 @@
{% if messages %}
<ul class="messages">
{% for message in messages %}
<li{% if message.tags %} class="{{ message.tags }}" {% endif %}>
{{ message }}
<li {% if message.tags %} class="{{ message.tags }}" {% endif %}>
{{ message }}
</li>
{% endfor %}
{% endfor %}
</ul>
{% endif %}
{% endblock %}

View file

@ -92,13 +92,6 @@
</a>
{% endif %}
</td>
{% comment %}
usa-tooltip disabled-link"
data-position="right"
title="Coming in 2024"
aria-disabled="true"
data-tooltip="true"
{% endcomment %}
</tr>
{% endfor %}
</tbody>
@ -137,8 +130,9 @@
</th>
<td data-sort-value="{{ invitation.created_at|date:"U" }}" data-label="Date created">{{ invitation.created_at|date }} </td>
<td data-label="Status">{{ invitation.status|title }}</td>
<td class="padding-left-2px"><form method="POST" action="{% url "invitation-delete" pk=invitation.id %}">
{% csrf_token %}<input type="submit" class="usa-button--unstyled text-no-underline" value="Cancel">
<td>
<form method="POST" action="{% url "invitation-delete" pk=invitation.id %}">
{% csrf_token %}<input type="submit" class="usa-button--unstyled text-no-underline" value="Cancel">
</form>
</td>
</tr>

View file

@ -2740,10 +2740,6 @@ class TestDomainManagers(TestDomainOverview):
role_2_exists = UserDomainRole.objects.filter(id=role_2.id).exists()
self.assertTrue(role_2_exists)
# Check that the view no longer displays the deleted user
# why is this not working? Its not in the response when printed?
# self.assertNotContains(response, "cheese@igorville.com")
def test_domain_delete_self_redirects_home(self):
"""Tests if deleting yourself redirects to home"""
# Add additional users

View file

@ -481,14 +481,6 @@ class DotgovDomain(ApplicationWizard):
context["federal_type"] = self.application.federal_type
return context
def post(self, request, *args, **kwargs):
"""Override for the post method to mark the DraftDomain as complete"""
response = super().post(request, *args, **kwargs)
# Set the DraftDomain to "complete"
self.application.requested_domain.is_incomplete = False
self.application.save()
return response
class Purpose(ApplicationWizard):
template_name = "application_purpose.html"

View file

@ -651,13 +651,14 @@ class DomainUsersView(DomainBaseView):
# Determine if the current user can delete managers
domain_pk = None
can_delete_users = False
if self.kwargs is not None and "pk" in self.kwargs:
domain_pk = self.kwargs["pk"]
# Prevent the end user from deleting themselves as a manager if they are the
# only manager that exists on a domain.
can_delete_users = UserDomainRole.objects.filter(domain__id=domain_pk).count() > 1
context["can_delete_users"] = can_delete_users
context["can_delete_users"] = can_delete_users
return context
def _add_modal_buttons_to_context(self, context):
@ -689,7 +690,6 @@ class DomainUsersView(DomainBaseView):
class_list = classes
html_class = f'class="{class_list}"' if class_list else None
modal_button = '<button type="submit" ' f"{html_class} " f'name="{button_name}">{button_text_content}</button>'
return modal_button
@ -831,7 +831,7 @@ class DomainDeleteUserView(UserDomainRolePermissionDeleteView):
if email_or_name is None or email_or_name.strip() == "":
email_or_name = self.object.user
# If the user is deleting themselves, return a special message.
# If the user is deleting themselves, return a specific message.
# If not, return something more generic.
if delete_self:
message = f"You are no longer managing the domain {self.object.domain}."
@ -842,14 +842,12 @@ class DomainDeleteUserView(UserDomainRolePermissionDeleteView):
def form_valid(self, form):
"""Delete the specified user on this domain."""
super().form_valid(form)
# Is the user deleting themselves? If so, display a different message
delete_self = self.request.user == self.object.user
# Add a success message
messages.success(self.request, self.get_success_message(delete_self))
return redirect(self.get_success_url())
def post(self, request, *args, **kwargs):