Skip to content

Commit 3203db0

Browse files
committed
UI cleanup
1 parent 94b8d36 commit 3203db0

File tree

5 files changed

+32
-9
lines changed

5 files changed

+32
-9
lines changed

netbox/extras/forms.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,10 @@ class Meta:
125125
('Custom Link', ('name', 'content_type', 'weight', 'group_name', 'button_class', 'new_window')),
126126
('Templates', ('link_text', 'link_url')),
127127
)
128+
widgets = {
129+
'link_text': forms.Textarea(attrs={'class': 'font-monospace'}),
130+
'link_url': forms.Textarea(attrs={'class': 'font-monospace'}),
131+
}
128132
help_texts = {
129133
'link_text': 'Jinja2 template code for the link text. Reference the object as <code>{{ obj }}</code>. '
130134
'Links which render as empty text will not be displayed.',
@@ -217,6 +221,9 @@ class Meta:
217221
('Template', ('template_code',)),
218222
('Rendering', ('mime_type', 'file_extension', 'as_attachment')),
219223
)
224+
widgets = {
225+
'template_code': forms.Textarea(attrs={'class': 'font-monospace'}),
226+
}
220227

221228

222229
class ExportTemplateCSVForm(CSVModelForm):
@@ -316,6 +323,10 @@ class Meta:
316323
)),
317324
('SSL', ('ssl_verification', 'ca_file_path')),
318325
)
326+
widgets = {
327+
'additional_headers': forms.Textarea(attrs={'class': 'font-monospace'}),
328+
'body_template': forms.Textarea(attrs={'class': 'font-monospace'}),
329+
}
319330

320331

321332
class WebhookCSVForm(CSVModelForm):

netbox/extras/models/models.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ class Webhook(ChangeLoggedModel):
9191
blank=True,
9292
help_text="User-supplied HTTP headers to be sent with the request in addition to the HTTP content type. "
9393
"Headers should be defined in the format <code>Name: Value</code>. Jinja2 template processing is "
94-
"support with the same context as the request body (below)."
94+
"supported with the same context as the request body (below)."
9595
)
9696
body_template = models.TextField(
9797
blank=True,
@@ -249,7 +249,8 @@ class ExportTemplate(ChangeLoggedModel):
249249
blank=True
250250
)
251251
template_code = models.TextField(
252-
help_text='The list of objects being exported is passed as a context variable named <code>queryset</code>.'
252+
help_text='Jinja2 template code. The list of objects being exported is passed as a context variable named '
253+
'<code>queryset</code>.'
253254
)
254255
mime_type = models.CharField(
255256
max_length=50,

netbox/extras/tables.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,18 @@ class WebhookTable(BaseTable):
103103
)
104104
content_types = ContentTypesColumn()
105105
enabled = BooleanColumn()
106-
type_create = BooleanColumn()
107-
type_update = BooleanColumn()
108-
type_delete = BooleanColumn()
106+
type_create = BooleanColumn(
107+
verbose_name='Create'
108+
)
109+
type_update = BooleanColumn(
110+
verbose_name='Update'
111+
)
112+
type_delete = BooleanColumn(
113+
verbose_name='Delete'
114+
)
115+
ssl_validation = BooleanColumn(
116+
verbose_name='SSL Validation'
117+
)
109118

110119
class Meta(BaseTable.Meta):
111120
model = Webhook

netbox/templates/extras/customlink.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@ <h5 class="card-header">
1111
</h5>
1212
<div class="card-body">
1313
<table class="table table-hover attr-table">
14-
<tr>
15-
<th scope="row">Content Type</th>
16-
<td>{{ object.content_type }}</td>
17-
</tr>
1814
<tr>
1915
<th scope="row">Name</th>
2016
<td>{{ object.name }}</td>
2117
</tr>
18+
<tr>
19+
<th scope="row">Content Type</th>
20+
<td>{{ object.content_type }}</td>
21+
</tr>
2222
<tr>
2323
<th scope="row">Group Name</th>
2424
<td>{{ object.group_name|placeholder }}</td>

netbox/templates/extras/exporttemplate.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
{% load helpers %}
33
{% load plugins %}
44

5+
{% block title %}{{ object.name }}{% endblock %}
6+
57
{% block breadcrumbs %}
68
{{ block.super }}
79
<li class="breadcrumb-item"><a href="{% url 'extras:exporttemplate_list' %}?content_type={{ object.content_type.pk }}">{{ object.content_type }}</a></li>

0 commit comments

Comments
 (0)