Skip to content

Commit

Permalink
Fixes Color consistency issue in question page
Browse files Browse the repository at this point in the history
  • Loading branch information
cbum-dev committed Mar 23, 2024
1 parent 42ff963 commit 1338dd4
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
14 changes: 11 additions & 3 deletions src/pretalx/orga/forms/cfp.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
8 changes: 4 additions & 4 deletions src/pretalx/orga/templates/orga/cfp/question_view.html
Original file line number Diff line number Diff line change
Expand Up @@ -74,19 +74,19 @@
<td class="text-center">
<a href="{{ question.urls.active }}" >
{% if question.active %}
<i class="fa fa-toggle-on "></i>
<i class="fa fa-toggle-on text-dark"></i>
{% else %}
<i class="fa fa-toggle-off "></i>
<i class="fa fa-toggle-off text-dark"></i>
{% endif %}
</a>
</td>
<td class="text-center">
{% if question.answer_count == 0%}
<a href="{{ question.urls.public }}" >
{% if question.is_public == True %}
<i class="fa fa-toggle-on"></i>
<i class="fa fa-toggle-on text-dark "></i>
{% else %}
<i class="fa fa-toggle-off "></i>
<i class="fa fa-toggle-off text-dark"></i>
{% endif %}
</a>
{% else %}
Expand Down

0 comments on commit 1338dd4

Please sign in to comment.