Kaynağa Gözat

adds optional classes parameter #14390

Abhimanyu Saharan 2 yıl önce
ebeveyn
işleme
b21ed6a334

+ 1 - 1
netbox/utilities/templates/builtins/copy_content.html

@@ -1,3 +1,3 @@
-<a class="btn btn-sm {{ color }} copy-content" data-clipboard-target="{{ target }}" title="Copy to clipboard">
+<a class="btn btn-sm {{ color }} copy-content {{ classes }}" data-clipboard-target="{{ target }}" title="Copy to clipboard">
   <i class="mdi mdi-content-copy"></i>
 </a>

+ 3 - 2
netbox/utilities/templatetags/builtins/tags.py

@@ -87,13 +87,14 @@ def checkmark(value, show_false=True, true='Yes', false='No'):
 
 
 @register.inclusion_tag('builtins/copy_content.html')
-def copy_content(target, prefix=None, color='primary'):
+def copy_content(target, prefix=None, color='primary', classes=None):
     """
     Display a copy button to copy the content of a field.
     """
     return {
         'target': f'#{prefix or ""}{target}',
-        'color': f'btn-{color}'
+        'color': f'btn-{color}',
+        'classes': classes or '',
     }