mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-16 04:02:52 -06:00
* Include the 'clear' button only for non-required fields * Apply the 'required' attribute for mandatory <select> fields * Recompile static assets
This commit is contained in:
parent
28e62d21a9
commit
6ed41f6680
BIN
netbox/project-static/dist/netbox.js
vendored
BIN
netbox/project-static/dist/netbox.js
vendored
Binary file not shown.
BIN
netbox/project-static/dist/netbox.js.map
vendored
BIN
netbox/project-static/dist/netbox.js.map
vendored
Binary file not shown.
@ -5,11 +5,13 @@ interface PluginConfig {
|
|||||||
export function getPlugins(element: HTMLSelectElement): object {
|
export function getPlugins(element: HTMLSelectElement): object {
|
||||||
const plugins: PluginConfig = {};
|
const plugins: PluginConfig = {};
|
||||||
|
|
||||||
// Enable "clear all" button
|
// Enable "clear all" button for non-required fields
|
||||||
plugins.clear_button = {
|
if (!element.required) {
|
||||||
html: (data: Dict) =>
|
plugins.clear_button = {
|
||||||
`<i class="mdi mdi-close-circle ${data.className}" title="${data.title}"></i>`,
|
html: (data: Dict) =>
|
||||||
};
|
`<i class="mdi mdi-close-circle ${data.className}" title="${data.title}"></i>`,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
// Enable individual "remove" buttons for items on multi-select fields
|
// Enable individual "remove" buttons for items on multi-select fields
|
||||||
if (element.hasAttribute('multiple')) {
|
if (element.hasAttribute('multiple')) {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<select name="{{ widget.name }}"{% include "django/forms/widgets/attrs.html" %} class="form-select {% if 'class' in widget.attrs %} {{ widget.attrs.class }}{% endif %}">{% for group_name, group_choices, group_index in widget.optgroups %}{% if group_name %}
|
<select name="{{ widget.name }}"{% include "django/forms/widgets/attrs.html" %} class="form-select{% if 'class' in widget.attrs %} {{ widget.attrs.class }}{% endif %}"{% if widget.required %} required{% endif %}>{% for group_name, group_choices, group_index in widget.optgroups %}{% if group_name %}
|
||||||
<optgroup label="{{ group_name }}">{% endif %}{% for option in group_choices %}
|
<optgroup label="{{ group_name }}">{% endif %}{% for option in group_choices %}
|
||||||
{% include option.template_name with widget=option %}{% endfor %}{% if group_name %}
|
{% include option.template_name with widget=option %}{% endfor %}{% if group_name %}
|
||||||
</optgroup>{% endif %}{% endfor %}
|
</optgroup>{% endif %}{% endfor %}
|
||||||
|
Loading…
Reference in New Issue
Block a user