Просмотр исходного кода

Adds tooltip on custom field (#12505)

* adds tooltip on custom field #12131

* adds description field check

* fixed field name

* updated code to match the panel

* added escape filter on description
Abhimanyu Saharan 2 лет назад
Родитель
Сommit
4e49f4a434

+ 10 - 3
netbox/templates/circuits/inc/circuit_termination.html

@@ -132,9 +132,16 @@
             </tr>
             {% for field, value in fields.items %}
               <tr>
-                <td>
-                  <span title="{{ field.description|escape }}">{{ field }}</span>
-                </td>
+                <th scope="row">{{ field }}
+                  {% if field.description %}
+                    <i
+                      class="mdi mdi-information text-primary"
+                      data-bs-toggle="tooltip"
+                      data-bs-placement="right"
+                      title="{{ field.description|escape }}"
+                    ></i>
+                 {% endif %}
+                </th>
                 <td>
                   {% customfield_value field value %}
                 </td>

+ 9 - 2
netbox/templates/inc/panels/custom_fields.html

@@ -12,8 +12,15 @@
           <table class="table table-hover attr-table">
             {% for field, value in fields.items %}
               <tr>
-                <th scope="row">
-                  <span title="{{ field.description|escape }}">{{ field }}</span>
+                <th scope="row">{{ field }}
+                  {% if field.description %}
+                    <i
+                      class="mdi mdi-information text-primary"
+                      data-bs-toggle="tooltip"
+                      data-bs-placement="right"
+                      title="{{ field.description|escape }}"
+                    ></i>
+                  {% endif %}
                 </th>
                 <td>
                   {% customfield_value field value %}