mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-22 20:12:00 -06:00
#11517: Standardize display of contact assignments
This commit is contained in:
parent
157bf89e89
commit
2669068429
@ -4,6 +4,7 @@
|
||||
|
||||
### Enhancements
|
||||
|
||||
* [#11517](https://github.com/netbox-community/netbox/issues/11517) - Standardize the inclusion of related objects across the entire UI
|
||||
* [#11584](https://github.com/netbox-community/netbox/issues/11584) - Add a list view for contact assignments
|
||||
* [#11254](https://github.com/netbox-community/netbox/issues/11254) - Introduce the `X-Request-ID` HTTP header to annotate the unique ID of each request for change logging
|
||||
* [#11440](https://github.com/netbox-community/netbox/issues/11440) - Add an `enabled` field for device type interfaces
|
||||
|
@ -67,19 +67,15 @@
|
||||
<th scope="row">Description</th>
|
||||
<td>{{ object.description|placeholder }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">Assignments</th>
|
||||
<td>{{ assignment_count }}</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
{% include 'inc/panels/comments.html' %}
|
||||
{% include 'inc/panels/tags.html' %}
|
||||
{% plugin_left_page object %}
|
||||
</div>
|
||||
<div class="col col-md-5">
|
||||
{% include 'inc/panels/comments.html' %}
|
||||
{% include 'inc/panels/custom_fields.html' %}
|
||||
{% include 'inc/panels/tags.html' %}
|
||||
{% plugin_right_page object %}
|
||||
</div>
|
||||
</div>
|
||||
@ -87,10 +83,10 @@
|
||||
<div class="col col-md-12">
|
||||
<div class="card">
|
||||
<h5 class="card-header">Assignments</h5>
|
||||
<div class="card-body table-responsive">
|
||||
{% render_table assignments_table 'inc/table.html' %}
|
||||
{% include 'inc/paginator.html' with paginator=assignments_table.paginator page=assignments_table.page %}
|
||||
</div>
|
||||
<div class="card-body htmx-container table-responsive"
|
||||
hx-get="{% url 'tenancy:contactassignment_list' %}?contact_id={{ object.pk }}"
|
||||
hx-trigger="load"
|
||||
></div>
|
||||
</div>
|
||||
{% plugin_full_width_page object %}
|
||||
</div>
|
||||
|
@ -22,12 +22,6 @@
|
||||
<th scope="row">Description</th>
|
||||
<td>{{ object.description|placeholder }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">Assignments</th>
|
||||
<td>
|
||||
{{ assignment_count }}
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
@ -35,19 +29,13 @@
|
||||
{% plugin_left_page object %}
|
||||
</div>
|
||||
<div class="col col-md-6">
|
||||
{% include 'inc/panels/related_objects.html' %}
|
||||
{% include 'inc/panels/custom_fields.html' %}
|
||||
{% plugin_right_page object %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mb-3">
|
||||
<div class="col col-md-12">
|
||||
<div class="card">
|
||||
<h5 class="card-header">Assigned Contacts</h5>
|
||||
<div class="card-body table-responsive">
|
||||
{% render_table contacts_table 'inc/table.html' %}
|
||||
{% include 'inc/paginator.html' with paginator=contacts_table.paginator page=contacts_table.page %}
|
||||
</div>
|
||||
</div>
|
||||
{% plugin_full_width_page object %}
|
||||
</div>
|
||||
</div>
|
||||
|
@ -255,16 +255,12 @@ class ContactRoleView(generic.ObjectView):
|
||||
queryset = ContactRole.objects.all()
|
||||
|
||||
def get_extra_context(self, request, instance):
|
||||
contact_assignments = ContactAssignment.objects.restrict(request.user, 'view').filter(
|
||||
role=instance
|
||||
related_models = (
|
||||
(ContactAssignment.objects.restrict(request.user, 'view').filter(role=instance), 'role_id'),
|
||||
)
|
||||
contacts_table = tables.ContactAssignmentTable(contact_assignments, user=request.user)
|
||||
contacts_table.columns.hide('role')
|
||||
contacts_table.configure(request)
|
||||
|
||||
return {
|
||||
'contacts_table': contacts_table,
|
||||
'assignment_count': ContactAssignment.objects.filter(role=instance).count(),
|
||||
'related_models': related_models,
|
||||
}
|
||||
|
||||
|
||||
@ -314,19 +310,6 @@ class ContactListView(generic.ObjectListView):
|
||||
class ContactView(generic.ObjectView):
|
||||
queryset = Contact.objects.all()
|
||||
|
||||
def get_extra_context(self, request, instance):
|
||||
contact_assignments = ContactAssignment.objects.restrict(request.user, 'view').filter(
|
||||
contact=instance
|
||||
)
|
||||
assignments_table = tables.ContactAssignmentTable(contact_assignments, user=request.user)
|
||||
assignments_table.columns.hide('contact')
|
||||
assignments_table.configure(request)
|
||||
|
||||
return {
|
||||
'assignments_table': assignments_table,
|
||||
'assignment_count': ContactAssignment.objects.filter(contact=instance).count(),
|
||||
}
|
||||
|
||||
|
||||
@register_model_view(Contact, 'edit')
|
||||
class ContactEditView(generic.ObjectEditView):
|
||||
|
Loading…
Reference in New Issue
Block a user