1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

implemented #2590 - improved color picker with actual colors

This commit is contained in:
John Anderson
2019-01-05 17:43:42 -05:00
parent c27cea981c
commit 6d5d9c8af3
4 changed files with 129 additions and 1 deletions

View File

@@ -86,6 +86,22 @@ $(document).ready(function() {
return rendered_url
}
function colorPickerClassCopy(data, container) {
console.log("hello");
if (data.element) {
$(container).addClass($(data.element).attr("class"));
}
return data.text;
}
// Color Picker
$('.netbox-select2-color-picker').select2({
allowClear: true,
placeholder: "---------",
templateResult: colorPickerClassCopy,
templateSelection: colorPickerClassCopy,
})
// Static choice selection
$('.netbox-select2-static').select2({
allowClear: true,