mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-05-17 18:09:25 +02:00
Strip newline
This commit is contained in:
parent
32463dd7a7
commit
4c84ad8456
4 changed files with 13 additions and 18 deletions
|
@ -791,6 +791,7 @@ div.dja__model-description{
|
||||||
textarea {
|
textarea {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
resize: none;
|
resize: none;
|
||||||
|
cursor: pointer;
|
||||||
|
|
||||||
&::-webkit-scrollbar {
|
&::-webkit-scrollbar {
|
||||||
background-color: transparent;
|
background-color: transparent;
|
||||||
|
@ -805,18 +806,6 @@ div.dja__model-description{
|
||||||
border: 3px solid transparent;
|
border: 3px solid transparent;
|
||||||
}
|
}
|
||||||
|
|
||||||
&::-webkit-scrollbar-thumb:hover {
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
&::-webkit-scrollbar-button {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
::-webkit-scrollbar-corner {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -577,12 +577,9 @@ class DomainRequest(TimeStampedModel):
|
||||||
# Return the content of the rendered views
|
# Return the content of the rendered views
|
||||||
context = {"domain_request": self}
|
context = {"domain_request": self}
|
||||||
|
|
||||||
# autoescape off adds a newline to the beginning of the email.
|
|
||||||
# This is fine when the email is rendered, but we don't need this for display.
|
|
||||||
email_body_text = template.render(context=context).lstrip().lstrip("\n")
|
|
||||||
return {
|
return {
|
||||||
"subject_text": subject_template.render(context=context),
|
"subject_text": subject_template.render(context=context),
|
||||||
"email_body_text": email_body_text
|
"email_body_text": template.render(context=context)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -109,10 +109,10 @@ This is using a custom implementation fieldset.html (see admin/fieldset.html)
|
||||||
{% if original_object.action_needed_reason_email %}
|
{% if original_object.action_needed_reason_email %}
|
||||||
<div class="dja-readonly-textarea-container padding-1 margin-top-2 thin-border display-none">
|
<div class="dja-readonly-textarea-container padding-1 margin-top-2 thin-border display-none">
|
||||||
<label class="max-full" for="action_needed_reason_email_view_more">
|
<label class="max-full" for="action_needed_reason_email_view_more">
|
||||||
<strong>Auto-generated email (will be sent to submitter)</strong>
|
<strong>Auto-generated email (sent to submitter)</strong>
|
||||||
</label>
|
</label>
|
||||||
<textarea id="action_needed_reason_email_view_more" cols="40" rows="20" class="no-border" readonly>
|
<textarea id="action_needed_reason_email_view_more" cols="40" rows="20" class="no-border" readonly>
|
||||||
{{ original_object.action_needed_reason_email }}
|
{{ original_object.action_needed_reason_email|strip_beginning_newline_and_spaces }}
|
||||||
</textarea>
|
</textarea>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
|
@ -145,3 +145,12 @@ def format_phone(value):
|
||||||
phone_number = PhoneNumber.from_string(value)
|
phone_number = PhoneNumber.from_string(value)
|
||||||
return phone_number.as_national
|
return phone_number.as_national
|
||||||
return value
|
return value
|
||||||
|
|
||||||
|
@register.filter
|
||||||
|
def strip_beginning_newline_and_spaces(value):
|
||||||
|
"""Removes any newline characters (and spaces)
|
||||||
|
on the first line of a given string"""
|
||||||
|
if value and isinstance(value, str):
|
||||||
|
return value.lstrip("\n").lstrip(" ")
|
||||||
|
else:
|
||||||
|
return value
|
Loading…
Add table
Add a link
Reference in a new issue