From 1338dd4d76db402f6861383655f4307a6b85a811 Mon Sep 17 00:00:00 2001 From: cbum-dev Date: Sat, 23 Mar 2024 17:06:07 +0530 Subject: [PATCH] Fixes Color consistency issue in question page --- src/pretalx/orga/forms/cfp.py | 14 +++++++++++--- .../orga/templates/orga/cfp/question_view.html | 8 ++++---- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/src/pretalx/orga/forms/cfp.py b/src/pretalx/orga/forms/cfp.py index 0d288014c..84d917e7f 100644 --- a/src/pretalx/orga/forms/cfp.py +++ b/src/pretalx/orga/forms/cfp.py @@ -87,16 +87,24 @@ def __init__(self, *args, obj, **kwargs): self.fields[field_name].widget.attrs["placeholder"] = "" for attribute in self.request_require_fields: field_name = f"cfp_ask_{attribute}" + visibility = obj.cfp.fields.get(attribute, default_fields()[attribute])["visibility"] + if visibility == "optional": + css_class = "btn btn-outline-dark btn-sm" + elif visibility == "required": + css_class = "btn btn-outline-success btn-sm" + else: + css_class = "btn btn-outline-danger btn-sm" self.fields[field_name] = forms.ChoiceField( required=True, initial=obj.cfp.fields.get(attribute, default_fields()[attribute])[ "visibility" ], choices=[ - ("do_not_ask", _("Do not ask")), - ("optional", _("Ask, but do not require input")), - ("required", _("Ask and require input")), + ("do_not_ask", _("Not Active")), + ("optional", _("Optional")), + ("required", _("Required")), ], + widget=forms.Select(attrs={'class': css_class}), ) if not obj.is_multilingual: self.fields.pop("cfp_ask_content_locale", None) diff --git a/src/pretalx/orga/templates/orga/cfp/question_view.html b/src/pretalx/orga/templates/orga/cfp/question_view.html index 6ae1ae5b0..6b761d8f4 100644 --- a/src/pretalx/orga/templates/orga/cfp/question_view.html +++ b/src/pretalx/orga/templates/orga/cfp/question_view.html @@ -74,9 +74,9 @@ {% if question.active %} - + {% else %} - + {% endif %} @@ -84,9 +84,9 @@ {% if question.answer_count == 0%} {% if question.is_public == True %} - + {% else %} - + {% endif %} {% else %}