Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -125,11 +125,6 @@ echo "4.8 Running 'python manage.py recompute_url_names' to de-collide historica
echo "******************************************"
python manage.py recompute_url_names

echo "****************** STEP 4.9/5: docker-entrypoint.sh ************************"
echo "4.9 Running 'python manage.py import_awards' to backfill missing Awards (idempotent)"
echo "******************************************"
python manage.py import_awards

# echo "****************** STEP 4.3/5: docker-entrypoint.sh ************************"
# echo "4.3 Running 'python manage.py rename_person_images' to rename person images"
# echo "******************************************"
Expand Down
4 changes: 2 additions & 2 deletions makeabilitylab/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@
SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')

# Makeability Lab Global Variables, including Makeability Lab version
ML_WEBSITE_VERSION = "2.14.0" # Keep this updated with each release and also change the short description below
ML_WEBSITE_VERSION_DESCRIPTION = "Feature: redesigned Awards page. Each award now renders as a card with a category-specific visual anchor — recipient photo (student awards), project thumbnail (project awards), or a gold medal icon (faculty honors), with an optional uploaded emblem (new Award.badge field) overriding any of these — led by a prominent golden-orange year badge. A new idempotent import_awards management command (wired into docker-entrypoint.sh) backfills ~27 people/project/faculty awards mined from the news archive + CV that were missing from the Awards page, and corrects the mis-dated Facilitators' Choice (PrototypAR) entry. Paper awards stay on Publication.award; the one gap ('Playing on Hard Mode') is tracked in #1354. /awards/ added to the Pa11y scan set."
ML_WEBSITE_VERSION = "2.14.1" # Keep this updated with each release and also change the short description below
ML_WEBSITE_VERSION_DESCRIPTION = "Patch: Awards page polish. Section headings now use clean, shareable anchor IDs (e.g. #student-awards, #best-paper-awards instead of #section-...-heading); recipient/project lists no longer render a stray space before the comma ('Name, Project'); and the Best/Other Paper Award headings show a count, e.g. 'Best Paper Awards (12)'. Also retires the one-time import_awards step from the deploy sequence now that the backfill has run on test + prod — the management command stays in the repo (unwired, re-runnable) so a future rebuild can replay it."
DATE_MAKEABILITYLAB_FORMED = datetime.date(2012, 1, 1) # Date Makeability Lab was formed
MAX_BANNERS = 7 # Maximum number of banners on a page

Expand Down
10 changes: 4 additions & 6 deletions website/templates/snippets/display_award_snippet.html
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,11 @@ <h3 class="award-title">

{% if award.organization %}<p class="award-org">{{ award.organization }}</p>{% endif %}

{# Recipients, then publicly-visible projects (private ones omitted, #1300). The
endfor/connector/for junctions are kept whitespace-tight on one line so the
output reads "Name, Project" and never "Name , Project". #}
<p class="award-recipients">
{% for person in award.recipients.all %}<a href="{% url 'website:member_by_name' person.get_url_name %}">{{ person.get_full_name }}</a>{% if not forloop.last %}, {% endif %}{% endfor %}

{% if award.recipients.exists and award.get_visible_projects.exists %}, {% endif %}

{# Only list publicly-visible projects so private projects aren't named here (#1300) #}
{% for project in award.get_visible_projects %}<a href="{% url 'website:project' project.short_name %}">{{ project.name }}</a>{% if not forloop.last %}, {% endif %}{% endfor %}
{% for person in award.recipients.all %}<a href="{% url 'website:member_by_name' person.get_url_name %}">{{ person.get_full_name }}</a>{% if not forloop.last %}, {% endif %}{% endfor %}{% if award.recipients.exists and award.get_visible_projects.exists %}, {% endif %}{% for project in award.get_visible_projects %}<a href="{% url 'website:project' project.short_name %}">{{ project.name }}</a>{% if not forloop.last %}, {% endif %}{% endfor %}
</p>

{% if award.description %}
Expand Down
22 changes: 11 additions & 11 deletions website/templates/website/awards.html
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ <h1>Makeability Lab Awards</h1>

<!-- ===== People & project distinctions, sectioned by award_type ===== -->
{% for section in distinction_sections %}
<section aria-labelledby="section-{{ section.label|slugify }}-heading">
<h2 id="section-{{ section.label|slugify }}-heading" class="heading-with-anchor">
<section aria-labelledby="{{ section.label|slugify }}">
<h2 id="{{ section.label|slugify }}" class="heading-with-anchor">
{{ section.label }}
<a href="#section-{{ section.label|slugify }}-heading" class="header-anchor"
<a href="#{{ section.label|slugify }}" class="header-anchor"
aria-label="Link to {{ section.label }} section">
<i class="fa-solid fa-link" aria-hidden="true"></i>
</a>
Expand All @@ -71,10 +71,10 @@ <h2 id="section-{{ section.label|slugify }}-heading" class="heading-with-anchor"
{% endfor %}

<!-- ===== Best Paper Awards ===== -->
<section aria-labelledby="best-paper-awards-heading">
<h2 id="best-paper-awards-heading" class="heading-with-anchor">
Best Paper Awards
<a href="#best-paper-awards-heading" class="header-anchor"
<section aria-labelledby="best-paper-awards">
<h2 id="best-paper-awards" class="heading-with-anchor">
Best Paper Awards ({{ best_paper_pubs|length }})
<a href="#best-paper-awards" class="header-anchor"
aria-label="Link to Best Paper Awards section">
<i class="fa-solid fa-link" aria-hidden="true"></i>
</a>
Expand All @@ -90,10 +90,10 @@ <h2 id="best-paper-awards-heading" class="heading-with-anchor">
</section>

<!-- ===== Other Paper Awards ===== -->
<section aria-labelledby="other-paper-awards-heading">
<h2 id="other-paper-awards-heading" class="heading-with-anchor">
Other Paper Awards
<a href="#other-paper-awards-heading" class="header-anchor"
<section aria-labelledby="other-paper-awards">
<h2 id="other-paper-awards" class="heading-with-anchor">
Other Paper Awards ({{ other_award_pubs|length }})
<a href="#other-paper-awards" class="header-anchor"
aria-label="Link to Other Paper Awards section">
<i class="fa-solid fa-link" aria-hidden="true"></i>
</a>
Expand Down
33 changes: 33 additions & 0 deletions website/tests/test_award.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
than in a SimpleTestCase.
"""

import re
from datetime import date

from django.urls import reverse
Expand Down Expand Up @@ -115,3 +116,35 @@ def test_awards_page_renders_card_with_year_and_anchor_kind(self):
self.assertIn("award-card", html)
self.assertIn("award-card--medal", html) # faculty honor -> medal anchor
self.assertIn("2017", html) # prominent year is rendered

def test_recipient_and_project_join_has_no_stray_space(self):
# Regression: the recipient/project connector rendered as "Name , Project"
# due to template whitespace between the two loops.
person = self.make_person(first_name="Chu", last_name="Li")
project = self.make_project(name="AltGeoViz", short_name="altgeoviz", is_visible=True)
award = Award.objects.create(title="People's Choice Award", date=date(2024, 10, 29),
award_type=AwardType.PROJECT_AWARD)
award.recipients.set([person])
award.projects.set([project])

html = self.client.get(reverse("website:awards")).content.decode()
# Strip tags (names sit inside <a>…</a>), then collapse whitespace, so we
# compare the *visible* text the way a reader sees it.
text = re.sub(r"\s+", " ", re.sub(r"<[^>]+>", "", html))
self.assertIn("Chu Li, AltGeoViz", text)
self.assertNotIn("Chu Li , AltGeoViz", text)

def test_section_anchors_are_clean_and_paper_sections_show_counts(self):
self.make_publication(title="A Great Paper", year=2020, award="Best Paper Award")
Award.objects.create(title="A Faculty Honor", date=date(2017, 5, 1),
award_type=AwardType.FACULTY_HONOR).recipients.set([self.make_person()])

html = self.client.get(reverse("website:awards")).content.decode()
# Clean, shareable anchor IDs (no verbose 'section-...-heading').
self.assertIn('id="faculty-honors"', html)
self.assertIn('id="best-paper-awards"', html)
self.assertNotIn("section-faculty-honors-heading", html)
self.assertNotIn("best-paper-awards-heading", html)
# Paper-section counts.
self.assertIn("Best Paper Awards (1)", html)
self.assertIn("Other Paper Awards (0)", html)
Loading