Omit hash mark from target string

This commit is contained in:
Jeremy Stretch 2023-07-06 11:20:58 -04:00
parent 24f5421a3f
commit 3be724faf6
8 changed files with 14 additions and 14 deletions

View File

@ -20,7 +20,7 @@ __all__ = (
AVAILABLE_LABEL = mark_safe('<span class="badge bg-success">Available</span>')
AGGREGATE_COPY_BUTTON = """
{% copy_content record.pk prefix="#aggregate_" %}
{% copy_content record.pk prefix="aggregate_" %}
"""
PREFIX_LINK = """
@ -32,7 +32,7 @@ PREFIX_LINK = """
"""
PREFIX_COPY_BUTTON = """
{% copy_content record.pk prefix="#prefix_" %}
{% copy_content record.pk prefix="prefix_" %}
"""
PREFIX_LINK_WITH_DEPTH = """
@ -57,7 +57,7 @@ IPADDRESS_LINK = """
"""
IPADDRESS_COPY_BUTTON = """
{% copy_content record.pk prefix="#ipaddress_" %}
{% copy_content record.pk prefix="ipaddress_" %}
"""
IPADDRESS_ASSIGN_LINK = """

View File

@ -39,7 +39,7 @@
<th scope="row">Path</th>
<td>
<span class="font-monospace" id="datafile_path">{{ object.path }}</span>
{% copy_content "#datafile_path" %}
{% copy_content "datafile_path" %}
</td>
</tr>
<tr>
@ -54,7 +54,7 @@
<th scope="row">SHA256 Hash</th>
<td>
<span class="font-monospace" id="datafile_hash">{{ object.hash }}</span>
{% copy_content "#datafile_hash" %}
{% copy_content "datafile_hash" %}
</td>
</tr>
</table>

View File

@ -200,7 +200,7 @@
{% elif object.primary_ip4.nat_outside.exists %}
(NAT: {% for nat in object.primary_ip4.nat_outside.all %}<a href="{{ nat.get_absolute_url }}">{{ nat.address.ip }}</a>{% if not forloop.last %}, {% endif %}{% endfor %})
{% endif %}
{% copy_content record.pk prefix="#primary_ip4_" %}
{% copy_content record.pk prefix="primary_ip4_" %}
{% else %}
{{ ''|placeholder }}
{% endif %}
@ -216,7 +216,7 @@
{% elif object.primary_ip6.nat_outside.exists %}
(NAT: {% for nat in object.primary_ip6.nat_outside.all %}<a href="{{ nat.get_absolute_url }}">{{ nat.address.ip }}</a>{% if not forloop.last %}, {% endif %}{% endfor %})
{% endif %}
{% copy_content record.pk prefix="#primary_ip6_" %}
{% copy_content record.pk prefix="primary_ip6_" %}
{% else %}
{{ ''|placeholder }}
{% endif %}

View File

@ -33,7 +33,7 @@
<td>
{% if object.primary_ip4 %}
<a href="{{ object.primary_ip4.get_absolute_url }}" id="primary_ip4_{{ object.primary_ip4.pk }}">{{ object.primary_ip4 }}</a>
{% copy_content object.primary_ip4.pk prefix="#primary_ip4_" %}
{% copy_content object.primary_ip4.pk prefix="primary_ip4_" %}
{% else %}
<span class="text-muted"></span>
{% endif %}
@ -44,7 +44,7 @@
<td>
{% if object.primary_ip6 %}
<a href="{{ object.primary_ip6.get_absolute_url }}" id="primary_ip6_{{ object.primary_ip6.pk }}">{{ object.primary_ip6 }}</a>
{% copy_content object.primary_ip6.pk prefix="#primary_ip6_" %}
{% copy_content object.primary_ip6.pk prefix="primary_ip6_" %}
{% else %}
<span class="text-muted"></span>
{% endif %}

View File

@ -19,7 +19,7 @@
<th scope="row">Key</th>
<td>
<div class="float-end">
{% copy_content "#token_id" %}
{% copy_content "token_id" %}
</div>
<div id="token_id">{{ key }}</div>
</td>

View File

@ -52,7 +52,7 @@
{% elif object.primary_ip4.nat_outside.exists %}
(NAT: {% for nat in object.primary_ip4.nat_outside.all %}<a href="{{ nat.get_absolute_url }}">{{ nat.address.ip }}</a>{% if not forloop.last %}, {% endif %}{% endfor %})
{% endif %}
{% copy_content record.pk prefix="#primary_ip4_" %}
{% copy_content record.pk prefix="primary_ip4_" %}
{% else %}
{{ ''|placeholder }}
{% endif %}
@ -68,7 +68,7 @@
{% elif object.primary_ip6.nat_outside.exists %}
(NAT: {% for nat in object.primary_ip6.nat_outside.all %}<a href="{{ nat.get_absolute_url }}">{{ nat.address.ip }}</a>{% if not forloop.last %}, {% endif %}{% endfor %})
{% endif %}
{% copy_content record.pk prefix="#primary_ip6_" %}
{% copy_content record.pk prefix="primary_ip6_" %}
{% else %}
{{ ''|placeholder }}
{% endif %}

View File

@ -12,7 +12,7 @@ ALLOWED_IPS = """{{ value|join:", " }}"""
COPY_BUTTON = """
{% if settings.ALLOW_TOKEN_RETRIEVAL %}
{% copy_content record.pk prefix="#token_" color="success" %}
{% copy_content record.pk prefix="token_" color="success" %}
{% endif %}
"""

View File

@ -84,7 +84,7 @@ def copy_content(target, prefix=None, color='primary'):
Display a copy button to copy the content of a field.
"""
return {
'target': target if prefix is None else prefix + str(target),
'target': f'#{prefix or ""}{target}',
'color': f'btn-{color}'
}