mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-14 09:51:22 -06:00
Add select2-bootstrap for consistent widget styling
This commit is contained in:
parent
14695037da
commit
4227c6b806
@ -99,15 +99,17 @@ $(document).ready(function() {
|
|||||||
$('.netbox-select2-color-picker').select2({
|
$('.netbox-select2-color-picker').select2({
|
||||||
allowClear: true,
|
allowClear: true,
|
||||||
placeholder: "---------",
|
placeholder: "---------",
|
||||||
|
theme: "bootstrap",
|
||||||
templateResult: colorPickerClassCopy,
|
templateResult: colorPickerClassCopy,
|
||||||
templateSelection: colorPickerClassCopy,
|
templateSelection: colorPickerClassCopy
|
||||||
})
|
});
|
||||||
|
|
||||||
// Static choice selection
|
// Static choice selection
|
||||||
$('.netbox-select2-static').select2({
|
$('.netbox-select2-static').select2({
|
||||||
allowClear: true,
|
allowClear: true,
|
||||||
placeholder: "---------",
|
placeholder: "---------",
|
||||||
})
|
theme: "bootstrap"
|
||||||
|
});
|
||||||
|
|
||||||
// API backed selection
|
// API backed selection
|
||||||
// Includes live search and chained fields
|
// Includes live search and chained fields
|
||||||
@ -115,7 +117,7 @@ $(document).ready(function() {
|
|||||||
$('.netbox-select2-api').select2({
|
$('.netbox-select2-api').select2({
|
||||||
allowClear: true,
|
allowClear: true,
|
||||||
placeholder: "---------",
|
placeholder: "---------",
|
||||||
|
theme: "bootstrap",
|
||||||
ajax: {
|
ajax: {
|
||||||
delay: 500,
|
delay: 500,
|
||||||
|
|
||||||
@ -162,13 +164,13 @@ $(document).ready(function() {
|
|||||||
var conditional = attr.name.split("data-conditional-query-param-")[1].split("__");
|
var conditional = attr.name.split("data-conditional-query-param-")[1].split("__");
|
||||||
var field = $("#id_" + conditional[0]);
|
var field = $("#id_" + conditional[0]);
|
||||||
var field_value = conditional[1];
|
var field_value = conditional[1];
|
||||||
|
|
||||||
if ($('option:selected', field).attr('api-value') === field_value){
|
if ($('option:selected', field).attr('api-value') === field_value){
|
||||||
var _val = attr.value.split("=");
|
var _val = attr.value.split("=");
|
||||||
parameters[_val[0]] = _val[1];
|
parameters[_val[0]] = _val[1];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
|
|
||||||
// Additional query params
|
// Additional query params
|
||||||
$.each(element.attributes, function(index, attr){
|
$.each(element.attributes, function(index, attr){
|
||||||
@ -176,7 +178,7 @@ $(document).ready(function() {
|
|||||||
var param_name = attr.name.split("data-additional-query-param-")[1]
|
var param_name = attr.name.split("data-additional-query-param-")[1]
|
||||||
parameters[param_name] = attr.value;
|
parameters[param_name] = attr.value;
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
|
|
||||||
// This will handle params with multiple values (i.e. for list filter forms)
|
// This will handle params with multiple values (i.e. for list filter forms)
|
||||||
return $.param(parameters, true);
|
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 '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 '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-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="stylesheet" href="{% static 'css/base.css' %}?v{{ settings.VERSION }}">
|
||||||
<link rel="icon" type="image/png" href="{% static 'img/netbox.ico' %}" />
|
<link rel="icon" type="image/png" href="{% static 'img/netbox.ico' %}" />
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
|
Loading…
Reference in New Issue
Block a user