mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-08-14 05:29:43 +02:00
Outline styling, refactor help text logic
This commit is contained in:
parent
a682796570
commit
340e395c00
3 changed files with 34 additions and 25 deletions
|
@ -28,8 +28,10 @@
|
||||||
|
|
||||||
td {
|
td {
|
||||||
.no-click-outline, .no-click-outline:hover, .no-click-outline:focus{
|
.no-click-outline, .no-click-outline:hover, .no-click-outline:focus{
|
||||||
cursor: default !important;
|
outline: none;
|
||||||
outline: none !important;
|
}
|
||||||
|
.cursor-help{
|
||||||
|
cursor: help;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -139,6 +139,33 @@ class Domain(TimeStampedModel, DomainHelper):
|
||||||
# previously existed but has been deleted from the registry
|
# previously existed but has been deleted from the registry
|
||||||
DELETED = "deleted", "Deleted"
|
DELETED = "deleted", "Deleted"
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def get_help_text(cls, state) -> str:
|
||||||
|
"""Returns a help message for a desired state. If none is found, an empty string is returned"""
|
||||||
|
help_texts = {
|
||||||
|
# For now, unknown has the same message as DNS_NEEDED
|
||||||
|
cls.UNKNOWN:(
|
||||||
|
"Before this domain can be used, "
|
||||||
|
"you’ll need to add name server addresses."
|
||||||
|
),
|
||||||
|
cls.DNS_NEEDED: (
|
||||||
|
"Before this domain can be used, "
|
||||||
|
"you’ll need to add name server addresses."
|
||||||
|
),
|
||||||
|
cls.READY: "This domain has name servers and is ready for use.",
|
||||||
|
cls.ON_HOLD: (
|
||||||
|
"This domain is administratively paused, "
|
||||||
|
"so it can’t be edited and won’t resolve in DNS. "
|
||||||
|
"Contact help@get.gov for details."
|
||||||
|
),
|
||||||
|
cls.DELETED: (
|
||||||
|
"This domain has been removed and "
|
||||||
|
"is no longer registered to your organization."
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
return help_texts.get(state, "")
|
||||||
|
|
||||||
class Cache(property):
|
class Cache(property):
|
||||||
"""
|
"""
|
||||||
Python descriptor to turn class methods into properties.
|
Python descriptor to turn class methods into properties.
|
||||||
|
@ -1399,27 +1426,7 @@ class Domain(TimeStampedModel, DomainHelper):
|
||||||
|
|
||||||
def get_state_help_text(self) -> str:
|
def get_state_help_text(self) -> str:
|
||||||
"""Returns a str containing additional information about a given state"""
|
"""Returns a str containing additional information about a given state"""
|
||||||
help_text = ""
|
help_text = Domain.State.get_help_text(self.state)
|
||||||
print(f"self state is {self.state}")
|
|
||||||
match self.state:
|
|
||||||
case self.State.DNS_NEEDED | self.State.UNKNOWN:
|
|
||||||
help_text = (
|
|
||||||
"Before this domain can be used, "
|
|
||||||
"you’ll need to add name server addresses."
|
|
||||||
)
|
|
||||||
case self.State.READY:
|
|
||||||
help_text = "This domain has name servers and is ready for use."
|
|
||||||
case self.State.ON_HOLD:
|
|
||||||
help_text = (
|
|
||||||
"This domain is administratively paused, "
|
|
||||||
"so it can’t be edited and won’t resolve in DNS. "
|
|
||||||
"Contact help@get.gov for details."
|
|
||||||
)
|
|
||||||
case self.State.DELETED:
|
|
||||||
help_text = (
|
|
||||||
"This domain has been removed and "
|
|
||||||
"is no longer registered to your organization."
|
|
||||||
)
|
|
||||||
return help_text
|
return help_text
|
||||||
|
|
||||||
def _disclose_fields(self, contact: PublicContact):
|
def _disclose_fields(self, contact: PublicContact):
|
||||||
|
|
|
@ -48,7 +48,7 @@
|
||||||
</th>
|
</th>
|
||||||
<td data-sort-value="{{ domain.expiration_date|date:"U" }}" data-label="Expires">{{ domain.expiration_date|date }}</td>
|
<td data-sort-value="{{ domain.expiration_date|date:"U" }}" data-label="Expires">{{ domain.expiration_date|date }}</td>
|
||||||
<td data-label="Status">
|
<td data-label="Status">
|
||||||
<span class="usa-tooltip"
|
<span class="usa-tooltip no-click-outline cursor-help"
|
||||||
data-position="top"
|
data-position="top"
|
||||||
title="{{domain.get_state_help_text}}"
|
title="{{domain.get_state_help_text}}"
|
||||||
aria-ignore="true"
|
aria-ignore="true"
|
||||||
|
@ -62,7 +62,7 @@
|
||||||
{{ domain.state|capfirst }}
|
{{ domain.state|capfirst }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<svg
|
<svg
|
||||||
class="usa-icon usa-tooltip text-middle margin-bottom-05 text-accent-cool"
|
class="usa-icon usa-tooltip text-middle margin-bottom-05 text-accent-cool no-click-outline cursor-help"
|
||||||
role="img"
|
role="img"
|
||||||
data-position="top"
|
data-position="top"
|
||||||
title="{{domain.get_state_help_text}}"
|
title="{{domain.get_state_help_text}}"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue