فهرست منبع

Fixes #8974: Use monospace font for text areas in config revision form

jeremystretch 3 سال پیش
والد
کامیت
a1808a54a4
3فایلهای تغییر یافته به همراه28 افزوده شده و 5 حذف شده
  1. 4 0
      docs/release-notes/version-3.1.md
  2. 3 0
      netbox/extras/admin.py
  3. 21 5
      netbox/netbox/config/parameters.py

+ 4 - 0
docs/release-notes/version-3.1.md

@@ -2,6 +2,10 @@
 
 
 ## v3.1.11 (FUTURE)
 ## v3.1.11 (FUTURE)
 
 
+### Enhancements
+
+* [#8974](https://github.com/netbox-community/netbox/issues/8974) - Use monospace font for text areas in config revision form
+
 ---
 ---
 
 
 ## v3.1.10 (2022-03-25)
 ## v3.1.10 (2022-03-25)

+ 3 - 0
netbox/extras/admin.py

@@ -23,15 +23,18 @@ class ConfigRevisionAdmin(admin.ModelAdmin):
         }),
         }),
         ('Banners', {
         ('Banners', {
             'fields': ('BANNER_LOGIN', 'BANNER_TOP', 'BANNER_BOTTOM'),
             'fields': ('BANNER_LOGIN', 'BANNER_TOP', 'BANNER_BOTTOM'),
+            'classes': ('monospace',),
         }),
         }),
         ('Pagination', {
         ('Pagination', {
             'fields': ('PAGINATE_COUNT', 'MAX_PAGE_SIZE'),
             'fields': ('PAGINATE_COUNT', 'MAX_PAGE_SIZE'),
         }),
         }),
         ('Validation', {
         ('Validation', {
             'fields': ('CUSTOM_VALIDATORS',),
             'fields': ('CUSTOM_VALIDATORS',),
+            'classes': ('monospace',),
         }),
         }),
         ('NAPALM', {
         ('NAPALM', {
             'fields': ('NAPALM_USERNAME', 'NAPALM_PASSWORD', 'NAPALM_TIMEOUT', 'NAPALM_ARGS'),
             'fields': ('NAPALM_USERNAME', 'NAPALM_PASSWORD', 'NAPALM_TIMEOUT', 'NAPALM_ARGS'),
+            'classes': ('monospace',),
         }),
         }),
         ('Miscellaneous', {
         ('Miscellaneous', {
             'fields': ('MAINTENANCE_MODE', 'GRAPHQL_ENABLED', 'CHANGELOG_RETENTION', 'MAPS_URL'),
             'fields': ('MAINTENANCE_MODE', 'GRAPHQL_ENABLED', 'CHANGELOG_RETENTION', 'MAPS_URL'),

+ 21 - 5
netbox/netbox/config/parameters.py

@@ -22,7 +22,9 @@ PARAMS = (
         default='',
         default='',
         description="Additional content to display on the login page",
         description="Additional content to display on the login page",
         field_kwargs={
         field_kwargs={
-            'widget': forms.Textarea(),
+            'widget': forms.Textarea(
+                attrs={'class': 'vLargeTextField'}
+            ),
         },
         },
     ),
     ),
     ConfigParam(
     ConfigParam(
@@ -31,7 +33,9 @@ PARAMS = (
         default='',
         default='',
         description="Additional content to display at the top of every page",
         description="Additional content to display at the top of every page",
         field_kwargs={
         field_kwargs={
-            'widget': forms.Textarea(),
+            'widget': forms.Textarea(
+                attrs={'class': 'vLargeTextField'}
+            ),
         },
         },
     ),
     ),
     ConfigParam(
     ConfigParam(
@@ -40,7 +44,9 @@ PARAMS = (
         default='',
         default='',
         description="Additional content to display at the bottom of every page",
         description="Additional content to display at the bottom of every page",
         field_kwargs={
         field_kwargs={
-            'widget': forms.Textarea(),
+            'widget': forms.Textarea(
+                attrs={'class': 'vLargeTextField'}
+            ),
         },
         },
     ),
     ),
 
 
@@ -109,7 +115,12 @@ PARAMS = (
         label='Custom validators',
         label='Custom validators',
         default={},
         default={},
         description="Custom validation rules (JSON)",
         description="Custom validation rules (JSON)",
-        field=forms.JSONField
+        field=forms.JSONField,
+        field_kwargs={
+            'widget': forms.Textarea(
+                attrs={'class': 'vLargeTextField'}
+            ),
+        },
     ),
     ),
 
 
     # NAPALM
     # NAPALM
@@ -137,7 +148,12 @@ PARAMS = (
         label='NAPALM arguments',
         label='NAPALM arguments',
         default={},
         default={},
         description="Additional arguments to pass when invoking a NAPALM driver (as JSON data)",
         description="Additional arguments to pass when invoking a NAPALM driver (as JSON data)",
-        field=forms.JSONField
+        field=forms.JSONField,
+        field_kwargs={
+            'widget': forms.Textarea(
+                attrs={'class': 'vLargeTextField'}
+            ),
+        },
     ),
     ),
 
 
     # Miscellaneous
     # Miscellaneous