From dbbcf49c1d175813d6a9ebdb7455673b2b59d32c Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Tue, 23 Jan 2024 10:30:23 -0500 Subject: [PATCH] Fix left padding of login button in top menu Clean up spacing for nav pills Markdown fields should default to using monospace font Wrap action buttons in object page header Fix page link style for non-HTMX paginators Clean up styling of Markdown preview widget Fix spacing around placeholder text for empty panel tables Remove obsolete templates Tweak checkbox input spacing Fix toggling of clear button for quick search Fix positioning of quick search filter dropdown Fix positioning of 'highlight device' button Fix styling for custom field group names Widen buttons on nav menu items Restyle the login page Fix active nav-pill background color in dark mode Fix spacing around 'map' button for sites --- netbox/dcim/views.py | 1 - netbox/project-static/dist/netbox.css | Bin 546301 -> 546441 bytes netbox/project-static/dist/netbox.js | Bin 456469 -> 456479 bytes netbox/project-static/dist/netbox.js.map | Bin 370578 -> 370582 bytes netbox/project-static/src/search.ts | 10 ++--- netbox/project-static/styles/_variables.scss | 3 ++ .../styles/custom/_markdown.scss | 38 +++++++++++++++++ .../project-static/styles/custom/_misc.scss | 30 ------------- netbox/project-static/styles/netbox.scss | 1 + .../circuits/circuittermination_edit.html | 2 +- netbox/templates/dcim/component_create.html | 9 ---- netbox/templates/dcim/device.html | 10 ++--- .../device/inc/interface_table_controls.html | 2 +- netbox/templates/dcim/devicebay_delete.html | 15 ------- .../dcim/inventoryitem_bulk_delete.html | 6 --- netbox/templates/dcim/inventoryitem_edit.html | 4 +- netbox/templates/dcim/site.html | 14 +++--- netbox/templates/generic/_base.html | 6 +-- netbox/templates/generic/object.html | 2 +- netbox/templates/inc/paginator.html | 2 +- netbox/templates/inc/panel_table.html | 12 +++--- .../templates/inc/panels/custom_fields.html | 18 ++++---- netbox/templates/inc/table_controls_htmx.html | 10 +++-- netbox/templates/inc/user_menu.html | 2 +- netbox/templates/ipam/ipaddress_edit.html | 2 +- netbox/templates/ipam/service_create.html | 4 +- netbox/templates/ipam/service_edit.html | 2 +- netbox/templates/ipam/vlan_edit.html | 2 +- netbox/templates/login.html | 31 ++++++++------ .../templates/vpn/l2vpntermination_edit.html | 4 +- netbox/utilities/forms/widgets/misc.py | 10 +++++ .../templates/form_helpers/render_field.html | 7 ++- .../utilities/templates/navigation/menu.html | 2 +- .../templates/widgets/markdown_input.html | 40 +++++++++--------- 34 files changed, 150 insertions(+), 151 deletions(-) create mode 100644 netbox/project-static/styles/custom/_markdown.scss delete mode 100644 netbox/templates/dcim/component_create.html delete mode 100644 netbox/templates/dcim/devicebay_delete.html delete mode 100644 netbox/templates/dcim/inventoryitem_bulk_delete.html diff --git a/netbox/dcim/views.py b/netbox/dcim/views.py index bbb399dd3..0129c218c 100644 --- a/netbox/dcim/views.py +++ b/netbox/dcim/views.py @@ -2956,7 +2956,6 @@ class InventoryItemBulkDeleteView(generic.BulkDeleteView): queryset = InventoryItem.objects.all() filterset = filtersets.InventoryItemFilterSet table = tables.InventoryItemTable - template_name = 'dcim/inventoryitem_bulk_delete.html' @register_model_view(InventoryItem, 'children') diff --git a/netbox/project-static/dist/netbox.css b/netbox/project-static/dist/netbox.css index 5fc874a091b256936aca5e453fa95671c8a3d8b3..194e7935183b33cf314c9a1da42ea8ae1b083edf 100644 GIT binary patch delta 122 zcmeynTCsDjV#5~3HTu)no?;Q0{-2Fekjc=r{eV6r5HkTWGZ3=?F)I+W0Wtgb1Nt02 z%G<96b0jcI<|Y6T}vq^FiB=oJ*DmSv`vS5Kdy$Ppxvo0+GZk(!yFQDS9e SU{Fvo-8-10Z@NV&$58+~)h%fN delta 66 zcmeBNtN3@dV#5~3HTu&(NHdDIU(ja+VkRJF24WT4!o&jspOXyBZz< diff --git a/netbox/project-static/dist/netbox.js b/netbox/project-static/dist/netbox.js index fcf2ddfa3a94dd6f1722307187bbfd0f634a9e75..5146f855fd1ee3b2acacb2adb6156e953f70313b 100644 GIT binary patch delta 73 zcmV-P0Ji^??i-)(8-RoXgaU*Ev;^Gumqb$n7?*wc1PlmYV{Bz%av~|0?DqsJ3uG;B fZ*FBGDLQ3om+|BR6PJAE1qg>u_yo63_yx!QNUa`c delta 90 zcmbRLPI~G)>4p}@7N!>FEi8Aw3zTH)6(km==9ReSq~-#t=^Q^;w1hJFEi8U))330xC{52|W06n|)(LfV4At>;bo2zWT+5tv+#MaE Zg8q(<{yO1~fmQ7**;ux(WMh4~004E_7efF5 delta 85 zcmbPsUTo5Nv4$4L7N!>FEi8U)Jc&B)j*gK!$&SwYPSX?ESTxkbbwV8-Lv=hI9X)k& iog7`OoIpyTqW+GK{yOxc~q`iy3qP diff --git a/netbox/project-static/src/search.ts b/netbox/project-static/src/search.ts index e3bdc18dc..8275b126e 100644 --- a/netbox/project-static/src/search.ts +++ b/netbox/project-static/src/search.ts @@ -7,12 +7,12 @@ import { isTruthy } from './util'; */ function quickSearchEventHandler(event: Event): void { const quicksearch = event.currentTarget as HTMLInputElement; - const inputgroup = quicksearch.parentElement as HTMLDivElement; - if (isTruthy(inputgroup)) { + const clearbtn = document.getElementById("quicksearch_clear") as HTMLAnchorElement; + if (isTruthy(clearbtn)) { if (quicksearch.value === "") { - inputgroup.classList.add("hide-last-child"); + clearbtn.classList.add("d-none"); } else { - inputgroup.classList.remove("hide-last-child"); + clearbtn.classList.remove("d-none"); } } } @@ -22,7 +22,7 @@ function quickSearchEventHandler(event: Event): void { */ export function initQuickSearch(): void { const quicksearch = document.getElementById("quicksearch") as HTMLInputElement; - const clearbtn = document.getElementById("quicksearch_clear") as HTMLButtonElement; + const clearbtn = document.getElementById("quicksearch_clear") as HTMLAnchorElement; if (isTruthy(quicksearch)) { quicksearch.addEventListener("keyup", quickSearchEventHandler, { passive: true diff --git a/netbox/project-static/styles/_variables.scss b/netbox/project-static/styles/_variables.scss index f2e2f9ed4..6ac3c4896 100644 --- a/netbox/project-static/styles/_variables.scss +++ b/netbox/project-static/styles/_variables.scss @@ -18,3 +18,6 @@ $table-cell-padding-y: 0.5rem; // Fix Tabler bug #1694 in 1.0.0-beta20 $hover-bg: rgba(var(--tblr-secondary-rgb), 0.08); + +// Ensure active nav-pill has a background color in dark mode +$nav-pills-link-active-bg: rgba(var(--tblr-secondary-rgb), 0.15); diff --git a/netbox/project-static/styles/custom/_markdown.scss b/netbox/project-static/styles/custom/_markdown.scss new file mode 100644 index 000000000..08de23581 --- /dev/null +++ b/netbox/project-static/styles/custom/_markdown.scss @@ -0,0 +1,38 @@ +// Rendered Markdown +.rendered-markdown { + + table { + width: 100%; + + // Apply a border + th { + border-bottom: 2px solid #dddddd; + padding: 8px; + } + td { + border-top: 1px solid #dddddd; + padding: 8px; + } + + // Map "align" attr of column headings + th[align="left"] { + text-align: left; + } + th[align="center"] { + text-align: center; + } + th[align="right"] { + text-align: right; + } + } + +} + +// Markdown preview +.markdown-widget { + .preview { + border: 1px solid $border-color; + border-radius: $border-radius; + min-height: 200px; + } +} diff --git a/netbox/project-static/styles/custom/_misc.scss b/netbox/project-static/styles/custom/_misc.scss index 42ea9a8c6..ebf66d547 100644 --- a/netbox/project-static/styles/custom/_misc.scss +++ b/netbox/project-static/styles/custom/_misc.scss @@ -10,36 +10,6 @@ span.color-label { border-radius: $border-radius; } -// Rendered Markdown -.rendered-markdown { - - table { - width: 100%; - - // Apply a border - th { - border-bottom: 2px solid #dddddd; - padding: 8px; - } - td { - border-top: 1px solid #dddddd; - padding: 8px; - } - - // Map "align" attr of column headings - th[align="left"] { - text-align: left; - } - th[align="center"] { - text-align: center; - } - th[align="right"] { - text-align: right; - } - } - -} - // Object hierarchy depth indicators .record-depth { display: inline; diff --git a/netbox/project-static/styles/netbox.scss b/netbox/project-static/styles/netbox.scss index f86c4433f..17c6d88c9 100644 --- a/netbox/project-static/styles/netbox.scss +++ b/netbox/project-static/styles/netbox.scss @@ -19,4 +19,5 @@ // Custom styling @import 'custom/code'; +@import 'custom/markdown'; @import 'custom/misc'; diff --git a/netbox/templates/circuits/circuittermination_edit.html b/netbox/templates/circuits/circuittermination_edit.html index 56c2eb6e4..18198cb72 100644 --- a/netbox/templates/circuits/circuittermination_edit.html +++ b/netbox/templates/circuits/circuittermination_edit.html @@ -15,7 +15,7 @@ {% with providernetwork_tab_active=form.initial.provider_network %}
-
{% if request.user.is_authenticated and table_modal %} diff --git a/netbox/templates/inc/user_menu.html b/netbox/templates/inc/user_menu.html index e5c560b11..5beca96dc 100644 --- a/netbox/templates/inc/user_menu.html +++ b/netbox/templates/inc/user_menu.html @@ -33,7 +33,7 @@
{% else %} -
+
{% trans "Log In" %} diff --git a/netbox/templates/ipam/ipaddress_edit.html b/netbox/templates/ipam/ipaddress_edit.html index 93045761f..d9157f5ef 100644 --- a/netbox/templates/ipam/ipaddress_edit.html +++ b/netbox/templates/ipam/ipaddress_edit.html @@ -36,7 +36,7 @@
-
{# SSO login #} {% if auth_backends %} -
or
+
{% trans "Or" context "Denotes an alternative option" %}
-
{% trans "Or use a single sign-on (SSO) provider" %}:
- {% for backend in auth_backends %} -
- {% if backend.icon_name %}{% endif %} - {{ backend.display_name }} -
- {% endfor %} +
+ {% for backend in auth_backends %} + + {% endfor %} +
{% endif %} diff --git a/netbox/templates/vpn/l2vpntermination_edit.html b/netbox/templates/vpn/l2vpntermination_edit.html index a4bc44d12..5ecae3055 100644 --- a/netbox/templates/vpn/l2vpntermination_edit.html +++ b/netbox/templates/vpn/l2vpntermination_edit.html @@ -9,9 +9,9 @@
{% trans "L2VPN Termination" %}
{% render_field form.l2vpn %} -
+
-
{# Render checkbox labels to the right of the field #} {% elif field|widget_type == 'checkboxinput' %} -
+
{{ field }} + {% if field.help_text %} + {{ field.help_text|safe }} + {% endif %}
{# Include a copy-to-clipboard button #} {% elif 'data-clipboard' in field.field.widget.attrs %} @@ -54,7 +57,7 @@ {% endif %} {# Help text #} - {% if field.help_text %} + {% if field.help_text and field|widget_type != 'checkboxinput' %} {{ field.help_text|safe }} {% endif %} diff --git a/netbox/utilities/templates/navigation/menu.html b/netbox/utilities/templates/navigation/menu.html index 6b9c52e7b..6e70edb33 100644 --- a/netbox/utilities/templates/navigation/menu.html +++ b/netbox/utilities/templates/navigation/menu.html @@ -28,7 +28,7 @@ {% if buttons %}
{% for button in buttons %} - + {% endfor %} diff --git a/netbox/utilities/templates/widgets/markdown_input.html b/netbox/utilities/templates/widgets/markdown_input.html index 6d69fe6dc..b56526344 100644 --- a/netbox/utilities/templates/widgets/markdown_input.html +++ b/netbox/utilities/templates/widgets/markdown_input.html @@ -1,23 +1,23 @@ {% load i18n %} -
- -
-
- {% include "django/forms/widgets/textarea.html" %} -
-
-
{% trans "Testing" %}
-
+
+ +
+
+ {% include "django/forms/widgets/textarea.html" %}
+
+
+
+