1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

UI cleanup

This commit is contained in:
jeremystretch
2021-08-26 14:48:24 -04:00
parent 94b8d36065
commit 3203db07b7
5 changed files with 32 additions and 9 deletions

View File

@ -125,6 +125,10 @@ class CustomLinkForm(BootstrapMixin, forms.ModelForm):
('Custom Link', ('name', 'content_type', 'weight', 'group_name', 'button_class', 'new_window')), ('Custom Link', ('name', 'content_type', 'weight', 'group_name', 'button_class', 'new_window')),
('Templates', ('link_text', 'link_url')), ('Templates', ('link_text', 'link_url')),
) )
widgets = {
'link_text': forms.Textarea(attrs={'class': 'font-monospace'}),
'link_url': forms.Textarea(attrs={'class': 'font-monospace'}),
}
help_texts = { help_texts = {
'link_text': 'Jinja2 template code for the link text. Reference the object as <code>{{ obj }}</code>. ' 'link_text': 'Jinja2 template code for the link text. Reference the object as <code>{{ obj }}</code>. '
'Links which render as empty text will not be displayed.', 'Links which render as empty text will not be displayed.',
@ -217,6 +221,9 @@ class ExportTemplateForm(BootstrapMixin, forms.ModelForm):
('Template', ('template_code',)), ('Template', ('template_code',)),
('Rendering', ('mime_type', 'file_extension', 'as_attachment')), ('Rendering', ('mime_type', 'file_extension', 'as_attachment')),
) )
widgets = {
'template_code': forms.Textarea(attrs={'class': 'font-monospace'}),
}
class ExportTemplateCSVForm(CSVModelForm): class ExportTemplateCSVForm(CSVModelForm):
@ -316,6 +323,10 @@ class WebhookForm(BootstrapMixin, forms.ModelForm):
)), )),
('SSL', ('ssl_verification', 'ca_file_path')), ('SSL', ('ssl_verification', 'ca_file_path')),
) )
widgets = {
'additional_headers': forms.Textarea(attrs={'class': 'font-monospace'}),
'body_template': forms.Textarea(attrs={'class': 'font-monospace'}),
}
class WebhookCSVForm(CSVModelForm): class WebhookCSVForm(CSVModelForm):

View File

@ -91,7 +91,7 @@ class Webhook(ChangeLoggedModel):
blank=True, blank=True,
help_text="User-supplied HTTP headers to be sent with the request in addition to the HTTP content type. " help_text="User-supplied HTTP headers to be sent with the request in addition to the HTTP content type. "
"Headers should be defined in the format <code>Name: Value</code>. Jinja2 template processing is " "Headers should be defined in the format <code>Name: Value</code>. Jinja2 template processing is "
"support with the same context as the request body (below)." "supported with the same context as the request body (below)."
) )
body_template = models.TextField( body_template = models.TextField(
blank=True, blank=True,
@ -249,7 +249,8 @@ class ExportTemplate(ChangeLoggedModel):
blank=True blank=True
) )
template_code = models.TextField( template_code = models.TextField(
help_text='The list of objects being exported is passed as a context variable named <code>queryset</code>.' help_text='Jinja2 template code. The list of objects being exported is passed as a context variable named '
'<code>queryset</code>.'
) )
mime_type = models.CharField( mime_type = models.CharField(
max_length=50, max_length=50,

View File

@ -103,9 +103,18 @@ class WebhookTable(BaseTable):
) )
content_types = ContentTypesColumn() content_types = ContentTypesColumn()
enabled = BooleanColumn() enabled = BooleanColumn()
type_create = BooleanColumn() type_create = BooleanColumn(
type_update = BooleanColumn() verbose_name='Create'
type_delete = BooleanColumn() )
type_update = BooleanColumn(
verbose_name='Update'
)
type_delete = BooleanColumn(
verbose_name='Delete'
)
ssl_validation = BooleanColumn(
verbose_name='SSL Validation'
)
class Meta(BaseTable.Meta): class Meta(BaseTable.Meta):
model = Webhook model = Webhook

View File

@ -11,14 +11,14 @@
</h5> </h5>
<div class="card-body"> <div class="card-body">
<table class="table table-hover attr-table"> <table class="table table-hover attr-table">
<tr>
<th scope="row">Content Type</th>
<td>{{ object.content_type }}</td>
</tr>
<tr> <tr>
<th scope="row">Name</th> <th scope="row">Name</th>
<td>{{ object.name }}</td> <td>{{ object.name }}</td>
</tr> </tr>
<tr>
<th scope="row">Content Type</th>
<td>{{ object.content_type }}</td>
</tr>
<tr> <tr>
<th scope="row">Group Name</th> <th scope="row">Group Name</th>
<td>{{ object.group_name|placeholder }}</td> <td>{{ object.group_name|placeholder }}</td>

View File

@ -2,6 +2,8 @@
{% load helpers %} {% load helpers %}
{% load plugins %} {% load plugins %}
{% block title %}{{ object.name }}{% endblock %}
{% block breadcrumbs %} {% block breadcrumbs %}
{{ block.super }} {{ block.super }}
<li class="breadcrumb-item"><a href="{% url 'extras:exporttemplate_list' %}?content_type={{ object.content_type.pk }}">{{ object.content_type }}</a></li> <li class="breadcrumb-item"><a href="{% url 'extras:exporttemplate_list' %}?content_type={{ object.content_type.pk }}">{{ object.content_type }}</a></li>