Skip to content

Commit

Permalink
fixup! [Scorecards] Added Year comparison for Homepage mobile version
Browse files Browse the repository at this point in the history
  • Loading branch information
lucascumsille committed Feb 27, 2025
1 parent 5cb039b commit 1828ebc
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 67 deletions.
19 changes: 11 additions & 8 deletions scoring/static/scoring/scss/scoring-table.scss
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ $padding-left: 1rem;
}

th,td {
padding: 1rem;
padding: 1rem 0.5rem;
}

.name-row {
Expand All @@ -343,6 +343,7 @@ $padding-left: 1rem;
padding-bottom: 0.5rem;
text-transform: uppercase;
font-size: 0.8rem;
text-align: center;
}
}

Expand All @@ -359,6 +360,13 @@ $padding-left: 1rem;
th,td {
padding-top: 0.25rem;
padding-bottom: 1.25rem;
width: 10rem;
text-align: center;
width: 50%;

@include media-breakpoint-up(sm) {
width: 30%;
}
}
}

Expand All @@ -379,20 +387,15 @@ $padding-left: 1rem;
}

.score-bar {
width: 85px;
width: 120px;
padding: 4px 0;
font-size: 0.8rem;
margin:0 auto;

span.average {
display: none;
}
}

.council-link {
display: inline-block;
max-width: 100%;
font-style: 0.8rem;
}
}

$js-classes: (
Expand Down
62 changes: 3 additions & 59 deletions scoring/templates/scoring/home.html
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ <h2 class="mb-1 fs-5 lh-1">{{ authority_type_label }}</h2>
</table>

{% comment %} Category select for mobile {% endcomment %}
<form role="search" class="position-sticky top-0 z-index-3 pt-3 px-3">
<form role="search" class="d-lg-none position-sticky top-0 z-index-3 pt-3 px-3">
<label class="visually-hidden" for="mobile-category-select">Select category</label>
<select id="mobile-category-select" name="category" aria-label="Select category" class="form-select fw-bold js-category-select">
<option value="js-total" selected>Total Score</option>
Expand All @@ -259,84 +259,58 @@ <h2 class="mb-1 fs-5 lh-1">{{ authority_type_label }}</h2>
</tr>
<tr class="legend-row fs-8">
<th scope="col" class="fw-normal">2025</th>
<th scope="col" class="fw-normal">2023</th>
<th scope="col" class="fw-normal">Difference</th>
<th scope="col" class="fw-normal">versus 2023</th>
</tr>
<tr class="score-row js-total">
<td>
{% include 'scoring/includes/score-bar.html' with percentage=averages.total.percentage average=1 %}
</td>
<td>
{% comment %} TODO: Add 2023 score {% endcomment %}
{% include 'scoring/includes/score-bar.html' with percentage=averages.total.percentage average=1 %}
</td>
<td>
<span class="badge bg-green-100 text-success">&#9650; 10%</span>
</td>
</tr>
<tr class="score-row js-building category-1">
<td>
{% include 'scoring/includes/score-bar.html' with percentage=averages.s1_b_h.weighted average=1 %}
</td>
<td>
{% include 'scoring/includes/score-bar.html' with percentage=averages.s1_b_h.weighted average=1 %}
</td>
<td><span class="badge bg-green-100 text-success">&#9650; 10%</span></td>
</tr>
<tr class="score-row js-transport category-2">
<td>
{% include 'scoring/includes/score-bar.html' with percentage=averages.s2_tran.weighted average=1 %}
</td>
<td>
{% include 'scoring/includes/score-bar.html' with percentage=averages.s2_tran.weighted average=1 %}
</td>
<td><span class="badge bg-green-100 text-success">&#9650; 10%</span></td>
</tr>

<tr class="score-row js-planning category-3">
<td>
{% include 'scoring/includes/score-bar.html' with percentage=averages.s3_p_lu.weighted average=1 %}
</td>
<td>
{% include 'scoring/includes/score-bar.html' with percentage=averages.s3_p_lu.weighted average=1 %}
</td>
<td><span class="badge bg-green-100 text-success">&#9650; 10%</span></td>
</tr>

<tr class="score-row js-governance category-4">
<td>
{% include 'scoring/includes/score-bar.html' with percentage=averages.s4_g_f.weighted average=1 %}
</td>
<td>
{% include 'scoring/includes/score-bar.html' with percentage=averages.s4_g_f.weighted average=1 %}
</td>
<td><span class="badge bg-green-100 text-success">&#9650; 10%</span></td>
</tr>

<tr class="score-row js-biodiversity category-5">
<td>
{% include 'scoring/includes/score-bar.html' with percentage=averages.s5_bio.weighted average=1 %}
</td>
<td>
{% include 'scoring/includes/score-bar.html' with percentage=averages.s5_bio.weighted average=1 %}
</td>
<td><span class="badge bg-green-100 text-success">&#9650; 10%</span></td>
</tr>

<tr class="score-row js-collaboration category-6">
<td>
{% include 'scoring/includes/score-bar.html' with percentage=averages.s6_c_e.weighted average=1 %}
</td>
<td>
{% include 'scoring/includes/score-bar.html' with percentage=averages.s6_c_e.weighted average=1 %}
</td>
<td><span class="badge bg-green-100 text-success">&#9650; 10%</span></td>
</tr>

<tr class="score-row js-waste category-7">
<td>
{% include 'scoring/includes/score-bar.html' with percentage=averages.s7_wr_f.weighted average=1 %}
</td>
<td>
{% include 'scoring/includes/score-bar.html' with percentage=averages.s7_wr_f.weighted average=1 %}
</td>
Expand All @@ -348,7 +322,7 @@ <h2 class="mb-1 fs-5 lh-1">{{ authority_type_label }}</h2>
{% for council in council_data %}
<tr class="name-row" data-jump-slug="{{ council.slug }}">
<th class="fw-normal" scope="row" colspan="3">
<a class="lh-base council-link d-flex flex-column align-items-start" href="{% url 'scoring:council' council.slug %}">
<a class="lh-base council-link d-flex flex-column align-items-center" href="{% url 'scoring:council' council.slug %}">
{% if council.top_performer %}
<div class="d-flex flex-row align-items-center badge bg-primary-100 text-primary mb-1">
{% include 'caps/icons/scorecards-star.html' with classes='me-1 align-text-top' width='1.2em' height='auto' role='presentation' %}
Expand All @@ -359,11 +333,6 @@ <h2 class="mb-1 fs-5 lh-1">{{ authority_type_label }}</h2>
</a>
</th>
</tr>
<tr class="legend-row fs-8">
<th scope="col" class="fw-normal">2025</th>
<th scope="col" class="fw-normal">2023</th>
<th scope="col" class="fw-normal">Difference</th>
</tr>
<tr class="score-row js-total">
<td>
{% if council.score != 0 %}
Expand All @@ -372,10 +341,6 @@ <h2 class="mb-1 fs-5 lh-1">{{ authority_type_label }}</h2>
<span>--</span>
{% endif %}
</td>
<td>
{% comment %} TODO: Add 2023 score {% endcomment %}
{% include 'scoring/includes/score-bar.html' with percentage=averages.total.percentage average=1 %}
</td>
<td>
<span class="badge bg-green-100 text-success">&#9650; 10%</span>
</td>
Expand All @@ -398,9 +363,6 @@ <h2 class="mb-1 fs-5 lh-1">{{ authority_type_label }}</h2>
{% with scores=council.all_scores %}
{% if council.score != 0 and council.score is not None %}
<tr class="score-row js-building">
<td class="council-category-score category-1">
{% include 'scoring/includes/score-bar.html' with percentage=scores.s1_b_h.weighted %}
</td>
<td class="council-category-score category-1">
{% include 'scoring/includes/score-bar.html' with percentage=scores.s1_b_h.weighted %}
</td>
Expand All @@ -409,9 +371,6 @@ <h2 class="mb-1 fs-5 lh-1">{{ authority_type_label }}</h2>
</td>
</tr>
<tr class="score-row js-transport">
<td class="council-category-score category-2">
{% include 'scoring/includes/score-bar.html' with percentage=scores.s2_tran.weighted %}
</td>
<td class="council-category-score category-2">
{% include 'scoring/includes/score-bar.html' with percentage=scores.s2_tran.weighted %}
</td>
Expand All @@ -421,9 +380,6 @@ <h2 class="mb-1 fs-5 lh-1">{{ authority_type_label }}</h2>
</tr>

<tr class="score-row js-planning">
<td class="council-category-score category-3">
{% include 'scoring/includes/score-bar.html' with percentage=scores.s3_p_lu.weighted %}
</td>
<td class="council-category-score category-3">
{% include 'scoring/includes/score-bar.html' with percentage=scores.s3_p_lu.weighted %}
</td>
Expand All @@ -433,9 +389,6 @@ <h2 class="mb-1 fs-5 lh-1">{{ authority_type_label }}</h2>
</tr>

<tr class="score-row js-governance">
<td class="council-category-score category-4">
{% include 'scoring/includes/score-bar.html' with percentage=scores.s4_g_f.weighted %}
</td>
<td class="council-category-score category-4">
{% include 'scoring/includes/score-bar.html' with percentage=scores.s4_g_f.weighted %}
</td>
Expand All @@ -445,9 +398,6 @@ <h2 class="mb-1 fs-5 lh-1">{{ authority_type_label }}</h2>
</tr>

<tr class="score-row js-biodiversity">
<td class="council-category-score category-5">
{% include 'scoring/includes/score-bar.html' with percentage=scores.s5_bio.weighted %}
</td>
<td class="council-category-score category-5">
{% include 'scoring/includes/score-bar.html' with percentage=scores.s5_bio.weighted %}
</td>
Expand All @@ -457,9 +407,6 @@ <h2 class="mb-1 fs-5 lh-1">{{ authority_type_label }}</h2>
</tr>

<tr class="score-row js-collaboration">
<td class="council-category-score category-6">
{% include 'scoring/includes/score-bar.html' with percentage=scores.s6_c_e.weighted %}
</td>
<td class="council-category-score category-6">
{% include 'scoring/includes/score-bar.html' with percentage=scores.s6_c_e.weighted %}
</td>
Expand All @@ -469,9 +416,6 @@ <h2 class="mb-1 fs-5 lh-1">{{ authority_type_label }}</h2>
</tr>

<tr class="score-row js-waste">
<td class="council-category-score category-7">
{% include 'scoring/includes/score-bar.html' with percentage=scores.s7_wr_f.weighted %}
</td>
<td class="council-category-score category-7">
{% include 'scoring/includes/score-bar.html' with percentage=scores.s7_wr_f.weighted %}
</td>
Expand Down

0 comments on commit 1828ebc

Please sign in to comment.