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

#6372: Fix native select styling

This commit is contained in:
checktheroads
2021-05-25 08:26:36 -07:00
parent 27a02f64b2
commit 8fe795102f
4 changed files with 12 additions and 3 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -103,7 +103,8 @@ $form-select-color: $input-color;
$form-select-disabled-color: $gray-400;
$form-select-bg: $input-bg;
$form-select-disabled-bg: $input-disabled-bg;
$form-select-indicator-color: $gray-800;
$form-select-indicator-color: $form-select-color;
$form-select-indicator: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'><path fill='none' stroke='#{$form-select-indicator-color}' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/></svg>");
$form-select-border-color: $input-border-color;
$form-range-track-bg: $gray-300;

View File

@ -23,6 +23,7 @@ class BootstrapMixin(forms.BaseForm):
"""
Add the base Bootstrap CSS classes to form elements.
"""
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
@ -31,6 +32,7 @@ class BootstrapMixin(forms.BaseForm):
forms.ClearableFileInput,
forms.FileInput,
forms.RadioSelect,
forms.Select,
APISelect,
APISelectMultiple,
StaticSelect2,
@ -52,6 +54,10 @@ class BootstrapMixin(forms.BaseForm):
css = field.widget.attrs.get('class', '')
field.widget.attrs['class'] = ' '.join((css, 'form-check-input')).strip()
if field.widget.__class__ == forms.Select:
css = field.widget.attrs.get('class', '')
field.widget.attrs['class'] = ' '.join((css, 'form-select')).strip()
class ReturnURLForm(forms.Form):
"""
@ -71,6 +77,7 @@ class BulkEditForm(forms.Form):
"""
Base form for editing multiple objects in bulk
"""
def __init__(self, model, *args, **kwargs):
super().__init__(*args, **kwargs)
self.model = model
@ -110,6 +117,7 @@ class CSVModelForm(forms.ModelForm):
"""
ModelForm used for the import of objects in CSV format.
"""
def __init__(self, *args, headers=None, **kwargs):
super().__init__(*args, **kwargs)