Skip to content

Commit f15e250

Browse files
authored
Merge pull request #1394 from makeabilitylab/1271-mobile-project-page-sidebar
Redesign mobile project-page sidebar with chips + info-list (#1271)
2 parents 6189f43 + 2182621 commit f15e250

8 files changed

Lines changed: 632 additions & 16 deletions

File tree

.pa11yci.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@
4040
"http://website:8000/news/1/",
4141
"http://website:8000/news/2/",
4242
"http://website:8000/news/3/",
43-
"http://website:8000/awards/"
43+
"http://website:8000/awards/",
44+
{
45+
"url": "http://website:8000/project/sidewalk/",
46+
"viewport": { "width": 414, "height": 896 }
47+
}
4448
]
4549
}

website/management/commands/seed_demo_projects.py

Lines changed: 62 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -83,18 +83,27 @@ class Command(BaseCommand):
8383
help = "Seed three demo projects (see file docstring) for visual testing of project page layouts."
8484

8585
def handle(self, *args, **opts):
86-
from website.models import Person, Project, Publication
86+
from website.models import Grant, Person, Project, Publication, Sponsor
8787
from website.models.project_role import LeadProjectRoleTypes, ProjectRole
8888

89-
self._wipe_prior(Person, Project, Publication)
90-
self.stdout.write(self.style.NOTICE("Creating demo people, projects, and publications…"))
89+
self._wipe_prior(Person, Project, Publication, Grant, Sponsor)
90+
self.stdout.write(self.style.NOTICE("Creating demo people, sponsors, projects, and publications…"))
9191

9292
people = self._make_demo_people(Person)
93-
self._make_demo_active_small(Project, ProjectRole, LeadProjectRoleTypes, people)
93+
sponsors = self._make_demo_sponsors(Sponsor)
94+
95+
small = self._make_demo_active_small(Project, ProjectRole, LeadProjectRoleTypes, people)
9496
active_tall = self._make_demo_active_tall(Project, ProjectRole, LeadProjectRoleTypes, people)
9597
ended_tall = self._make_demo_ended_tall(Project, ProjectRole, LeadProjectRoleTypes, people)
9698
tall_main = self._make_demo_tall_main_short_sidebar(Project, ProjectRole, LeadProjectRoleTypes, people)
9799

100+
# Sponsor coverage: small gets 1 sponsor; the others get the full 4 to
101+
# exercise multi-logo wrapping and verify the funding row layout.
102+
self._attach_grant(Grant, small, sponsors[:1], year=2024)
103+
self._attach_grant(Grant, active_tall, sponsors, year=2019)
104+
self._attach_grant(Grant, ended_tall, sponsors[:3], year=2018)
105+
self._attach_grant(Grant, tall_main, sponsors[:2], year=2024)
106+
98107
self._make_demo_publications(Publication, active_tall, people, count=15, start_year=2019, end_year=2025)
99108
self._make_demo_publications(Publication, ended_tall, people, count=15, start_year=2018, end_year=2022)
100109
self._make_demo_publications(Publication, tall_main, people, count=15, start_year=2024, end_year=2025)
@@ -111,17 +120,22 @@ def handle(self, *args, **opts):
111120
# ------------------------------------------------------------------
112121
# Cleanup
113122

114-
def _wipe_prior(self, Person, Project, Publication):
123+
def _wipe_prior(self, Person, Project, Publication, Grant, Sponsor):
115124
"""Delete any prior demo data so the command is safe to re-run."""
116125
n_projects = Project.objects.filter(short_name__startswith="demo-").count()
117126
n_people = Person.objects.filter(first_name="Demo").count()
118127
n_pubs = Publication.objects.filter(title__startswith="Demo Paper:").count()
119-
if n_projects or n_people or n_pubs:
128+
n_grants = Grant.objects.filter(title__startswith="Demo Grant:").count()
129+
n_sponsors = Sponsor.objects.filter(name__startswith="Demo ").count()
130+
if n_projects or n_people or n_pubs or n_grants or n_sponsors:
120131
self.stdout.write(self.style.WARNING(
121-
f"Removing prior demo data: {n_projects} projects, {n_people} people, {n_pubs} publications."
132+
f"Removing prior demo data: {n_projects} projects, {n_people} people, "
133+
f"{n_pubs} publications, {n_grants} grants, {n_sponsors} sponsors."
122134
))
123135
Publication.objects.filter(title__startswith="Demo Paper:").delete()
136+
Grant.objects.filter(title__startswith="Demo Grant:").delete()
124137
Project.objects.filter(short_name__startswith="demo-").delete()
138+
Sponsor.objects.filter(name__startswith="Demo ").delete()
125139
Person.objects.filter(first_name="Demo").delete()
126140

127141
# ------------------------------------------------------------------
@@ -164,13 +178,48 @@ def _make_demo_people(self, Person):
164178
people[last_name] = p
165179
return people
166180

181+
# --- Sponsors / Grants -------------------------------------------------
182+
183+
_SPONSORS = [
184+
("Demo Science Foundation", "DSF", "https://example.org/dsf"),
185+
("Demo Research Council", "DRC", "https://example.org/drc"),
186+
("Demo Tech Institute", "DTI", "https://example.org/dti"),
187+
("Demo Industry Partner", "DIP", "https://example.org/dip"),
188+
]
189+
190+
def _make_demo_sponsors(self, Sponsor):
191+
sponsors = []
192+
for name, short_name, url in self._SPONSORS:
193+
s = Sponsor.objects.create(
194+
name=name,
195+
short_name=short_name,
196+
url=url,
197+
alt_text=f"{name} logo",
198+
icon=_img(f"{short_name.lower()}_icon.gif"),
199+
)
200+
sponsors.append(s)
201+
return sponsors
202+
203+
def _attach_grant(self, Grant, project, sponsors, *, year):
204+
"""Create one Grant per sponsor and link it to the project."""
205+
from datetime import date as _date
206+
for idx, sponsor in enumerate(sponsors):
207+
grant = Grant.objects.create(
208+
title=f"Demo Grant: {project.short_name} / {sponsor.short_name} #{idx + 1}",
209+
sponsor=sponsor,
210+
date=_date(year, 1, 1),
211+
funding_amount=100000 * (idx + 1),
212+
grant_id=f"DEMO-{idx + 1}",
213+
)
214+
grant.projects.add(project)
215+
167216
# --- Project 1: short sidebar, active ----------------------------------
168217

169218
def _make_demo_active_small(self, Project, ProjectRole, Roles, people):
170219
proj = Project.objects.create(
171220
name="Demo Project: Active (Short Sidebar)",
172221
short_name="demo-active-small",
173-
is_visible=True, # demo projects are public so they render for visual testing
222+
is_visible=True, # demo projects exist for visual testing; make them public
174223
start_date=date(2024, 1, 1),
175224
end_date=None,
176225
summary="A small active demo project for visual testing of the short-sidebar case.",
@@ -196,9 +245,11 @@ def _make_demo_active_tall(self, Project, ProjectRole, Roles, people):
196245
proj = Project.objects.create(
197246
name="Demo Project: Active (Tall Sidebar — Sidewalk-like)",
198247
short_name="demo-active-tall",
199-
is_visible=True, # demo projects are public so they render for visual testing
248+
is_visible=True, # demo projects exist for visual testing; make them public
200249
start_date=date(2019, 1, 1),
201250
end_date=None,
251+
website="https://example.org/demo-sidewalk",
252+
data_url="https://example.org/demo-sidewalk/data",
202253
summary="A large active demo project with lots of current and former members — sidebar exceeds viewport height.",
203254
about="This project is intentionally large. Use it to confirm sidebar behavior when the sidebar is taller than the viewport. The 'Former Student Lead' and 'Former PI' headers should still include 'Former' because the project itself is active (only individual members' roles ended).",
204255
)
@@ -248,7 +299,7 @@ def _make_demo_ended_tall(self, Project, ProjectRole, Roles, people):
248299
proj = Project.objects.create(
249300
name="Demo Project: Ended (Tall Sidebar)",
250301
short_name="demo-ended-tall",
251-
is_visible=True, # demo projects are public so they render for visual testing
302+
is_visible=True, # demo projects exist for visual testing; make them public
252303
start_date=date(2018, 1, 1),
253304
end_date=proj_end,
254305
summary="A completed demo project for testing the 'Former-prefix-dropped' branch (#1245).",
@@ -288,7 +339,7 @@ def _make_demo_tall_main_short_sidebar(self, Project, ProjectRole, Roles, people
288339
proj = Project.objects.create(
289340
name="Demo Project: Tall Main + Short Sidebar",
290341
short_name="demo-tall-main-short-sidebar",
291-
is_visible=True, # demo projects are public so they render for visual testing
342+
is_visible=True, # demo projects exist for visual testing; make them public
292343
start_date=date(2024, 1, 1),
293344
end_date=None,
294345
summary="A project with only a few sidebar entries but lots of publications, so the main content is much taller than the sidebar.",

website/static/website/css/design-tokens.css

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,13 @@
111111
--color-badge-text: #0d5a8c; /* 5.0:1 on badge-bg - AA ✓ */
112112
--color-badge-text-hover: #083854;
113113

114+
/* Project status chip (#1271) — "Active" badge on project pages.
115+
Dark green text on a light green fill; the border is decorative (the
116+
text + fill convey state, so it isn't held to the 3:1 UI threshold). */
117+
--color-status-active-text: #1b5e20; /* 6.9:1 on --color-status-active-bg - AA ✓ */
118+
--color-status-active-bg: #e7f3e8;
119+
--color-status-active-border: #bfe0c1;
120+
114121
/* Awards */
115122
--color-award: #c25059; /* legacy red; used by the publications award label */
116123

0 commit comments

Comments
 (0)