mirror of
https://github.com/netbox-community/netbox.git
synced 2025-08-17 13:08:16 -06:00
Improve rendering of color options
This commit is contained in:
parent
a7ea105247
commit
053e02d4d7
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.
@ -17,13 +17,16 @@ export function initStaticSelects(): void {
|
||||
|
||||
// Initialize color selection fields
|
||||
export function initColorSelects(): void {
|
||||
function renderColor(item: TomOption, escape: typeof escape_html) {
|
||||
return `<div><span class="dropdown-item-indicator color-label" style="background-color: #${escape(item.value)}"></span> ${escape(item.text)}</div>`
|
||||
}
|
||||
|
||||
for (const select of getElements<HTMLSelectElement>('select.color-select')) {
|
||||
new TomSelect(select, {
|
||||
...config,
|
||||
render: {
|
||||
option: function (item: TomOption, escape: typeof escape_html) {
|
||||
return `<div style="background-color: #${escape(item.value)}">${escape(item.text)}</div>`;
|
||||
},
|
||||
option: renderColor,
|
||||
item: renderColor,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user