mirror of
https://github.com/netbox-community/netbox.git
synced 2025-08-18 05:28:16 -06:00
Refactor base templates to ensure consistent display of header content
This commit is contained in:
parent
8eed94ccd9
commit
d8a665db39
@ -3353,6 +3353,7 @@ class VirtualChassisEditView(ObjectPermissionRequiredMixin, GetReturnURLMixin, V
|
||||
formset = VCMemberFormSet(queryset=members_queryset)
|
||||
|
||||
return render(request, 'dcim/virtualchassis_edit.html', {
|
||||
'object': virtual_chassis,
|
||||
'vc_form': vc_form,
|
||||
'formset': formset,
|
||||
'return_url': self.get_return_url(request, virtual_chassis),
|
||||
|
@ -1,4 +1,4 @@
|
||||
{% extends 'base/layout.html' %}
|
||||
{% extends 'generic/_base.html' %}
|
||||
{% load i18n %}
|
||||
|
||||
{% block tabs %}
|
||||
|
@ -116,15 +116,15 @@ Blocks:
|
||||
<div class="page-wrapper">
|
||||
|
||||
{# Page header #}
|
||||
<div class="page-header m-0">
|
||||
{% block header %}
|
||||
|
||||
{# Banners #}
|
||||
{# Top banner #}
|
||||
{% if config.BANNER_TOP %}
|
||||
<div class="text-center mx-3 mb-2">
|
||||
{{ config.BANNER_TOP|safe }}
|
||||
</div>
|
||||
{% include 'inc/banner.html' with content=config.BANNER_TOP %}
|
||||
{% endif %}
|
||||
{# /Top banner #}
|
||||
|
||||
{# Alerts #}
|
||||
{% if settings.DEBUG and not settings.DEVELOPER %}
|
||||
{% include 'inc/alerts/warning.html' with title="Debug mode is enabled" message="Performance may be limited. Debugging should never be enabled on a production system." %}
|
||||
{% endif %}
|
||||
@ -132,57 +132,31 @@ Blocks:
|
||||
{% if config.MAINTENANCE_MODE and config.BANNER_MAINTENANCE %}
|
||||
{% include 'inc/alerts/warning.html' with title="Maintenance Mode" message=config.BANNER_MAINTENANCE|escape %}
|
||||
{% endif %}
|
||||
{# /Banners #}
|
||||
|
||||
{% block header %}
|
||||
<div class="container-xl mt-2 d-print-none">
|
||||
<div class="row align-items-center">
|
||||
|
||||
{# Title #}
|
||||
<div class="col">
|
||||
<h2 class="page-title mb-1">{% block title %}{% endblock title %}</h2>
|
||||
{% block subtitle %}{% endblock %}
|
||||
</div>
|
||||
|
||||
{# Controls #}
|
||||
<div class="col-auto d-print-none">
|
||||
{% block controls %}{% endblock controls %}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{# Tabs #}
|
||||
<div class="page-tabs mt-3">
|
||||
{% block tabs %}{% endblock %}
|
||||
</div>
|
||||
{# /Alerts #}
|
||||
|
||||
{% endblock header %}
|
||||
</div>
|
||||
{# /Page header #}
|
||||
|
||||
{# Page body #}
|
||||
{% block page %}
|
||||
<div class="page-body">
|
||||
<div class="page-body my-1">
|
||||
<div class="container-xl tab-content py-3">
|
||||
|
||||
{# Page content #}
|
||||
{% block content %}{% endblock %}
|
||||
{# /Page content #}
|
||||
|
||||
{# Bottom banner #}
|
||||
{% if config.BANNER_BOTTOM %}
|
||||
<div class="text-center mx-3 mt-2">
|
||||
{{ config.BANNER_BOTTOM|safe }}
|
||||
</div>
|
||||
{% endif %}
|
||||
{# /Bottom banner #}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
{% endblock page %}
|
||||
{# /Page body #}
|
||||
|
||||
{# Bottom banner #}
|
||||
{% if config.BANNER_BOTTOM %}
|
||||
{% include 'inc/banner.html' with content=config.BANNER_BOTTOM %}
|
||||
{% endif %}
|
||||
{# /Bottom banner #}
|
||||
|
||||
{# Page footer #}
|
||||
<footer class="footer footer-transparent d-print-none py-2">
|
||||
<div class="container-xl d-flex justify-content-between align-items-center">
|
||||
|
@ -1,4 +1,4 @@
|
||||
{% extends 'base/layout.html' %}
|
||||
{% extends 'generic/object.html' %}
|
||||
{% load helpers %}
|
||||
{% load buttons %}
|
||||
{% load perms %}
|
||||
@ -13,20 +13,6 @@
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block header %}
|
||||
<div class="row noprint">
|
||||
<div class="col col-md-12">
|
||||
<nav class="breadcrumb-container px-3" aria-label="breadcrumb">
|
||||
<ol class="breadcrumb">
|
||||
<li class="breadcrumb-item"><a href="{% url 'core:configrevision_list' %}">{% trans "Config revisions" %}</a></li>
|
||||
<li class="breadcrumb-item"><a href="{% url 'core:configrevision' pk=object.pk %}">{{ object }}</a></li>
|
||||
</ol>
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
{{ block.super }}
|
||||
{% endblock header %}
|
||||
|
||||
{% block controls %}
|
||||
<div class="controls">
|
||||
<div class="control-group">
|
||||
@ -76,8 +62,8 @@
|
||||
<div class="submit-row" style="margin-top: 20px">
|
||||
<div class="controls">
|
||||
<div class="control-group">
|
||||
<button type="submit" name="restore" class="btn btn-primary">{% trans "Restore" %}</button>
|
||||
<a href="{% url 'core:configrevision_list' %}" id="cancel" name="cancel" class="btn btn-outline-secondary">{% trans "Cancel" %}</a>
|
||||
<button type="submit" name="restore" class="btn btn-primary">{% trans "Restore" %}</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -1,4 +1,4 @@
|
||||
{% extends 'base/layout.html' %}
|
||||
{% extends 'generic/object_edit.html' %}
|
||||
{% load helpers %}
|
||||
{% load form_helpers %}
|
||||
{% load i18n %}
|
||||
|
@ -1,4 +1,4 @@
|
||||
{% extends 'base/layout.html' %}
|
||||
{% extends 'generic/_base.html' %}
|
||||
{% load buttons %}
|
||||
{% load helpers %}
|
||||
{% load perms %}
|
||||
|
@ -1,4 +1,4 @@
|
||||
{% extends 'base/layout.html' %}
|
||||
{% extends 'generic/_base.html' %}
|
||||
{% load buttons %}
|
||||
{% load helpers %}
|
||||
{% load i18n %}
|
||||
|
@ -1,4 +1,4 @@
|
||||
{% extends 'base/layout.html' %}
|
||||
{% extends 'generic/_base.html' %}
|
||||
{% load helpers %}
|
||||
{% load buttons %}
|
||||
{% load perms %}
|
||||
|
32
netbox/templates/generic/_base.html
Normal file
32
netbox/templates/generic/_base.html
Normal file
@ -0,0 +1,32 @@
|
||||
{% extends 'base/layout.html' %}
|
||||
|
||||
{% block header %}
|
||||
<div class="page-header m-0">
|
||||
{{ block.super }}
|
||||
|
||||
{% block page-header %}
|
||||
<div class="container-xl mt-2 d-print-none">
|
||||
<div class="row align-items-center">
|
||||
|
||||
{# Title #}
|
||||
<div class="col">
|
||||
<h2 class="page-title mb-1">{% block title %}{% endblock title %}</h2>
|
||||
{% block subtitle %}{% endblock %}
|
||||
</div>
|
||||
|
||||
{# Controls #}
|
||||
<div class="col-auto d-print-none">
|
||||
{% block controls %}{% endblock controls %}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{# Tabs #}
|
||||
<div class="page-tabs mt-3">
|
||||
{% block tabs %}{% endblock %}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
{% endblock header %}
|
@ -1,4 +1,4 @@
|
||||
{% extends 'base/layout.html' %}
|
||||
{% extends 'generic/_base.html' %}
|
||||
{% load helpers %}
|
||||
{% load form_helpers %}
|
||||
{% load render_table from django_tables2 %}
|
||||
|
@ -1,4 +1,4 @@
|
||||
{% extends 'base/layout.html' %}
|
||||
{% extends 'generic/_base.html' %}
|
||||
{% load helpers %}
|
||||
{% load render_table from django_tables2 %}
|
||||
{% load i18n %}
|
||||
|
@ -1,4 +1,4 @@
|
||||
{% extends 'base/layout.html' %}
|
||||
{% extends 'generic/_base.html' %}
|
||||
{% load helpers %}
|
||||
{% load form_helpers %}
|
||||
{% load render_table from django_tables2 %}
|
||||
|
@ -1,4 +1,4 @@
|
||||
{% extends 'base/layout.html' %}
|
||||
{% extends 'generic/_base.html' %}
|
||||
{% load helpers %}
|
||||
{% load form_helpers %}
|
||||
{% load i18n %}
|
||||
|
@ -1,4 +1,4 @@
|
||||
{% extends 'base/layout.html' %}
|
||||
{% extends 'generic/_base.html' %}
|
||||
{% load helpers %}
|
||||
{% load render_table from django_tables2 %}
|
||||
{% load i18n %}
|
||||
@ -7,7 +7,18 @@
|
||||
{% trans "Remove" %} {{ table.rows|length }} {{ obj_type_plural|bettertitle }}?
|
||||
{% endblock %}
|
||||
|
||||
{% block tabs %}
|
||||
<ul class="nav nav-tabs px-3">
|
||||
<li class="nav-item" role="presentation">
|
||||
<button class="nav-link active" type="button" role="tab" aria-controls="edit-form" aria-selected="true">
|
||||
{% trans "Bulk Remove" %}
|
||||
</button>
|
||||
</li>
|
||||
</ul>
|
||||
{% endblock tabs %}
|
||||
|
||||
{% block content %}
|
||||
<div class="tab-pane show active" role="tabpanel">
|
||||
<div class="alert alert-danger bg-danger-subtle" role="alert">
|
||||
<div class="d-flex">
|
||||
<div>
|
||||
@ -35,10 +46,11 @@
|
||||
<a href="{{ return_url }}" class="btn btn-outline-secondary">{% trans "Cancel" %}</a>
|
||||
<button type="submit" name="_confirm" class="btn btn-danger">
|
||||
{% blocktrans trimmed with count=table.rows|length %}
|
||||
Delete these {{ count }} {{ obj_type_plural }}
|
||||
Remove these {{ count }} {{ obj_type_plural }}
|
||||
{% endblocktrans %}
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock content %}
|
||||
|
@ -1,4 +1,4 @@
|
||||
{% extends 'base/layout.html' %}
|
||||
{% extends 'generic/_base.html' %}
|
||||
{% load helpers %}
|
||||
{% load form_helpers %}
|
||||
{% load i18n %}
|
||||
@ -7,6 +7,16 @@
|
||||
{% trans "Renaming" %} {{ selected_objects|length }} {{ obj_type_plural|bettertitle }}
|
||||
{% endblock %}
|
||||
|
||||
{% block tabs %}
|
||||
<ul class="nav nav-tabs px-3">
|
||||
<li class="nav-item" role="presentation">
|
||||
<button class="nav-link active" type="button" role="tab" aria-controls="edit-form" aria-selected="true">
|
||||
{% trans "Bulk Rename" %}
|
||||
</button>
|
||||
</li>
|
||||
</ul>
|
||||
{% endblock tabs %}
|
||||
|
||||
{% block content %}
|
||||
<div class="row mb-3">
|
||||
<div class="col col-md-7">
|
||||
|
@ -1,4 +1,4 @@
|
||||
{% extends 'base/layout.html' %}
|
||||
{% extends 'generic/_base.html' %}
|
||||
{% load form_helpers %}
|
||||
{% load i18n %}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
{% extends 'base/layout.html' %}
|
||||
{% extends 'generic/_base.html' %}
|
||||
{% load buttons %}
|
||||
{% load custom_links %}
|
||||
{% load helpers %}
|
||||
@ -18,7 +18,7 @@ Context:
|
||||
object: The object instance being viewed
|
||||
{% endcomment %}
|
||||
|
||||
{% block header %}
|
||||
{% block page-header %}
|
||||
<div class="d-flex justify-content-between align-items-center mx-3 my-2">
|
||||
|
||||
{# Breadcrumbs #}
|
||||
@ -40,7 +40,7 @@ Context:
|
||||
|
||||
</div>
|
||||
{{ block.super }}
|
||||
{% endblock header %}
|
||||
{% endblock page-header %}
|
||||
|
||||
{% block title %}{{ object }}{% endblock %}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
{% extends 'base/layout.html' %}
|
||||
{% extends 'generic/_base.html' %}
|
||||
{% load helpers %}
|
||||
{% load form_helpers %}
|
||||
{% load i18n %}
|
||||
@ -15,8 +15,6 @@ Context:
|
||||
{% trans "Delete" %} {{ object|meta:"verbose_name" }}?
|
||||
{% endblock %}
|
||||
|
||||
{% block header %}{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="modal" tabindex="-1" style="display: block; position: static">
|
||||
<div class="modal-dialog">
|
||||
|
@ -1,4 +1,4 @@
|
||||
{% extends 'base/layout.html' %}
|
||||
{% extends 'generic/_base.html' %}
|
||||
{% load i18n %}
|
||||
|
||||
{% comment %}
|
||||
|
@ -1,4 +1,4 @@
|
||||
{% extends 'base/layout.html' %}
|
||||
{% extends 'generic/_base.html' %}
|
||||
{% load buttons %}
|
||||
{% load helpers %}
|
||||
{% load plugins %}
|
||||
|
@ -4,6 +4,7 @@
|
||||
{% load i18n %}
|
||||
|
||||
{% block header %}
|
||||
{{ block.super }}
|
||||
{% if new_release %}
|
||||
<div class="alert alert-info bg-info-subtle mx-3" role="alert">
|
||||
<div class="d-flex">
|
||||
|
@ -1,6 +1,6 @@
|
||||
{% load i18n %}
|
||||
|
||||
<div class="alert alert-danger bg-danger-subtle mx-3" role="alert">
|
||||
<div class="alert alert-danger bg-danger-subtle mx-3 my-2" role="alert">
|
||||
<div class="d-flex">
|
||||
<div>
|
||||
<i class="mdi mdi-alert-octagon p-2"></i>
|
||||
|
@ -1,6 +1,6 @@
|
||||
{% load i18n %}
|
||||
|
||||
<div class="alert alert-info bg-info-subtle mx-3" role="alert">
|
||||
<div class="alert alert-info bg-info-subtle mx-3 my-2" role="alert">
|
||||
<div class="d-flex">
|
||||
<div>
|
||||
<i class="mdi mdi-information-outline p-2"></i>
|
||||
|
@ -1,6 +1,6 @@
|
||||
{% load i18n %}
|
||||
|
||||
<div class="alert alert-success bg-success-subtle mx-3" role="alert">
|
||||
<div class="alert alert-success bg-success-subtle mx-3 my-2" role="alert">
|
||||
<div class="d-flex">
|
||||
<div>
|
||||
<i class="mdi mdi-check-bold p-2"></i>
|
||||
|
@ -1,6 +1,6 @@
|
||||
{% load i18n %}
|
||||
|
||||
<div class="alert alert-warning bg-warning-subtle mx-3" role="alert">
|
||||
<div class="alert alert-warning bg-warning-subtle mx-3 my-2" role="alert">
|
||||
<div class="d-flex">
|
||||
<div>
|
||||
<i class="mdi mdi-alert p-2"></i>
|
||||
|
4
netbox/templates/inc/banner.html
Normal file
4
netbox/templates/inc/banner.html
Normal file
@ -0,0 +1,4 @@
|
||||
{# Display top or bottom banner content #}
|
||||
<div class="text-center mx-3 m-2">
|
||||
{{ content|safe }}
|
||||
</div>
|
Loading…
Reference in New Issue
Block a user