Skip to content

Commit

Permalink
Remove history from the header during elections
Browse files Browse the repository at this point in the history
  • Loading branch information
tudoramariei committed Oct 28, 2024
1 parent c0481a7 commit 3775d2d
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 11 deletions.
30 changes: 23 additions & 7 deletions backend/hub/context_processors.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,14 @@ def hub_settings(_: WSGIRequest) -> Dict[str, Any]:
if settings.ENABLE_ORG_REGISTRATION_FORM:
register_url = reverse("ngos-register-request")

candidate_registration_enabled = flags.get(FLAG_CHOICES.enable_candidate_registration, False)
candidate_supporting_enabled = flags.get(FLAG_CHOICES.enable_candidate_supporting, False)
candidate_voting_enabled = flags.get(FLAG_CHOICES.enable_candidate_voting, False)
candidate_confirmation_enabled = flags.get(FLAG_CHOICES.enable_candidate_confirmation, False)
results_enabled = flags.get(FLAG_CHOICES.enable_results_display, False)
org_approval_enabled = flags.get(FLAG_CHOICES.enable_org_approval, False)
org_registration_enabled = flags.get(FLAG_CHOICES.enable_org_registration, False)

return {
# Flags from settings.py:
"ANALYTICS_ENABLED": settings.ANALYTICS_ENABLED,
Expand All @@ -26,14 +34,22 @@ def hub_settings(_: WSGIRequest) -> Dict[str, Any]:
"CONTACT_EMAIL": settings.CONTACT_EMAIL,
"COMISSION_EMAIL": settings.COMISSION_EMAIL,
# Flags from database:
"CANDIDATE_REGISTRATION_ENABLED": flags.get(FLAG_CHOICES.enable_candidate_registration, False),
"CANDIDATE_SUPPORTING_ENABLED": flags.get(FLAG_CHOICES.enable_candidate_supporting, False),
"CANDIDATE_VOTING_ENABLED": flags.get(FLAG_CHOICES.enable_candidate_voting, False),
"CANDIDATE_CONFIRMATION_ENABLED": flags.get(FLAG_CHOICES.enable_candidate_confirmation, False),
"RESULTS_ENABLED": flags.get(FLAG_CHOICES.enable_results_display, False),
"ORG_APPROVAL_ENABLED": flags.get(FLAG_CHOICES.enable_org_approval, False),
"ORG_REGISTRATION_ENABLED": flags.get(FLAG_CHOICES.enable_org_registration, False),
"CANDIDATE_REGISTRATION_ENABLED": candidate_registration_enabled,
"CANDIDATE_SUPPORTING_ENABLED": candidate_supporting_enabled,
"CANDIDATE_VOTING_ENABLED": candidate_voting_enabled,
"CANDIDATE_CONFIRMATION_ENABLED": candidate_confirmation_enabled,
"RESULTS_ENABLED": results_enabled,
"ORG_APPROVAL_ENABLED": org_approval_enabled,
"ORG_REGISTRATION_ENABLED": org_registration_enabled,
# Settings flags
"GLOBAL_SUPPORT_ENABLED": flags.get(FLAG_CHOICES.global_support_round, False),
"VOTING_DOMAIN_ENABLED": flags.get(FLAG_CHOICES.enable_voting_domain, False),
# Composite flags
"ELECTION_IN_PROGRESS": (
candidate_registration_enabled
or candidate_supporting_enabled
or candidate_voting_enabled
or candidate_confirmation_enabled
or org_registration_enabled
),
}
8 changes: 8 additions & 0 deletions backend/hub/templates/hub/about.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,14 @@ <h1 class="title">

</div>

<div class="container section has-text-centered ">

<a href="{% url 'history' %}" class="button is-main is-rounded">
Vezi istoricul alegerilor desfășurate pe Vot ONG
</a>

</div>

{% block left-side-view %}
<div class="container content mb-50">

Expand Down
10 changes: 6 additions & 4 deletions backend/hub/templates/hub/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
{% trans "Organizations" %}
</a>

{% if user.is_authenticated %}
{% if user.is_authenticated and ELECTION_IN_PROGRESS %}
<a href="{% url 'candidates' %}" class="navbar-item">
{% trans "Candidates" %}
</a>
Expand All @@ -80,9 +80,11 @@

</a>

<a href="{% url 'history' %}" class="navbar-item">
{% trans "History" %}
</a>
{% if not ELECTION_IN_PROGRESS %}
<a href="{% url 'history' %}" class="navbar-item">
{% trans "History" %}
</a>
{% endif %}

<div class="navbar-item">|</div>

Expand Down
2 changes: 2 additions & 0 deletions backend/static_extras/css/colors.css
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,6 @@

--candidate-colorblock: #ffcc00;
--ngo-colorblock: #5E72E4;

--ngohub-yellow: #F9DE6E;
}
4 changes: 4 additions & 0 deletions backend/static_extras/css/hub.css
Original file line number Diff line number Diff line change
Expand Up @@ -584,6 +584,10 @@ hr.tight {
background-color: var(--call2action);
}

.button.is-main {
background-color: var(--ngohub-yellow);
}

.filter-grid {
display: grid;
overflow: hidden;
Expand Down

0 comments on commit 3775d2d

Please sign in to comment.