mirror of
https://github.com/netbox-community/netbox.git
synced 2025-08-26 09:16:10 -06:00
adds hide-if-unset to custom field #12597
This commit is contained in:
parent
24a51dd86e
commit
49e4704bf7
@ -56,11 +56,13 @@ class CustomFieldVisibilityChoices(ChoiceSet):
|
|||||||
VISIBILITY_READ_WRITE = 'read-write'
|
VISIBILITY_READ_WRITE = 'read-write'
|
||||||
VISIBILITY_READ_ONLY = 'read-only'
|
VISIBILITY_READ_ONLY = 'read-only'
|
||||||
VISIBILITY_HIDDEN = 'hidden'
|
VISIBILITY_HIDDEN = 'hidden'
|
||||||
|
VISIBILITY_HIDDEN_IFUNSET = 'hidden-ifunset'
|
||||||
|
|
||||||
CHOICES = (
|
CHOICES = (
|
||||||
(VISIBILITY_READ_WRITE, 'Read/Write'),
|
(VISIBILITY_READ_WRITE, 'Read/Write'),
|
||||||
(VISIBILITY_READ_ONLY, 'Read-only'),
|
(VISIBILITY_READ_ONLY, 'Read-only'),
|
||||||
(VISIBILITY_HIDDEN, 'Hidden'),
|
(VISIBILITY_HIDDEN, 'Hidden'),
|
||||||
|
(VISIBILITY_HIDDEN_IFUNSET, 'Hidden if unset'),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -131,21 +131,25 @@
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% for field, value in fields.items %}
|
{% for field, value in fields.items %}
|
||||||
<tr>
|
{% if field.ui_visibility == 'hidden-ifunset' and not value %}
|
||||||
<th scope="row">{{ field }}
|
<!-- Skip hidden fields -->
|
||||||
{% if field.description %}
|
{% else %}
|
||||||
<i
|
<tr>
|
||||||
class="mdi mdi-information text-primary"
|
<th scope="row">{{ field }}
|
||||||
data-bs-toggle="tooltip"
|
{% if field.description %}
|
||||||
data-bs-placement="right"
|
<i
|
||||||
title="{{ field.description|escape }}"
|
class="mdi mdi-information text-primary"
|
||||||
></i>
|
data-bs-toggle="tooltip"
|
||||||
{% endif %}
|
data-bs-placement="right"
|
||||||
</th>
|
title="{{ field.description|escape }}"
|
||||||
<td>
|
></i>
|
||||||
{% customfield_value field value %}
|
{% endif %}
|
||||||
</td>
|
</th>
|
||||||
</tr>
|
<td>
|
||||||
|
{% customfield_value field value %}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</table>
|
</table>
|
||||||
|
@ -11,21 +11,25 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
<table class="table table-hover attr-table">
|
<table class="table table-hover attr-table">
|
||||||
{% for field, value in fields.items %}
|
{% for field, value in fields.items %}
|
||||||
<tr>
|
{% if field.ui_visibility == 'hidden-ifunset' and not value %}
|
||||||
<th scope="row">{{ field }}
|
<!-- Skip hidden fields -->
|
||||||
{% if field.description %}
|
{% else %}
|
||||||
<i
|
<tr>
|
||||||
class="mdi mdi-information text-primary"
|
<th scope="row">{{ field }}
|
||||||
data-bs-toggle="tooltip"
|
{% if field.description %}
|
||||||
data-bs-placement="right"
|
<i
|
||||||
title="{{ field.description|escape }}"
|
class="mdi mdi-information text-primary"
|
||||||
></i>
|
data-bs-toggle="tooltip"
|
||||||
{% endif %}
|
data-bs-placement="right"
|
||||||
</th>
|
title="{{ field.description|escape }}"
|
||||||
<td>
|
></i>
|
||||||
{% customfield_value field value %}
|
{% endif %}
|
||||||
</td>
|
</th>
|
||||||
</tr>
|
<td>
|
||||||
|
{% customfield_value field value %}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</table>
|
</table>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
Loading…
Reference in New Issue
Block a user