diff --git a/scoring/static/scoring/js/main.js b/scoring/static/scoring/js/main.js index f0cf32f7..2132cf3d 100644 --- a/scoring/static/scoring/js/main.js +++ b/scoring/static/scoring/js/main.js @@ -546,3 +546,53 @@ document.querySelectorAll('.js-social-graphic-download').forEach(function(el) { }); }); }); + +// Question display improved or worsened councils +// Function to update table visibility based on checkbox states +function updateTableVisibility() { + var improvedChecked = document.querySelector('.js-checkbox-improved-councils').checked; + var worsenedChecked = document.querySelector('.js-checkbox-worsened-councils').checked; + + // If no checkboxes are checked, show all rows + var showAll = !improvedChecked && !worsenedChecked; + + // Update visibility for rows with year-difference-status + forEachElement('tr[year-difference-status]', function(row) { + var status = row.getAttribute('year-difference-status'); + + // Show the row if: + // 1. No filters are active (show all) + // 2. The row's status matches the active filter + if (showAll || + (improvedChecked && status === 'improved') || + (worsenedChecked && status === 'worsened')) { + row.style.display = ''; + } else { + row.style.display = 'none'; + } + }); +} + +forEachElement('.js-checkbox-improved-councils', function(checkbox) { + checkbox.addEventListener('change', function() { + // If this checkbox is checked, uncheck the other one + if (this.checked) { + forEachElement('.js-checkbox-worsened-councils', function(otherCheckbox) { + otherCheckbox.checked = false; + }); + } + updateTableVisibility(); + }); +}); + +forEachElement('.js-checkbox-worsened-councils', function(checkbox) { + checkbox.addEventListener('change', function() { + // If this checkbox is checked, uncheck the other one + if (this.checked) { + forEachElement('.js-checkbox-improved-councils', function(otherCheckbox) { + otherCheckbox.checked = false; + }); + } + updateTableVisibility(); + }); +}); diff --git a/scoring/static/scoring/scss/table-question-council.scss b/scoring/static/scoring/scss/table-question-council.scss index 4dd8378b..f1f576ff 100644 --- a/scoring/static/scoring/scss/table-question-council.scss +++ b/scoring/static/scoring/scss/table-question-council.scss @@ -1,8 +1,22 @@ +.question-summary-grid { + display: grid; + grid-template-columns: repeat(auto-fill, minmax(min(13.625rem, 18.75rem), 1fr)); + gap: 2rem; + + &__item { + margin-bottom: 1rem; + + @media (min-width: 576px) { + margin-bottom: 0; + } + } +} + .table-question-council, .section-question-table, .table-council-question-performance { th { - vertical-align: top; + vertical-align: middle; } th, td { diff --git a/scoring/templates/scoring/question.html b/scoring/templates/scoring/question.html index 9dba9b4a..f78df6d2 100644 --- a/scoring/templates/scoring/question.html +++ b/scoring/templates/scoring/question.html @@ -76,74 +76,148 @@
{% include 'scoring/includes/scoring-group-name.html' with group=scoring_group.slug plural=1 %}
+Council | -Score | -Evidence | -
---|---|---|
- - {{ score.plan_score.council.name }} - - | -- {{ score.score|floatformat:"-2" }}/{{ score.max_score }} - | -
- {% if score.score != 0 %}
- {% for evidence_link in score.evidence_links_cleaned %}
- {% if not forloop.first %} {% endif %} - {% if evidence_link|slice:":4" == "http" %} - {{ evidence_link|domain_human }} - {% else %} - {{ evidence_link }} - {% endif %} - {% endfor %} - {% endif %} - |
-
There is no comparison between 2025 and 2023 data because this question's maximum score was modified in 2025.
+This question was introduced in the 2025 Action Scorecards and has no historical data for comparison.
+Council | +Score | +Difference 2023 | +Evidence | +
---|---|---|---|
+ + {{ score.plan_score.council.name }} + + | ++ {{ score.score|floatformat:"-2" }}/{{ score.max_score }} + | ++ ▼ {{ score.score|floatformat:"-2" }} + | +
+ {% if score.score != 0 %}
+ {% for evidence_link in score.evidence_links_cleaned %}
+ {% if not forloop.first %} {% endif %} + {% if evidence_link|slice:":4" == "http" %} + {{ evidence_link|domain_human }} + {% else %} + {{ evidence_link }} + {% endif %} + {% endfor %} + {% endif %} + |
+