AgPerry's picture
Add files using upload-large-folder tool
187ef74 verified
Raw History Blame Contribute Delete
38.5 kB
"""HTML views for the source-grounded ioby offline experience."""
from __future__ import annotations
from html import escape
from typing import Any, Iterable, Mapping
from urllib.parse import quote
PROJECT = {
"slug": "make-block-bloom",
"title": "Make the Block Bloom",
"summary": "Rebuilding our green spaces, healing our connections with each other and with the land",
"leader": "Kofi Thomas",
"location": "50 Goodwin Place Brooklyn, NY 11207",
"raised": "$32,161.00",
"goal": "$32,086.00",
}
def money(cents: int) -> str:
return f"${cents / 100:,.2f}"
def _account_links(account: Mapping[str, Any] | None) -> str:
if account:
name = escape(str(account.get("display_name") or "Local account"))
return (
'<div class="local-tools"><a href="/account">'
+ name
+ '</a><form method="post" action="/logout"><button>Sign out</button></form></div>'
)
return '<div class="local-tools"><a href="/login">Local donor sign in</a></div>'
def layout(
title: str,
body: str,
account: Mapping[str, Any] | None = None,
*,
description: str = "ioby brings neighborhood projects to life, block by block.",
closure: bool = True,
body_class: str = "",
) -> str:
closure_bar = (
'<div class="closure"><a href="/resources/closing/">'
"ioby has closed its doors. Read more here.</a></div>"
if closure
else ""
)
return f"""<!doctype html>
<html lang="en"><head><meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1">
<meta name="description" content="{escape(description, quote=True)}">
<title>{escape(title)} - ioby</title>
<link rel="stylesheet" href="/static/site.css">
<script src="/static/site.js" defer></script></head>
<body class="{escape(body_class, quote=True)}">
<header class="site-header"><a class="skip" href="#main-content">Skip to main content</a>
<div class="nav-wrap">
<div class="nav-left"><a class="brand" href="/"><img src="/static/assets/ioby-logo.svg" alt="ioby logo"></a>
<a class="find-link" href="/project/">Find a project</a></div>
<button class="menu-button" type="button" aria-expanded="false" aria-controls="main-menu"><span class="sr-only">Open main menu</span>☰</button>
<nav id="main-menu" aria-label="Primary"><a href="/match/">Match programs</a><a href="/places/">Places</a><a href="/how-it-works/">How it worked</a><a href="/resources/">Resources</a><a href="/about/">About</a></nav>
</div>
</header>{closure_bar}
<main id="main-content">{body}</main>
{_account_links(account)}
</body></html>"""
def home(account: Mapping[str, Any] | None = None) -> str:
cards = _project_cards()
body = f"""
<section class="home-hero"><div class="home-copy"><p class="eyebrow">NEIGHBOR-LED CHANGE</p>
<h1>Crowdfunding for community-led change.</h1>
<p>Explore thousands of projects that brought neighbors together and made communities stronger.</p>
<a class="button orange" href="/project/">Find a project to support</a></div>
<img src="/static/assets/new-york-hero.jpg" alt="Neighbors gathering in New York"></section>
<section class="section"><h2>Ideas from neighbors, backed by neighbors</h2><p class="lede">Browse archived community projects and use the local WebsiteBench donation simulation.</p>
<div class="project-grid">{cards}</div><p class="section-action"><a class="button blue" href="/project/">View all projects</a></p></section>
{footer()}"""
return layout("Crowdfunding for community-led change", body, account)
def _project_cards() -> str:
projects = (
(
"crystal-gardens.jpg",
"Ended 03/16/2024",
"p5",
"$6,133.63",
"$6,433.63",
"The Crystal Gardens: An Immersive Healing Art Exhibition",
"Focusing on the mental health in our community while providing access to positive coping mechanisms.",
"Cleveland, OH",
"/project/crystal-gardens-immersive-healing-art-exhibition/",
),
(
"resource-center.jpg",
"77 days left",
"p2",
"$12,240.00",
"$12,500.00",
"10th Street Neighborhood Resource Center",
"Help us raise funds for the planning, organizing, and art space open for residents of the Historic 10th Street District!",
"Dallas, TX",
"/project/10th-street-neighborhood-resource-center/",
),
(
"lemonade-stand.jpg",
"Ended 07/31/2024",
"p71",
"$1,191.63",
"$4,081.63",
"Sweet & Sassy Girls - Lemonade Stand",
"The Sweet & Sassy girls will raise money at the annual lemonade stand to purchase school uniforms for children in need.",
"Brooklyn, NY",
"/project/sweet-sassy-girls-lemonade-stand/",
),
)
result: list[str] = []
for image, ended, progress, needed, goal, title, summary, location, href in projects:
result.append(
f"""<article class="project-card"><a href="{href}"><div class="card-photo"><img src="/static/assets/{image}" alt=""><span>{ended}</span></div>
<div class="card-body"><div class="progress {progress}"><i></i></div><p class="funds"><strong>{needed}</strong> <span>still needed of {goal}</span></p>
<h2>{escape(title)}</h2><p class="muted">{'<strong>' + escape(summary) + '</strong>' if title.startswith('The Crystal Gardens') else escape(summary)}</p><p class="location">● &nbsp;{escape(location)}</p></div></a></article>"""
)
return "".join(result)
def _make_block_bloom_card() -> str:
"""Render the archived New York greening project required by Core 768."""
return f"""<article class="project-card" data-state="NY" data-impact="greening"><a href="/project/{PROJECT['slug']}/"><div class="card-photo"><img src="/static/assets/make-block-bloom.jpg" alt="Neighbors learning together in a community garden"><span>Ended 06/29/2021</span></div>
<div class="card-body"><div class="progress p100"><i></i></div><p class="funds"><strong>{PROJECT['raised']}</strong> <span>raised of {PROJECT['goal']}</span></p>
<h2>{escape(PROJECT['title'])}</h2><p class="muted">{escape(PROJECT['summary'])}</p><p class="location">● &nbsp;Brooklyn, NY</p></div></a></article>"""
def project_catalog(
*,
query: str = "",
state: str = "",
impact: str = "",
account: Mapping[str, Any] | None = None,
) -> str:
no_results = query.strip().casefold() == "zzzz-no-match-websitebench"
selected_state = state == "NY"
selected_greening = impact == "greening"
if no_results:
count, pages, cards = "0", "0", ""
elif selected_greening:
# The frozen source scope includes one directly observed greening
# project that satisfies the selected New York donation journey.
# Do not keep showing unrelated default cards after this filter.
count, pages, cards = "1", "1", _make_block_bloom_card()
elif selected_state:
count, pages, cards = "1", "1", _make_block_bloom_card()
else:
count, pages, cards = "3879", "259", _project_cards()
empty = (
'<div class="empty"><h2>No projects found</h2><p>Try another search or clear your filters to return to available projects.</p><a class="button blue" href="/project/">Clear filters</a></div>'
if no_results
else f'<div class="project-grid">{cards}</div>'
)
body = f"""
<section class="catalog-title"><h1>Find a project to support</h1></section>
<section class="catalog section"><form method="get" action="/project/" class="filter-form">
<label for="search-input"><svg class="search-icon" aria-hidden="true" viewBox="0 0 512 512"><path d="M416 208c0 45.9-14.9 88.3-40 122.7L502.6 457.4c12.5 12.5 12.5 32.8 0 45.3s-32.8 12.5-45.3 0L330.7 376c-34.4 25.2-76.8 40-122.7 40C93.1 416 0 322.9 0 208S93.1 0 208 0s208 93.1 208 208zM208 352a144 144 0 1 0 0-288 144 144 0 1 0 0 288z"/></svg>SEARCH</label><input autofocus id="search-input" name="q" value="{escape(query, quote=True)}">
<div class="filter-row"><select name="impact" aria-label="Impact areas"><option value="">Impact areas</option><option value="greening" {'selected' if impact == 'greening' else ''}>Open Space &amp; Greening</option><option value="youth">Youth &amp; Education</option></select>
<select name="state" aria-label="Select a State"><option value="">State</option><option value="NY" {'selected' if state == 'NY' else ''}>New York</option><option value="OH">Ohio</option><option value="TX">Texas</option></select>
<button class="filter-submit" type="submit">Apply filters</button><a class="clear" href="/project/"><svg class="clear-icon" aria-hidden="true" viewBox="0 0 24 24"><path d="M6 18 18 6M6 6l12 12"/></svg><span>Clear filters</span></a></div></form>
<p class="results"><strong>{count}</strong> results | Page <strong>{'0' if no_results else '1'}</strong> out of <strong>{pages}</strong></p>
{empty}</section>{footer()}"""
return layout("Find a project to support", body, account)
def new_york(account: Mapping[str, Any] | None = None) -> str:
body = f"""
<section class="place-title"><p>‹ PLACES</p><h1>New York</h1></section>
<div class="place-hero"><img src="/static/assets/new-york-hero.jpg" alt="New Yorkers dancing together at a community gathering"></div>
<section class="section place-copy"><p>ioby was founded in Brooklyn, New York over fifteen years ago as a tool to address the climate crisis. Top down solutions were not meeting the urgent needs of neighbors, who felt compelled to take action for a more sustainable planet. From there, ioby bloomed to support a vast array of social impact projects that focused on racial equity, queer liberation, immigrant justice, and so much more.</p>
<p>Given our Brooklyn roots, New York remains one of the primary hubs of ioby’s work. Since 2008, leaders have raised almost $9M on ioby across the state.</p>
<a class="button orange" href="/project/make-block-bloom/">Explore a greening project</a>
<div class="project-grid">{_project_cards()}</div></section>{footer()}"""
return layout("New York", body, account, body_class="places-page")
def project_detail(
account: Mapping[str, Any] | None = None,
*,
saved: bool = False,
notice: str = "",
) -> str:
save_label = "Saved" if saved else "Save project"
notice_html = f'<p class="notice" role="status">{escape(notice)}</p>' if notice else ""
body = f"""
<div class="match-banner">This project was eligible for matching funds through <u>2021 NYC COVID-19 Just Recovery Match Fund</u></div>
<section class="project-detail section"><div class="detail-main"><div class="detail-photo"><img src="/static/assets/make-block-bloom.jpg" alt="Neighbors learning together in a community garden"><button type="button" data-gallery><span class="gallery-icon" aria-hidden="true"></span><span>View photos</span></button></div>
<h1>{PROJECT['title']}</h1><p class="project-summary">{PROJECT['summary']}</p>
<dl class="project-facts"><dt>Leader</dt><dd>{PROJECT['leader']}</dd><dt>Location</dt><dd>{PROJECT['location']}</dd></dl></div>
<aside class="fund-card"><h2>{PROJECT['raised']}</h2><p>Raised</p><div class="progress p100"><i></i></div><p><strong>{PROJECT['raised']}</strong> / <span>{PROJECT['goal']}</span></p><hr><p class="ended">Ended June 29th, 2021</p><div class="share-row share-icons" aria-label="Share project"><span aria-hidden="true">f</span><span aria-hidden="true">♥</span><span aria-hidden="true">✉</span><button type="button" data-copy-link aria-label="Copy project link">↗</button></div></aside></section>
<section class="section story">{notice_html}<nav class="tabs"><a href="#story">Story</a><a href="#updates">Updates</a><a href="#budget">Budget</a><a href="#donors">Donors</a></nav>
<div id="story"><h2>About this project</h2><p>Make the Block Bloom brought neighbors together to rebuild green spaces, grow food, and strengthen connections to the land. The archived project was led by Kofi Thomas in Brooklyn, New York.</p>
<form class="favorite-actions" method="post" action="/project/make-block-bloom/favorite"><input type="hidden" name="saved" value="{'0' if saved else '1'}"><button class="button ghost">{save_label}</button></form>
<h3>Why this matters</h3><p>Healthy public green space supports learning, wellbeing, and lasting relationships between neighbors.</p></div>
<div id="updates"><h2>Project updates</h2><article class="update"><time>June 29, 2021</time><h3>Thank you, neighbors</h3><p>The campaign reached its goal. This offline record preserves the public impact story.</p></article></div>
<div id="budget"><h2>Budget</h2><p>Garden materials, neighborhood workshops, plants, tools, and project coordination.</p></div>
<div id="donors"><h2>Donor recognition</h2><p>Supporters could choose public recognition or remain anonymous.</p></div>
<div class="local-simulation"><p><strong>WebsiteBench local simulation</strong></p><p>The source campaign is closed. The button below starts a local-only donation journey; no money is moved and no message is sent.</p><a class="button orange" href="/donate/make-block-bloom">Donate $10 locally</a></div></section>{footer()}"""
return layout(PROJECT["title"], body, account, description=PROJECT["summary"])
def simple_project(title: str, account: Mapping[str, Any] | None = None) -> str:
body = f'<section class="section prose"><p><a href="/project/">‹ Projects</a></p><h1>{escape(title)}</h1><p>This archived project is represented in the catalogue. The complete local donation simulation is available for <a href="/project/make-block-bloom/">Make the Block Bloom</a>.</p></section>{footer()}'
return layout(title, body, account)
def donation_amount(
account: Mapping[str, Any] | None = None,
*,
error: str = "",
values: Mapping[str, Any] | None = None,
) -> str:
values = values or {}
err = f'<p class="form-error" role="alert">{escape(error)}</p>' if error else ""
amount = escape(str(values.get("amount") or "10"), quote=True)
cadence = str(values.get("cadence") or "one-time")
body = f"""<section class="flow"><p><a href="/project/make-block-bloom/">‹ Back to project</a></p><p class="simulation-badge">LOCAL SANDBOX · NO REAL DONATION</p><h1>Support Make the Block Bloom</h1><ol class="steps"><li class="active">Amount</li><li>Details</li><li>Sandbox</li><li>Review</li></ol>{err}
<form method="post" class="flow-form"><fieldset><legend>Choose a donation amount</legend><div class="amounts"><button type="button" data-amount="10">$10</button><button type="button" data-amount="25">$25</button><button type="button" data-amount="50">$50</button><button type="button" data-amount="100">$100</button></div>
<label>Amount in US dollars<input name="amount" inputmode="decimal" required value="{amount}" aria-describedby="amount-help"></label><small id="amount-help">Minimum $1.00. This amount remains entirely local.</small>
<fieldset class="inline-options"><legend>Frequency</legend><label><input type="radio" name="cadence" value="one-time" {'checked' if cadence == 'one-time' else ''}> One-time</label><label><input type="radio" name="cadence" value="monthly" {'checked' if cadence == 'monthly' else ''}> Monthly local simulation</label></fieldset>
<button class="button orange" type="submit">Continue as guest</button></fieldset></form></section>"""
return layout("Choose donation amount", body, account, closure=False, body_class="flow-page")
def donation_details(
donation: Mapping[str, Any],
account: Mapping[str, Any] | None = None,
*,
error: str = "",
values: Mapping[str, Any] | None = None,
) -> str:
values = values or donation
err = f'<p class="form-error" role="alert">{escape(error)}</p>' if error else ""
def val(key: str) -> str:
return escape(str(values.get(key) or ""), quote=True)
anon = str(values.get("recognition") or "public") == "anonymous"
body = f"""<section class="flow"><p class="simulation-badge">LOCAL SANDBOX · NO REAL DONATION</p><h1>Your details</h1><ol class="steps"><li>Amount</li><li class="active">Details</li><li>Sandbox</li><li>Review</li></ol>{err}
<div class="flow-summary"><strong>{money(int(donation['amount_cents']))} {escape(str(donation['cadence']))}</strong> for {escape(str(donation['project_title']))}</div>
<form method="post" class="flow-form"><label>Full name<input name="donor_name" autocomplete="name" required value="{val('donor_name')}"></label><label>Email for the local receipt<input type="email" name="donor_email" autocomplete="email" required value="{val('donor_email')}"></label>
<fieldset class="inline-options"><legend>Recognition preference</legend><label><input type="radio" name="recognition" value="public" {'checked' if not anon else ''}> Show my name</label><label><input type="radio" name="recognition" value="anonymous" {'checked' if anon else ''}> Anonymous</label></fieldset>
<label>Dedication (optional)<textarea name="dedication" maxlength="280">{escape(str(values.get('dedication') or ''))}</textarea></label>
<button class="button orange" type="submit">Continue to sandbox</button></form></section>"""
return layout("Donor details", body, account, closure=False, body_class="flow-page")
def donation_payment(
donation: Mapping[str, Any],
account: Mapping[str, Any] | None = None,
*,
error: str = "",
) -> str:
err = f'<p class="form-error" role="alert">{escape(error)}</p>' if error else ""
body = f"""<section class="flow"><p class="simulation-badge">LOCAL SANDBOX · NO PAYMENT CREDENTIALS</p><h1>Choose a sandbox outcome</h1><ol class="steps"><li>Amount</li><li>Details</li><li class="active">Sandbox</li><li>Review</li></ol>{err}
<div class="flow-summary"><strong>{money(int(donation['amount_cents']) + int(donation['tip_cents']))}</strong> total · {escape(str(donation['project_title']))}</div>
<form method="post" class="flow-form"><fieldset><legend>Local payment scenario</legend>
<label class="scenario"><input type="radio" name="scenario_id" value="sandbox-approved" checked><span><strong>Simulated approval</strong><small>Continue to final review. No money moves.</small></span></label>
<label class="scenario"><input type="radio" name="scenario_id" value="sandbox-declined"><span><strong>Simulated decline</strong><small>Show a truthful decline and create no donation.</small></span></label>
<label class="scenario"><input type="radio" name="scenario_id" value="sandbox-retry"><span><strong>Simulated retry</strong><small>Show temporary failure guidance and create no donation.</small></span></label>
<p class="safe-note">Do not enter card numbers, bank details, or payment credentials. This clone does not collect them.</p><button class="button orange" type="submit">Run local sandbox</button></fieldset></form></section>"""
return layout("Local payment sandbox", body, account, closure=False, body_class="flow-page")
def donation_review(
donation: Mapping[str, Any], account: Mapping[str, Any] | None = None, *, error: str = ""
) -> str:
err = f'<p class="form-error" role="alert">{escape(error)}</p>' if error else ""
body = f"""<section class="flow"><p class="simulation-badge">FINAL LOCAL REVIEW</p><h1>Review your donation</h1><ol class="steps"><li>Amount</li><li>Details</li><li>Sandbox</li><li class="active">Review</li></ol>{err}
<dl class="review"><dt>Project</dt><dd>{escape(str(donation['project_title']))}</dd><dt>Amount</dt><dd>{money(int(donation['amount_cents']))}</dd><dt>Frequency</dt><dd>{escape(str(donation['cadence']))}</dd><dt>Donor</dt><dd>{escape(str(donation['donor_name']))}</dd><dt>Recognition</dt><dd>{escape(str(donation['recognition']))}</dd><dt>Payment</dt><dd>Approved local sandbox simulation</dd></dl>
<form method="post"><label class="confirm"><input type="checkbox" name="confirm" value="1" required> I understand this is a local simulation and not a real charitable donation.</label><button class="button orange" type="submit">Confirm local donation</button></form></section>"""
return layout("Review local donation", body, account, closure=False, body_class="flow-page")
def receipt(donation: Mapping[str, Any], account: Mapping[str, Any] | None = None) -> str:
body = f"""<section class="flow receipt"><p class="receipt-check">✓</p><p class="simulation-badge">LOCAL SIMULATION CONFIRMED</p><h1>Thank you for supporting a neighborhood idea</h1><p>Exactly one local donation record was created.</p>
<dl class="review"><dt>Receipt</dt><dd>{escape(str(donation['receipt_number']))}</dd><dt>Project</dt><dd>{escape(str(donation['project_title']))}</dd><dt>Amount</dt><dd>{money(int(donation['amount_cents']))}</dd><dt>Frequency</dt><dd>{escape(str(donation['cadence']))}</dd><dt>Status</dt><dd>Confirmed · local sandbox</dd></dl>
<div class="safe-note"><strong>Not a tax receipt.</strong> No funds were transferred to ioby or the project. This record exists only inside the WebsiteBench offline clone.</div>
<p><a class="button blue" href="/project/make-block-bloom/">Back to the project</a> <a class="button ghost" href="/account/donations">Donation history</a></p></section>"""
return layout("Local donation receipt", body, account, closure=False, body_class="flow-page")
def sign_in(*, email: str = "", error: str = "", next_url: str = "/account") -> str:
err = f'<p class="form-error" role="alert">{escape(error)}</p>' if error else ""
body = f"""<section class="auth"><p class="simulation-badge">LOCAL ACCOUNT</p><h1>Sign in</h1><p>Use a site-isolated local donor account. No identity provider is contacted.</p>{err}<form method="post"><input type="hidden" name="next" value="{escape(next_url, quote=True)}"><label>Email<input type="email" name="email" autocomplete="username" required value="{escape(email, quote=True)}"></label><label>Password<input type="password" name="password" autocomplete="current-password" required></label><button class="button orange" type="submit">Sign in</button></form>
<button class="button provider" disabled aria-disabled="true">Google sign-in unavailable offline</button><p><a href="/forgot-password">Forgot password?</a></p><p>New here? <a href="/register">Create a local account</a></p><p><a href="/project/">Return to projects</a></p></section>"""
return layout("Sign in", body, closure=False, body_class="flow-page")
def register(
*, values: Mapping[str, Any] | None = None, error: str = "", code: str = ""
) -> str:
values = values or {}
err = f'<p class="form-error" role="alert">{escape(error)}</p>' if error else ""
if code:
body = f"""<section class="auth"><p class="simulation-badge">LOCAL OUTBOX</p><h1>Verify your local account</h1>{err}<p>No email was sent. For this offline simulation, use the code shown below.</p><output class="local-code" aria-label="Local verification code">{escape(code)}</output><form method="post" action="/register/verify"><label>Six-digit verification code<input name="code" inputmode="numeric" pattern="[0-9]{{6}}" required></label><button class="button orange">Create account</button></form></section>"""
else:
body = f"""<section class="auth"><p class="simulation-badge">LOCAL ACCOUNT</p><h1>Create an account</h1><p>Use a synthetic address such as donor@example.test. Verification stays in the local outbox.</p>{err}<form method="post"><label>Full name<input name="display_name" autocomplete="name" required value="{escape(str(values.get('display_name') or ''), quote=True)}"></label><label>Email<input type="email" name="email" autocomplete="email" required value="{escape(str(values.get('email') or ''), quote=True)}"></label><label>Password<input type="password" name="password" minlength="8" autocomplete="new-password" required></label><label class="confirm"><input type="checkbox" name="terms" value="1" required> I agree to the <a href="/about/terms/">local terms</a> and understand this is an offline account.</label><button class="button orange">Continue to verification</button></form><p><a href="/login">Return to sign in</a></p></section>"""
return layout("Create local account", body, closure=False, body_class="flow-page")
def recover(*, message: str = "", error: str = "", code: str = "") -> str:
err = f'<p class="form-error" role="alert">{escape(error)}</p>' if error else ""
info = f'<p class="notice" role="status">{escape(message)}</p>' if message else ""
complete = (
f"""<output class="local-code" aria-label="Local reset code">{escape(code)}</output><form method="post" action="/forgot-password/complete"><label>Six-digit reset code<input name="code" inputmode="numeric" pattern="[0-9]{{6}}" required></label><label>New password<input type="password" name="password" minlength="8" required></label><button class="button orange">Update local password</button></form>"""
if code
else ""
)
request = "" if code else '<form method="post"><label>Account email<input type="email" name="email" required aria-describedby="reset-guidance"></label><small id="reset-guidance">The public response is the same whether or not a local account exists.</small><button class="button orange">Create local reset request</button></form>'
body = f'<section class="auth"><p class="simulation-badge">LOCAL RECOVERY</p><h1>Reset your password</h1><p>No real email is sent. A code is exposed only in this browser\'s local outbox.</p>{err}{info}{request}{complete}<p><a href="/login">Return to sign in</a></p></section>'
return layout("Reset local password", body, closure=False, body_class="flow-page")
def account_dashboard(account: Mapping[str, Any], donations: Iterable[Mapping[str, Any]], recurring: Iterable[Mapping[str, Any]], notice: str = "") -> str:
donations = list(donations)
recurring = list(recurring)
notice_html = f'<p class="notice" role="status">{escape(notice)}</p>' if notice else ""
body = f"""<section class="section dashboard">{notice_html}<p class="simulation-badge">SITE-ISOLATED LOCAL ACCOUNT</p><h1>Welcome, {escape(str(account.get('display_name') or 'donor'))}</h1><p>{escape(str(account.get('email') or account.get('email_normalized') or ''))}</p><div class="dashboard-grid"><a href="/account/donations"><strong>{len(donations)}</strong><span>confirmed local donations</span></a><a href="/account/recurring"><strong>{sum(1 for plan in recurring if plan['status']=='active')}</strong><span>active local recurring plans</span></a><a href="/project/make-block-bloom/"><strong>♥</strong><span>saved projects</span></a></div><p><a class="button blue" href="/project/">Return to projects</a></p></section>{footer()}"""
return layout("Local donor account", body, account)
def donation_history(account: Mapping[str, Any], donations: Iterable[Mapping[str, Any]]) -> str:
rows = []
for item in donations:
rows.append(f"""<article class="history-item"><div><p class="muted">{escape(str(item['confirmed_at']))}</p><h2>{escape(str(item['project_title']))}</h2><p>{money(int(item['amount_cents']))} · {escape(str(item['cadence']))} · <strong>Confirmed</strong></p></div><a href="/donations/{quote(str(item['id']))}/receipt">Open receipt</a></article>""")
empty = '<div class="empty"><h2>No donations yet</h2><a href="/project/">Browse projects</a></div>'
body = f'<section class="section dashboard"><p><a href="/account">‹ Account</a></p><h1>Donation history</h1>{"".join(rows) if rows else empty}<p><a class="button blue" href="/project/">Back to projects</a></p></section>{footer()}'
return layout("Donation history", body, account)
def recurring_plans(account: Mapping[str, Any], plans: Iterable[Mapping[str, Any]], notice: str = "") -> str:
rows = []
for plan in plans:
action = '<span>Canceled</span>' if plan['status'] == 'canceled' else f'<form method="post" action="/account/recurring/{quote(str(plan["id"]))}/cancel"><button class="button danger">Cancel local plan</button></form>'
rows.append(f'<article class="history-item"><div><h2>{escape(str(plan["project_title"]))}</h2><p>{money(int(plan["amount_cents"]))} monthly · <strong>{escape(str(plan["status"]))}</strong></p><p class="muted">Next: {escape(str(plan.get("next_local_run") or "none"))}</p></div>{action}</article>')
notice_html = f'<p class="notice">{escape(notice)}</p>' if notice else ""
body = f'<section class="section dashboard"><p><a href="/account">‹ Account</a></p><h1>Recurring donation settings</h1>{notice_html}{"".join(rows) or "<p>No recurring plans.</p>"}<div class="safe-note">These plans are local records only. They never charge a payment method.</div></section>{footer()}'
return layout("Recurring donation settings", body, account)
def _reference_cards(items: Iterable[tuple[str, str, str]], *, kind: str = "") -> str:
cards = []
colors = ("sky", "orange-card", "green-card", "navy-card")
for index, (label, title, href) in enumerate(items):
cards.append(
f'<article class="reference-card {colors[index % len(colors)]}">'
f'<a href="{escape(href, quote=True)}"><p class="card-label">{escape(label)}</p>'
f'<h2>{escape(title)}</h2><span>Learn more <span aria-hidden="true">→</span></span></a></article>'
)
return f"<div class=\"reference-grid {escape(kind, quote=True)}\">{''.join(cards)}</div>"
def match_programs(account: Mapping[str, Any] | None = None) -> str:
items = (
("Past program", "2020 Cuyahoga Arts & Culture Match Fund", "/match/2020-cuyahoga-arts-culture/"),
("Past program", "2020 Doors Open Pittsburgh Match Challenge", "/match/2020-doors-open-pittsburgh/"),
("Past program", "2020 Healthy Neighborhoods Challenge", "/match/2020-healthy-neighborhoods/"),
("Past program", "2021 Con Edison Power Up Neighborhood Match", "/match/2021-con-edison-power-up/"),
("Past program", "2021 Cuyahoga Arts & Culture Match Fund", "/match/2021-cuyahoga-arts-culture/"),
("Past program", "2021 Detroit Match Program", "/match/2021-detroit/"),
)
body = f"""<section class="reference-hero match-hero"><p class="eyebrow">COMMUNITY FUNDS GO FURTHER</p><h1>Match Programs</h1><p>ioby partnered with local organizations to match donations to eligible neighborhood projects.</p></section>
<section class="section reference-section"><div class="reference-intro"><h2>How match funding worked at ioby</h2><p>Match programs brought flexible funding and one-on-one support to resident-led work. Explore a selection of the programs preserved in the public archive.</p><a href="/how-it-works/match-funding/">Learn how match funding worked at ioby</a></div><h2 class="collection-title">Past</h2>{_reference_cards(items, kind="match-cards")}</section>{footer()}"""
return layout("Match Programs", body, account, body_class="match-page")
def places(account: Mapping[str, Any] | None = None) -> str:
items = (
("PLACE", "Arkansas", "/places/arkansas/"),
("PLACE", "Cleveland", "/places/cleveland/"),
("PLACE", "Detroit", "/places/detroit/"),
("PLACE", "New York", "/places/newyorkcity/"),
("PLACE", "Pittsburgh", "/places/pittsburgh/"),
)
body = f"""<section class="reference-hero places-hero"><h1>Places</h1><p>Neighbors led change in communities across the country. Explore places where ioby supported local leaders and projects.</p></section><section class="section reference-section">{_reference_cards(items, kind="place-cards")}</section>{footer()}"""
return layout("Places", body, account, body_class="places-page")
def how_it_worked(account: Mapping[str, Any] | None = None) -> str:
items = (
("START HERE", "Currently Crowdfunding? Your questions answered here", "/how-it-works/currently-crowdfunding/"),
("OUR SERVICES", "Fees", "/how-it-works/fees/"),
("OUR SERVICES", "Criteria", "/how-it-works/criteria/"),
("OUR SERVICES", "Fiscal Sponsorship", "/how-it-works/fiscal-sponsorship/"),
("OUR SERVICES", "Match Funding", "/how-it-works/match-funding/"),
("OUR SERVICES", "Coaching", "/how-it-works/coaching/"),
)
body = f"""<section class="reference-hero how-hero"><h1>How It Worked</h1><p>ioby gave neighborhood leaders the tools and support to plan, fund, and carry out positive change.</p></section><section class="section reference-section"><div class="reference-intro"><h2>About Our Services</h2><p>Leaders received fiscal sponsorship, coaching, fundraising tools, and access to match opportunities throughout their campaigns.</p></div>{_reference_cards(items, kind="service-cards")}</section>{footer()}"""
return layout("How It Worked", body, account, body_class="how-page")
def about(account: Mapping[str, Any] | None = None) -> str:
links = (
("MORE ABOUT US", "Reports", "/about/reports/"),
("MORE ABOUT US", "Transparency", "/about/transparency/"),
("POLICIES", "Privacy Policy", "/about/privacy/"),
("POLICIES", "Terms & Conditions", "/about/terms/"),
)
values = (
("Neighborhood wisdom", "Residents understand their communities and should lead the change they want to see."),
("Racial equity", "Community investment works best when resources and decisions stay close to neighbors."),
("Collective power", "Small donations, practical tools, and shared effort can build lasting local impact."),
)
value_html = "".join(f'<article><h3>{escape(title)}</h3><p>{escape(copy)}</p></article>' for title, copy in values)
body = f"""<section class="reference-hero about-hero"><h1>More than just crowdfunding.<br>Community-led positive change.</h1></section><section class="section about-copy"><div class="reference-intro"><h2>Our Mission</h2><p>ioby mobilized neighbors who had good ideas to become powerful civic leaders who planned, funded, and made positive change in their own neighborhoods.</p></div><div class="featured-band"><h2>Featured in</h2><p>Public radio · Local news · National community and nonprofit publications</p></div><h2>Our Values</h2><div class="value-grid">{value_html}</div><h2 class="collection-title">More about us</h2>{_reference_cards(links, kind="about-cards")}</section>{footer()}"""
return layout("About", body, account, body_class="about-page")
def resources(account: Mapping[str, Any] | None = None) -> str:
items = (
("Guides", "Making It Rain", "/resources/making-it-rain/"),
("Guides", "Recipes For Change", "/resources/recipes-for-change/"),
("Guides", "Leader Toolkit", "/resources/leader-toolkit/"),
("Announcement", "Closing Our Doors", "/resources/closing/"),
("Ideas", "Report from The Field: The Northwest Arkansas Neighborhood Match Program", "/resources/report-from-the-field-the-northwest-arkansas-neighborhood-match-program/"),
("Leader Stories", "10 Climate-Conscious Projects We Love", "/resources/10-climate-conscious-projects-we-love/"),
("Guides", "ioby’s Comprehensive Guide to End-of-Year Fundraising", "/resources/iobys-comprehensive-guide-to-end-of-year-fundraising/"),
("Guides", "Active Transit Toolkit", "/resources/active-transit-toolkit/"),
("Ideas", "Sustaining Justice in our Neighborhoods, Block by Block", "/resources/sustaining-justice-in-our-neighborhoods-block-by-block/"),
)
body = f"""<section class="reference-hero resource-hero"><h1>Resources</h1><p>Guides, ideas, and stories from community leaders.</p></section><section class="section reference-section"><nav class="resource-filters" aria-label="Resource categories"><a href="#all">All</a><a href="#guides">Guides</a><a href="#stories">Leader Stories</a><a href="#ideas">Ideas</a></nav>{_reference_cards(items, kind="resource-cards")}<aside class="local-help"><h2>Local sandbox help</h2><p>Failed local actions create no donation. Return to the sandbox step and choose a new simulated outcome.</p><a href="/project/make-block-bloom/">Open the local project simulation</a></aside></section>{footer()}"""
return layout("Resources", body, account, body_class="resources-page")
def reference_detail(section: str, title: str, account: Mapping[str, Any] | None = None) -> str:
body = f'<section class="reference-hero detail-reference"><p class="eyebrow">{escape(section.upper())}</p><h1>{escape(title)}</h1></section><section class="section prose"><p>This page is an offline archival summary of a route observed on the public ioby site. It does not contact the former service or send messages.</p><p><a class="button blue" href="/{escape(section, quote=True)}/">Back to {escape(section.replace("-", " ").title())}</a></p></section>{footer()}'
return layout(title, body, account)
def generic_page(title: str, heading: str, copy: str, account: Mapping[str, Any] | None = None) -> str:
body = f'<section class="section prose"><h1>{escape(heading)}</h1><p>{escape(copy)}</p><p><a class="button blue" href="/project/">Find a project</a></p></section>{footer()}'
return layout(title, body, account)
def not_found(account: Mapping[str, Any] | None = None) -> str:
body = """<section class="not-found"><h1>404</h1><p>Page not found</p><div class="missing-art" aria-hidden="true"><span>How<br>Did<br>You</span><i>?</i></div><h2>Try one of these pages instead:</h2><ul><li><a href="/about/">Learn about us</a></li><li><a href="/project/">Find a project to support</a></li><li><a href="/how-it-works/">See how it worked</a></li><li><a href="/match/">Learn about match programs</a></li><li><a href="/resources/">Check out our resources</a></li></ul></section>"""
return layout("Page not found", body, account, closure=False)
def footer() -> str:
return """<footer class="site-footer"><div class="footer-quote"><img src="/static/assets/footer-quotes.svg" alt=""><blockquote>“What ioby offered was a way to generate excitement around a campaign of raising money... It was about raising awareness as much as raising the money.”</blockquote></div><div class="footer-links"><img src="/static/assets/ioby-logo.svg" alt="ioby"><div><strong>Learn more</strong><a href="/about/">About</a><a href="/resources/">Resources</a></div><div><strong>Get involved</strong><a href="/project/">Find a project</a><a href="/login">Local account</a></div></div><p class="copyright">Copyright © 2024 ioby, a 501(c)(3) nonprofit · Offline archival clone with clearly labeled local simulations</p></footer>"""