* Fix left padding of login button in top menu * Relocate "add" buttons for embedded object tables * Remove unused data template block & getNetboxData() utility function * Remove bottom margin from last <p> element in rendered Markdown inside a table cell * Prevent TomSelect from initializing on <select> elements with a size * Fix styling of dropdown menu button for circuit commit rate * Change .color-block to display: inline-block * Delete unused static asset * Improve contrast between menu group headings & items * Remove custom color for attr-table row headings * Fix border color of copy-to-clipboard button * Fix toast text color in dark mode * Fix rack elevation label/image toggles * Increase border radius for small buttons * Fix object selector
This commit is contained in:
parent
c6a3fc2407
commit
239d21870b
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Binary file not shown.
|
Before Width: | Height: | Size: 109 B |
|
|
@ -18,11 +18,12 @@ function handleSelection(link: HTMLAnchorElement): void {
|
|||
const value = link.getAttribute('data-value');
|
||||
|
||||
//@ts-ignore
|
||||
target.slim.setData([
|
||||
{text: label, value: value}
|
||||
]);
|
||||
const change = new Event('change');
|
||||
target.dispatchEvent(change);
|
||||
target.tomselect.addOption({
|
||||
id: value,
|
||||
display: label,
|
||||
});
|
||||
//@ts-ignore
|
||||
target.tomselect.addItem(value);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ function renderItem(data: TomOption, escape: typeof escape_html) {
|
|||
|
||||
// Initialize <select> elements which are populated via a REST API call
|
||||
export function initDynamicSelects(): void {
|
||||
for (const select of getElements<HTMLSelectElement>('select.api-select')) {
|
||||
for (const select of getElements<HTMLSelectElement>('select.api-select:not(.tomselected)')) {
|
||||
new DynamicTomSelect(select, {
|
||||
...config,
|
||||
valueField: VALUE_FIELD,
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ import { getElements } from '../util';
|
|||
// Initialize <select> elements with statically-defined options
|
||||
export function initStaticSelects(): void {
|
||||
for (const select of getElements<HTMLSelectElement>(
|
||||
'select:not(.api-select):not(.color-select)',
|
||||
'select:not(.tomselected):not(.no-ts):not([size]):not(.api-select):not(.color-select)',
|
||||
)) {
|
||||
new TomSelect(select, {
|
||||
...config,
|
||||
|
|
@ -24,7 +24,7 @@ export function initColorSelects(): void {
|
|||
)}"></span> ${escape(item.text)}</div>`;
|
||||
}
|
||||
|
||||
for (const select of getElements<HTMLSelectElement>('select.color-select')) {
|
||||
for (const select of getElements<HTMLSelectElement>('select.color-select:not(.tomselected)')) {
|
||||
new TomSelect(select, {
|
||||
...config,
|
||||
maxOptions: undefined,
|
||||
|
|
|
|||
|
|
@ -244,29 +244,6 @@ export function getSelectedOptions<E extends HTMLElement>(
|
|||
return selected;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get data that can only be accessed via Django context, and is thus already rendered in the HTML
|
||||
* template.
|
||||
*
|
||||
* @see Templates requiring Django context data have a `{% block data %}` block.
|
||||
*
|
||||
* @param key Property name, which must exist on the HTML element. If not already prefixed with
|
||||
* `data-`, `data-` will be prepended to the property.
|
||||
* @returns Value if it exists, `null` if not.
|
||||
*/
|
||||
export function getNetboxData(key: string): string | null {
|
||||
if (!key.startsWith('data-')) {
|
||||
key = `data-${key}`;
|
||||
}
|
||||
for (const element of getElements('body > div#netbox-data > *')) {
|
||||
const value = element.getAttribute(key);
|
||||
if (isTruthy(value)) {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Toggle visibility of an element.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -28,6 +28,13 @@
|
|||
|
||||
}
|
||||
|
||||
// Remove the bottom margin of <p> elements inside a table cell
|
||||
td > .rendered-markdown {
|
||||
p:last-of-type {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Markdown preview
|
||||
.markdown-widget {
|
||||
.preview {
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
// Color labels
|
||||
span.color-label {
|
||||
display: block;
|
||||
display: inline-block;
|
||||
width: 5rem;
|
||||
height: 1rem;
|
||||
padding: $badge-padding-y $badge-padding-x;
|
||||
|
|
|
|||
|
|
@ -9,6 +9,10 @@ pre {
|
|||
// Tabler sets display: flex
|
||||
display: inline-block;
|
||||
}
|
||||
.btn-sm {
|
||||
// $border-radius-sm (2px) is too small
|
||||
border-radius: $border-radius;
|
||||
}
|
||||
|
||||
// Tabs
|
||||
.nav-tabs {
|
||||
|
|
|
|||
|
|
@ -23,7 +23,6 @@ table.attr-table {
|
|||
|
||||
// Restyle row header
|
||||
th {
|
||||
color: $gray-700;
|
||||
font-weight: normal;
|
||||
width: min-content;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -70,10 +70,5 @@
|
|||
{# User messages #}
|
||||
{% include 'inc/messages.html' %}
|
||||
|
||||
{# Data container #}
|
||||
<div id="netbox-data" style="display: none!important; visibility: hidden!important">
|
||||
{% block data %}{% endblock %}
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -163,7 +163,7 @@
|
|||
</div>
|
||||
<div class="col col-12 col-xl-7">
|
||||
<div class="text-end mb-4">
|
||||
<select class="btn btn-outline-dark rack-view">
|
||||
<select class="btn btn-outline-secondary no-ts rack-view">
|
||||
<option value="images-and-labels" selected="selected">{% trans "Images and Labels" %}</option>
|
||||
<option value="images-only">{% trans "Images only" %}</option>
|
||||
<option value="labels-only">{% trans "Labels only" %}</option>
|
||||
|
|
|
|||
|
|
@ -11,13 +11,11 @@
|
|||
<a href="{% url 'dcim:rack_list' %}{% querystring request %}" class="btn btn-primary">
|
||||
<i class="mdi mdi-format-list-checkbox"></i> {% trans "View List" %}
|
||||
</a>
|
||||
<div class="btn-group" role="group">
|
||||
<select class="btn btn-outline-secondary rack-view">
|
||||
<option value="images-and-labels" selected="selected">{% trans "Images and Labels" %}</option>
|
||||
<option value="images-only">{% trans "Images only" %}</option>
|
||||
<option value="labels-only">{% trans "Labels only" %}</option>
|
||||
</select>
|
||||
</div>
|
||||
<select class="btn btn-outline-secondary no-ts rack-view">
|
||||
<option value="images-and-labels" selected="selected">{% trans "Images and Labels" %}</option>
|
||||
<option value="images-only">{% trans "Images only" %}</option>
|
||||
<option value="labels-only">{% trans "Labels only" %}</option>
|
||||
</select>
|
||||
<div class="btn-group" role="group">
|
||||
<a href="{% url 'dcim:rack_elevation_list' %}{% querystring request face='front' %}" class="btn btn-outline-secondary{% if rack_face == 'front' %} active{% endif %}">{% trans "Front" %}</a>
|
||||
<a href="{% url 'dcim:rack_elevation_list' %}{% querystring request face='rear' %}" class="btn btn-outline-secondary{% if rack_face == 'rear' %} active{% endif %}">{% trans "Rear" %}</a>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{% load helpers %}
|
||||
|
||||
<div class="toast shadow-sm" role="alert" aria-live="assertive" aria-atomic="true" data-bs-delay="10000">
|
||||
<div class="toast toast-dark border-0 shadow-sm" role="alert" aria-live="assertive" aria-atomic="true" data-bs-delay="10000">
|
||||
<div class="toast-header text-bg-{{ status }}">
|
||||
<i class="mdi mdi-{{ status|icon_from_status }} me-1"></i>
|
||||
{{ title }}
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@
|
|||
{% elif 'data-clipboard' in field.field.widget.attrs %}
|
||||
<div class="input-group">
|
||||
{{ field }}
|
||||
<button type="button" title="{% trans "Copy to clipboard" %}" class="btn btn-outline-dark copy-content" data-clipboard-target="#{{ field.id_for_label }}">
|
||||
<button type="button" title="{% trans "Copy to clipboard" %}" class="btn copy-content" data-clipboard-target="#{{ field.id_for_label }}">
|
||||
<i class="mdi mdi-content-copy"></i>
|
||||
</button>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
<div class="dropdown-menu-columns">
|
||||
<div class="dropdown-menu-column pb-2">
|
||||
{% for group, items in groups %}
|
||||
<div class="text-uppercase fw-bold fs-5 ps-3 pt-3 pb-1">
|
||||
<div class="text-uppercase text-secondary fw-bold fs-5 ps-3 pt-3 pb-1">
|
||||
{{ group.label }}
|
||||
</div>
|
||||
{% for item, buttons in items %}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
<div class="input-group">
|
||||
{% include 'django/forms/widgets/number.html' %}
|
||||
<button type="button" class="btn btn-outline-dark dropdown-toggle" data-bs-toggle="dropdown"></button>
|
||||
<button type="button" class="btn" data-bs-toggle="dropdown">
|
||||
<i class="mdi mdi-chevron-down"></i>
|
||||
</button>
|
||||
<ul class="dropdown-menu dropdown-menu-end">
|
||||
{% for value, label in widget.options %}
|
||||
<li>
|
||||
|
|
|
|||
Loading…
Reference in New Issue