mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-08-01 07:26:34 +02:00
Fix andi errors
This commit is contained in:
parent
4d374b2878
commit
3a12e59db6
4 changed files with 22 additions and 13 deletions
|
@ -2287,11 +2287,12 @@ class DomainRequestAdmin(ListHeaderAdmin, ImportExportModelAdmin):
|
||||||
@admin.display(description=_("Requested Domain"))
|
@admin.display(description=_("Requested Domain"))
|
||||||
def custom_requested_domain(self, obj):
|
def custom_requested_domain(self, obj):
|
||||||
# Example: Show different icons based on `status`
|
# Example: Show different icons based on `status`
|
||||||
url = reverse("admin:registrar_domainrequest_changelist") + f"{obj.id}"
|
|
||||||
text = obj.requested_domain
|
text = obj.requested_domain
|
||||||
if obj.portfolio:
|
if obj.portfolio:
|
||||||
return format_html('<a href="{}"><img src="/public/admin/img/icon-yes.svg"> {}</a>', url, text)
|
return format_html(
|
||||||
return format_html('<a href="{}">{}</a>', url, text)
|
f'<img src="/public/admin/img/icon-yes.svg" aria-hidden="true"> {escape(text)}'
|
||||||
|
)
|
||||||
|
return text
|
||||||
|
|
||||||
custom_requested_domain.admin_order_field = "requested_domain__name" # type: ignore
|
custom_requested_domain.admin_order_field = "requested_domain__name" # type: ignore
|
||||||
|
|
||||||
|
|
|
@ -982,3 +982,7 @@ ul.add-list-reset {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#result_list > tbody tr > th > a {
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
|
@ -19,11 +19,11 @@ Load our custom filters to extract info from the django generated markup.
|
||||||
|
|
||||||
{% if results.0|contains_checkbox %}
|
{% if results.0|contains_checkbox %}
|
||||||
{# .gov - hardcode the select all checkbox #}
|
{# .gov - hardcode the select all checkbox #}
|
||||||
<th scope="col" class="action-checkbox-column" title="Toggle all">
|
<th scope="col" class="action-checkbox-column" title="Toggle">
|
||||||
<div class="text">
|
<div class="text">
|
||||||
<span>
|
<span>
|
||||||
<input type="checkbox" id="action-toggle">
|
|
||||||
<label for="action-toggle" class="usa-sr-only">Toggle all</label>
|
<label for="action-toggle" class="usa-sr-only">Toggle all</label>
|
||||||
|
<input type="checkbox" id="action-toggle">
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="clear"></div>
|
<div class="clear"></div>
|
||||||
|
@ -61,10 +61,10 @@ Load our custom filters to extract info from the django generated markup.
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<tr>
|
<tr>
|
||||||
{% with result_value=result.0|extract_value %}
|
{% with result_value=result.0|extract_value %}
|
||||||
{% with result_label=result.1|extract_a_text %}
|
{% with result_label=result.1|extract_a_text checkbox_id="select-"|add:result_value %}
|
||||||
<td>
|
<td>
|
||||||
<input type="checkbox" name="_selected_action" value="{{ result_value|default:'value' }}" id="{{ result_value|default:'value' }}-{{ result_label|default:'label' }}" class="action-select">
|
<label class="usa-sr-only" for="{{ checkbox_id }}">Select row {{ result_label|default:'label' }}</label>
|
||||||
<label class="usa-sr-only" for="{{ result_value|default:'value' }}-{{ result_label|default:'label' }}">{{ result_label|default:'label' }}</label>
|
<input type="checkbox" name="_selected_action" value="{{ result_value|default:'value' }}" id="{{ checkbox_id }}" class="action-select">
|
||||||
</td>
|
</td>
|
||||||
{% endwith %}
|
{% endwith %}
|
||||||
{% endwith %}
|
{% endwith %}
|
||||||
|
|
|
@ -25,11 +25,15 @@ def extract_a_text(value):
|
||||||
pattern = r"<a\b[^>]*>(.*?)</a>"
|
pattern = r"<a\b[^>]*>(.*?)</a>"
|
||||||
match = re.search(pattern, value)
|
match = re.search(pattern, value)
|
||||||
if match:
|
if match:
|
||||||
extracted_text = match.group(1)
|
# Get the content and strip any nested HTML tags
|
||||||
else:
|
content = match.group(1)
|
||||||
extracted_text = ""
|
# Remove any nested HTML tags (like <img>)
|
||||||
|
text_pattern = r"<[^>]+>"
|
||||||
return extracted_text
|
text_only = re.sub(text_pattern, "", content)
|
||||||
|
# Clean up any extra whitespace
|
||||||
|
return text_only.strip()
|
||||||
|
|
||||||
|
return ""
|
||||||
|
|
||||||
|
|
||||||
@register.filter
|
@register.filter
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue