Skip to content

Commit

Permalink
Merge pull request #2108 from DemocracyClub/feature-flag-hustings
Browse files Browse the repository at this point in the history
Feature flag the hustings CTA
  • Loading branch information
symroe authored Dec 4, 2024
2 parents afcd3c6 + 6e5043f commit 5a97078
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 27 deletions.
5 changes: 5 additions & 0 deletions wcivf/apps/hustings/context_processors.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from django.conf import settings


def show_hustings_cta(request):
return {"SHOW_HUSTINGS_CTA": getattr(settings, "SHOW_HUSTINGS_CTA", False)}
57 changes: 30 additions & 27 deletions wcivf/apps/hustings/templates/hustings/includes/_ballot.html
Original file line number Diff line number Diff line change
@@ -1,32 +1,35 @@
{% load i18n %}
<div class="ds-card" id="hustings">
<div class="ds-card-body">
<h3>
<span aria-hidden="true">📅</span>
{% trans "Election events" %}
</h3>
{% if postelection.husting_set.displayable.exists %}
<p>{% trans "You can meet candidates and question them at events (often known as 'hustings'). Here are some events that are taking place:" %}</p>
{% include "hustings/includes/_list.html" with hustings=postelection.husting_set.displayable %}
<p><small>
{% trans "Events are reported by users, if you spot an error, please" %} <a
href="https://democracyclub.org.uk/contact/">{% trans "get in touch" %}</a>
</small></p>
<hr>
<p>
{% trans "Do you know about any other events in the area? If so, please" %} <a
href="{% url 'hustings:add-husting' ballot_paper_id=postelection.ballot_paper_id %}">{% trans "tell us about them" %}</a>.
</p>
{% if postelection.husting_set.displayable.exists or SHOW_HUSTINGS_CTA %}
<div class="ds-card" id="hustings">
<div class="ds-card-body">
<h3>
<span aria-hidden="true">📅</span>
{% trans "Election events" %}
</h3>
{% if postelection.husting_set.displayable.exists %}
<p>{% trans "You can meet candidates and question them at events (often known as 'hustings'). Here are some events that are taking place:" %}</p>
{% include "hustings/includes/_list.html" with hustings=postelection.husting_set.displayable %}
<p><small>
{% trans "Events are reported by users, if you spot an error, please" %} <a
href="https://democracyclub.org.uk/contact/">{% trans "get in touch" %}</a>
</small></p>
<hr>
<p>
{% trans "Do you know about any other events in the area? If so, please" %} <a
href="{% url 'hustings:add-husting' ballot_paper_id=postelection.ballot_paper_id %}">{% trans "tell us about them" %}</a>.
</p>


{% else %}
<p>
{% trans "Do you know about any events (often known as 'hustings')? If so, please" %}
<a href="{% url 'hustings:add-husting' ballot_paper_id=postelection.ballot_paper_id %}">
{% trans "tell us about them" %}
</a>.
</p>
{% endif %}
{% else %}
<p>
{% trans "Do you know about any events (often known as 'hustings')? If so, please" %}
<a href="{% url 'hustings:add-husting' ballot_paper_id=postelection.ballot_paper_id %}">
{% trans "tell us about them" %}
</a>.
</p>
{% endif %}

</div>
</div>
</div>

{% endif %}
2 changes: 2 additions & 0 deletions wcivf/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ def get_ec2_ip():
"core.context_processors.postcode_form",
"core.context_processors.referer_postcode",
"core.context_processors.use_i18n",
"hustings.context_processors.show_hustings_cta",
"feedback.context_processors.feedback_form",
"dealer.contrib.django.context_processor",
]
Expand Down Expand Up @@ -328,6 +329,7 @@ def get_ec2_ip():
POSTCODE_LOGGER = DCWidePostcodeLoggingClient(**firehose_args)

SHOW_PARL_BOUNDARY_CHANGES = os.environ.get("SHOW_PARL_BOUNDARY_CHANGES", False)
SHOW_HUSTINGS_CTA = False
ENABLE_LAYERS_OF_STATE_FEATURE = os.environ.get(
"ENABLE_LAYERS_OF_STATE_FEATURE", False
)
Expand Down

0 comments on commit 5a97078

Please sign in to comment.