diff --git a/contracts/models.py b/contracts/models.py index 1c1102f61b5b5be3c095b524334dcdaed3615a1a..bcd61d75af4427a5b2a6cd145fccb4e5a558626f 100644 --- a/contracts/models.py +++ b/contracts/models.py @@ -200,6 +200,13 @@ class Signee( def url(self) -> str: return reverse("contracts:view_signee", args=(self.id,)) + @property + def shortened_name(self) -> str: + if len(self.name) > 25: + return self.name[:22] + "..." + + return self.name + @property def entity_has_public_address(self) -> bool: return self.entity_type in ( @@ -355,6 +362,13 @@ class Contractee( def url(self) -> str: return reverse("contracts:view_contractee", args=(self.id,)) + @property + def shortened_name(self) -> str: + if len(self.name) > 25: + return self.name[:22] + "..." + + return self.name + def __str__(self) -> str: result = str(self.name) diff --git a/contracts/templates/contracts/includes/contract_list.html b/contracts/templates/contracts/includes/contract_list.html index e8bcf35d6e174ab820b88a093a21a6dc95842866..24a97943a73ca7201cba0d58af85279fe26dfaae 100644 --- a/contracts/templates/contracts/includes/contract_list.html +++ b/contracts/templates/contracts/includes/contract_list.html @@ -61,9 +61,9 @@ {% for signature in contract.signee_signatures.all %} <li class="flex"> {% if signature.signee.entity_type == signature.signee.EntityTypes.LEGAL_ENTITY or signature.signee.entity_type == signature.signee.EntityTypes.OTHER %} - {% include "contracts/includes/tag.html" with url=signature.signee.url icon="ico--office" content=signature.signee.name public=contract.is_public %} + {% include "contracts/includes/tag.html" with url=signature.signee.url icon="ico--office" content=signature.signee.shortened_name public=contract.is_public %} {% else %} - {% include "contracts/includes/tag.html" with url=signature.signee.url icon="ico--user" content=signature.signee.name public=contract.is_public %} + {% include "contracts/includes/tag.html" with url=signature.signee.url icon="ico--user" content=signature.signee.shortened_name public=contract.is_public %} {% endif %} </li> {% endfor %}