mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-07-03 09:43:33 +02:00
simplified contact detail list template
This commit is contained in:
parent
41406a76ea
commit
1fa0e63126
3 changed files with 18 additions and 2 deletions
|
@ -93,6 +93,14 @@ class Contact(TimeStampedModel):
|
|||
names = [n for n in [self.first_name, self.middle_name, self.last_name] if n]
|
||||
return " ".join(names) if names else "Unknown"
|
||||
|
||||
def has_contact_info(self):
|
||||
has_contact_info = (
|
||||
self.title or
|
||||
self.email or
|
||||
self.phone
|
||||
)
|
||||
return has_contact_info
|
||||
|
||||
def save(self, *args, **kwargs):
|
||||
# Call the parent class's save method to perform the actual save
|
||||
super().save(*args, **kwargs)
|
||||
|
|
|
@ -92,6 +92,14 @@ class User(AbstractUser):
|
|||
"""Return count of ineligible requests"""
|
||||
return self.domain_requests_created.filter(status=DomainRequest.DomainRequestStatus.INELIGIBLE).count()
|
||||
|
||||
def has_contact_info(self):
|
||||
has_contact_info = (
|
||||
self.contact.title or
|
||||
self.email.title or
|
||||
self.contact.phone
|
||||
)
|
||||
return has_contact_info
|
||||
|
||||
@classmethod
|
||||
def needs_identity_verification(cls, email, uuid):
|
||||
"""A method used by our oidc classes to test whether a user needs email/uuid verification
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{% load i18n static %}
|
||||
|
||||
<address class="{% if no_title_top_padding %}margin-top-neg-1__detail-list{% endif %} {% if user.title or user.contact.title or user.email or user.contact.email or user.phone or user.contact.phone %}margin-bottom-1{% endif %} dja-address-contact-list">
|
||||
<address class="{% if no_title_top_padding %}margin-top-neg-1__detail-list{% endif %} {% if user.has_contact_info %}margin-bottom-1{% endif %} dja-address-contact-list">
|
||||
|
||||
{% if show_formatted_name %}
|
||||
{% if contact.get_formatted_name %}
|
||||
|
@ -10,7 +10,7 @@
|
|||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
{% if user.title or user.contact.title or user.email or user.contact.email or user.phone or user.contact.phone %}
|
||||
{% if user.has_contact_info %}
|
||||
{# Title #}
|
||||
{% if user.title or user.contact.title %}
|
||||
{% if user.contact.title %}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue