Fix tab styling

This commit is contained in:
Jeremy Stretch 2024-01-08 17:10:09 -05:00
parent dab4302da0
commit 6439a91f11
7 changed files with 62 additions and 26 deletions

Binary file not shown.

View File

@ -9,4 +9,6 @@
// Transitional styling to ease migration of templates from NetBox v3.x // Transitional styling to ease migration of templates from NetBox v3.x
@import 'transitional/cards'; @import 'transitional/cards';
@import 'transitional/layout';
@import 'transitional/tables'; @import 'transitional/tables';
@import 'transitional/tabs';

View File

@ -0,0 +1,8 @@
// Tweak layout section colors
.page {
background-color: var(--#{$prefix}bg-surface-secondary);
}
.page-header {
background-color: var(--#{$prefix}bg-surface);
min-height: 0;
}

View File

@ -0,0 +1,21 @@
// In-page content tabs
.page-tabs {
.nav-tabs {
position: relative;
.nav-link {
&.active,
&:active,
&:hover {
border-color: $card-border-color;
border-bottom-color: transparent;
}
&.active {
color: $headings-color;
background: var(--#{$prefix}bg-surface-secondary);
border-bottom-color: transparent;
}
}
}
}

View File

@ -116,7 +116,9 @@ Blocks:
<div class="page-wrapper"> <div class="page-wrapper">
{# Page header #} {# Page header #}
<div class="container-xl mt-2 d-print-none"> <div class="page-header m-0">
{# Banners #}
{% if config.BANNER_TOP %} {% if config.BANNER_TOP %}
<div class="text-center mx-3 mb-2"> <div class="text-center mx-3 mb-2">
{{ config.BANNER_TOP|safe }} {{ config.BANNER_TOP|safe }}
@ -140,30 +142,39 @@ Blocks:
</div> </div>
</div> </div>
{% endif %} {% endif %}
{# /Banners #}
{% block header %} {% block header %}
<div class="row align-items-center"> <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>
{# Title #}
<div class="col">
<h2 class="page-title mb-1">{% block title %}{% endblock title %}</h2>
{% block subtitle %}{% endblock %}
</div> </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>
{% endblock header %} {% endblock header %}
</div> </div>
{# /Page header #} {# /Page header #}
{# Page body #} {# Page body #}
<div class="page-body"> <div class="page-body">
<div class="container-xl"> <div class="container-xl tab-content py-3">
{% block tabs %}{% endblock %}
{# TODO: Remove content-wrapper block #} {# TODO: Remove content-wrapper block #}
{% block content-wrapper %} {% block content-wrapper %}
{% block content %}{% endblock %} {% block content %}{% endblock %}

View File

@ -19,7 +19,7 @@ Context:
{% endcomment %} {% endcomment %}
{% block header %} {% block header %}
<div class="d-flex justify-content-between align-items-center mb-2"> <div class="d-flex justify-content-between align-items-center mx-3 my-2">
{# Breadcrumbs #} {# Breadcrumbs #}
<ol class="breadcrumb" aria-label="breadcrumbs"> <ol class="breadcrumb" aria-label="breadcrumbs">
@ -80,7 +80,7 @@ Context:
{% endblock controls %} {% endblock controls %}
{% block tabs %} {% block tabs %}
<ul class="nav nav-tabs mb-2 px-3"> <ul class="nav nav-tabs px-3">
{# Primary tab #} {# Primary tab #}
<li class="nav-item" role="presentation"> <li class="nav-item" role="presentation">
<a class="nav-link{% if not tab %} active{% endif %}" href="{{ object.get_absolute_url }}">{{ object|meta:"verbose_name"|bettertitle }}</a> <a class="nav-link{% if not tab %} active{% endif %}" href="{{ object.get_absolute_url }}">{{ object|meta:"verbose_name"|bettertitle }}</a>
@ -91,11 +91,7 @@ Context:
</ul> </ul>
{% endblock tabs %} {% endblock tabs %}
{% block content-wrapper %} {% block content %}{% endblock %}
<div class="tab-content">
{% block content %}{% endblock %}
</div>
{% endblock content-wrapper %}
{% block modals %} {% block modals %}
{% include 'inc/htmx_modal.html' %} {% include 'inc/htmx_modal.html' %}

View File

@ -40,7 +40,7 @@ Context:
{% endblock controls %} {% endblock controls %}
{% block tabs %} {% block tabs %}
<ul class="nav nav-tabs page-header-tabs px-3 mb-2" role="tablist"> <ul class="nav nav-tabs px-3" role="tablist">
<li class="nav-item" role="presentation"> <li class="nav-item" role="presentation">
<a class="nav-link active" id="object-list-tab" data-bs-toggle="tab" data-bs-target="#object-list" type="button" role="tab" aria-controls="edit-form" aria-selected="true"> <a class="nav-link active" id="object-list-tab" data-bs-toggle="tab" data-bs-target="#object-list" type="button" role="tab" aria-controls="edit-form" aria-selected="true">
{% trans "Results" %} {% badge table.page.paginator.count %} {% trans "Results" %} {% badge table.page.paginator.count %}
@ -57,8 +57,7 @@ Context:
</ul> </ul>
{% endblock tabs %} {% endblock tabs %}
{% block content-wrapper %} {% block content %}
<div class="tab-content">
{# Object list #} {# Object list #}
<div class="tab-pane show active" id="object-list" role="tabpanel" aria-labelledby="object-list-tab"> <div class="tab-pane show active" id="object-list" role="tabpanel" aria-labelledby="object-list-tab">
@ -137,9 +136,8 @@ Context:
{% include 'inc/filter_list.html' %} {% include 'inc/filter_list.html' %}
</div> </div>
{% endif %} {% endif %}
</div>
{% endblock content-wrapper %} {% endblock content %}
{% block modals %} {% block modals %}
{% table_config_form table table_name="ObjectTable" %} {% table_config_form table table_name="ObjectTable" %}