-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
1 parent
8a77ec7
commit 93edf74
Showing
2 changed files
with
38 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
74 changes: 33 additions & 41 deletions
74
netbox/templates/dcim/devicetype/component_templates.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,37 @@ | ||
{% extends 'dcim/devicetype/base.html' %} | ||
{% load render_table from django_tables2 %} | ||
{% extends 'generic/object_children.html' %} | ||
{% load helpers %} | ||
{% load i18n %} | ||
{% load perms %} | ||
|
||
{% block content %} | ||
{% if perms.dcim.change_devicetype %} | ||
<form method="post"> | ||
{% csrf_token %} | ||
<div class="card"> | ||
<h5 class="card-header">{{ title }}</h5> | ||
<div class="card-body htmx-container table-responsive" id="object_list"> | ||
{% include 'htmx/table.html' %} | ||
</div> | ||
<div class="card-footer noprint"> | ||
{% if table.rows %} | ||
<button type="submit" name="_edit" formaction="{% url table.Meta.model|viewname:"bulk_rename" %}?return_url={{ return_url }}" class="btn btn-sm btn-warning"> | ||
<span class="mdi mdi-pencil-outline" aria-hidden="true"></span> {% trans "Rename" %} | ||
</button> | ||
<button type="submit" name="_edit" formaction="{% url table.Meta.model|viewname:"bulk_edit" %}?return_url={{ return_url }}" class="btn btn-sm btn-warning"> | ||
<span class="mdi mdi-pencil" aria-hidden="true"></span> {% trans "Edit" %} | ||
</button> | ||
<button type="submit" name="_delete" formaction="{% url table.Meta.model|viewname:"bulk_delete" %}?return_url={{ return_url }}" class="btn btn-sm btn-danger"> | ||
<i class="mdi mdi-trash-can-outline" aria-hidden="true"></i> {% trans "Delete" %} | ||
</button> | ||
{% endif %} | ||
<div class="float-end"> | ||
<a href="{% url table.Meta.model|viewname:"add" %}?device_type={{ object.pk }}&return_url={{ return_url }}" class="btn btn-primary btn-sm"> | ||
<i class="mdi mdi-plus-thick" aria-hidden="true"></i> | ||
{% trans "Add" %} {{ title }} | ||
</a> | ||
</div> | ||
<div class="clearfix"></div> | ||
</div> | ||
{% block bulk_edit_controls %} | ||
{% with bulk_edit_view=child_model|validated_viewname:"bulk_edit" %} | ||
{% if 'bulk_edit' in actions and bulk_edit_view %} | ||
<button type="submit" name="_edit" | ||
formaction="{% url bulk_edit_view %}?device={{ object.pk }}&return_url={{ return_url }}" | ||
class="btn btn-warning btn-sm"> | ||
<i class="mdi mdi-pencil" aria-hidden="true"></i> Edit Selected | ||
</button> | ||
{% endif %} | ||
{% endwith %} | ||
{% with bulk_rename_view=child_model|validated_viewname:"bulk_rename" %} | ||
{% if 'bulk_rename' in actions and bulk_rename_view %} | ||
<button type="submit" name="_rename" | ||
formaction="{% url bulk_rename_view %}?return_url={{ return_url }}" | ||
class="btn btn-outline-warning btn-sm"> | ||
<i class="mdi mdi-pencil-outline" aria-hidden="true"></i> Rename | ||
</button> | ||
{% endif %} | ||
{% endwith %} | ||
{% endblock bulk_edit_controls %} | ||
|
||
{% block bulk_extra_controls %} | ||
{{ block.super }} | ||
{% if request.user|can_add:child_model %} | ||
<div class="bulk-button-group"> | ||
<a href="{% url table.Meta.model|viewname:"add" %}?device_type={{ object.pk }}&return_url={{ return_url }}" class="btn btn-primary btn-sm"> | ||
<i class="mdi mdi-plus-thick" aria-hidden="true"></i> | ||
{% trans "Add" %} {{ title }} | ||
</a> | ||
</div> | ||
</form> | ||
{% else %} | ||
<div class="card"> | ||
<h5 class="card-header">{{ title }}</h5> | ||
<div class="card-body htmx-container table-responsive" id="object_list"> | ||
{% include 'htmx/table.html' %} | ||
</div> | ||
</div> | ||
{% endif %} | ||
{% endblock content %} | ||
{% endif %} | ||
{% endblock bulk_extra_controls %} |