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

View File

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

View File

@ -200,7 +200,7 @@
{% elif object.primary_ip4.nat_outside.exists %} {% 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 %}) (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 %} {% endif %}
{% copy_content record.pk prefix="#primary_ip4_" %} {% copy_content record.pk prefix="primary_ip4_" %}
{% else %} {% else %}
{{ ''|placeholder }} {{ ''|placeholder }}
{% endif %} {% endif %}
@ -216,7 +216,7 @@
{% elif object.primary_ip6.nat_outside.exists %} {% 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 %}) (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 %} {% endif %}
{% copy_content record.pk prefix="#primary_ip6_" %} {% copy_content record.pk prefix="primary_ip6_" %}
{% else %} {% else %}
{{ ''|placeholder }} {{ ''|placeholder }}
{% endif %} {% endif %}

View File

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

View File

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

View File

@ -52,7 +52,7 @@
{% elif object.primary_ip4.nat_outside.exists %} {% 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 %}) (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 %} {% endif %}
{% copy_content record.pk prefix="#primary_ip4_" %} {% copy_content record.pk prefix="primary_ip4_" %}
{% else %} {% else %}
{{ ''|placeholder }} {{ ''|placeholder }}
{% endif %} {% endif %}
@ -68,7 +68,7 @@
{% elif object.primary_ip6.nat_outside.exists %} {% 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 %}) (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 %} {% endif %}
{% copy_content record.pk prefix="#primary_ip6_" %} {% copy_content record.pk prefix="primary_ip6_" %}
{% else %} {% else %}
{{ ''|placeholder }} {{ ''|placeholder }}
{% endif %} {% endif %}

View File

@ -12,7 +12,7 @@ ALLOWED_IPS = """{{ value|join:", " }}"""
COPY_BUTTON = """ COPY_BUTTON = """
{% if settings.ALLOW_TOKEN_RETRIEVAL %} {% if settings.ALLOW_TOKEN_RETRIEVAL %}
{% copy_content record.pk prefix="#token_" color="success" %} {% copy_content record.pk prefix="token_" color="success" %}
{% endif %} {% 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. Display a copy button to copy the content of a field.
""" """
return { return {
'target': target if prefix is None else prefix + str(target), 'target': f'#{prefix or ""}{target}',
'color': f'btn-{color}' 'color': f'btn-{color}'
} }