mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
Add select2-bootstrap for consistent widget styling
This commit is contained in:
@ -99,15 +99,17 @@ $(document).ready(function() {
|
||||
$('.netbox-select2-color-picker').select2({
|
||||
allowClear: true,
|
||||
placeholder: "---------",
|
||||
theme: "bootstrap",
|
||||
templateResult: colorPickerClassCopy,
|
||||
templateSelection: colorPickerClassCopy,
|
||||
})
|
||||
templateSelection: colorPickerClassCopy
|
||||
});
|
||||
|
||||
// Static choice selection
|
||||
$('.netbox-select2-static').select2({
|
||||
allowClear: true,
|
||||
placeholder: "---------",
|
||||
})
|
||||
theme: "bootstrap"
|
||||
});
|
||||
|
||||
// API backed selection
|
||||
// Includes live search and chained fields
|
||||
@ -115,7 +117,7 @@ $(document).ready(function() {
|
||||
$('.netbox-select2-api').select2({
|
||||
allowClear: true,
|
||||
placeholder: "---------",
|
||||
|
||||
theme: "bootstrap",
|
||||
ajax: {
|
||||
delay: 500,
|
||||
|
||||
@ -162,13 +164,13 @@ $(document).ready(function() {
|
||||
var conditional = attr.name.split("data-conditional-query-param-")[1].split("__");
|
||||
var field = $("#id_" + conditional[0]);
|
||||
var field_value = conditional[1];
|
||||
|
||||
|
||||
if ($('option:selected', field).attr('api-value') === field_value){
|
||||
var _val = attr.value.split("=");
|
||||
parameters[_val[0]] = _val[1];
|
||||
}
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
// Additional query params
|
||||
$.each(element.attributes, function(index, attr){
|
||||
@ -176,7 +178,7 @@ $(document).ready(function() {
|
||||
var param_name = attr.name.split("data-additional-query-param-")[1]
|
||||
parameters[param_name] = attr.value;
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
// This will handle params with multiple values (i.e. for list filter forms)
|
||||
return $.param(parameters, true);
|
||||
|
7
netbox/project-static/select2-bootstrap-0.1.0-beta.10/select2-bootstrap.min.css
vendored
Normal file
7
netbox/project-static/select2-bootstrap-0.1.0-beta.10/select2-bootstrap.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
@ -8,6 +8,7 @@
|
||||
<link rel="stylesheet" href="{% static 'font-awesome-4.7.0/css/font-awesome.min.css' %}">
|
||||
<link rel="stylesheet" href="{% static 'jquery-ui-1.12.1/jquery-ui.css' %}">
|
||||
<link rel="stylesheet" href="{% static 'select2-4.0.5/css/select2.min.css' %}">
|
||||
<link rel="stylesheet" href="{% static 'select2-bootstrap-0.1.0-beta.10/select2-bootstrap.min.css' %}">
|
||||
<link rel="stylesheet" href="{% static 'css/base.css' %}?v{{ settings.VERSION }}">
|
||||
<link rel="icon" type="image/png" href="{% static 'img/netbox.ico' %}" />
|
||||
<meta charset="UTF-8">
|
||||
|
Reference in New Issue
Block a user