diff --git a/allianceauth/custom_css/admin.py b/allianceauth/custom_css/admin.py index 0b5f79ec..debc4f16 100644 --- a/allianceauth/custom_css/admin.py +++ b/allianceauth/custom_css/admin.py @@ -20,3 +20,6 @@ class CustomCSSAdmin(SingletonModelAdmin): """ form = CustomCSSAdminForm + + # Leave this here for when we decide to add syntax highlighting to the CSS editor + # change_form_template = 'custom_css/admin/change_form.html' diff --git a/allianceauth/custom_css/forms.py b/allianceauth/custom_css/forms.py index f9a1f205..6823b204 100644 --- a/allianceauth/custom_css/forms.py +++ b/allianceauth/custom_css/forms.py @@ -18,4 +18,12 @@ class CustomCSSAdminForm(forms.ModelForm): class Meta: model = CustomCSS fields = ("css",) - widgets = {"css": CssEditorWidget(attrs={"style": "width: 90%; height: 100%;"})} + widgets = { + "css": CssEditorWidget( + attrs={ + "style": "width: 90%; height: 100%;", + "data-editor": "code-highlight", + "data-language": "css", + } + ) + } diff --git a/allianceauth/custom_css/templates/custom_css/admin/change_form.html b/allianceauth/custom_css/templates/custom_css/admin/change_form.html new file mode 100644 index 00000000..d8c921f2 --- /dev/null +++ b/allianceauth/custom_css/templates/custom_css/admin/change_form.html @@ -0,0 +1,48 @@ +{% extends "admin/change_form.html" %} + +{% block field_sets %} + {% for fieldset in adminform %} +
+ {% endfor %} +{% endblock %} + +{% block after_field_sets %}{% endblock %}