brewlog/templates/pages/roast.html
Jon Seager 920931ba17
refactor: fix template review findings (security, macros, tokens)
Address findings from the templates code review:

- Fix XSS in admin.html onclick handlers via data attributes
- Fix XSS in 5 edit page signal initializations via JSON serialization
- Fix register.html token exposure by moving to data attribute
- Add entity_icon, quick_notes_toggles, add_form_submit macros
- Replace hardcoded colors with design tokens (warning, error, success)
- Add warning design tokens to CSS theme
- Scope MutationObserver to main element
- Add defer to webauthn.js script tags
- Refactor login/register JS to arrow functions
- Guard lightbox script behind image_url check
- Fix else-if to elif in 5 templates
2026-02-13 16:20:30 +00:00

47 lines
1.8 KiB
HTML

{% extends "base.html" %}
{% import "partials/detail_cards.html" as detail %}
{% import "partials/icons.html" as icons %}
{% import "partials/image_section.html" as img %}
{% block title %}Brewlog · {{ roast.name }}{% endblock %}
{% block og_title %}{{ roast.name }} — Brewlog{% endblock %}
{% block og_description %}
{{ roast.name }}
by {{ roast.roaster_name }} — {{ roast.origin }}
{% endblock %}
{% block head %}
<meta property="og:image" content="{{ base_url }}/static/og-image.png" />
{% endblock %}
{% block content %}
<header class="flex items-start justify-between gap-4">
<div class="flex items-center gap-4 min-w-0">
{{ img::image_thumbnail("roast", roast.id, image_url, is_authenticated) }}
<div class="flex flex-col gap-1 min-w-0">
<h1 class="text-2xl font-semibold truncate">{{ roast.name }}</h1>
<p class="text-sm text-text-secondary">
<a
href="/data?type=roasts"
class="text-accent hover:text-accent-hover transition"
>Roasts</a
>
· {{ roast.created_date }}
</p>
</div>
</div>
</header>
{% if image_url.is_some() %}
{{ img::lightbox_script() }}
{% endif %}
<div class="grid gap-6 md:grid-cols-2">
{{ detail::coffee_card(roast.name, roast.roaster_name, roast.origin, roast.origin_flag, roast.region, roast.producer, roast.process, roast.tasting_notes, roaster_slug, "") }}
{{ detail::map_with_legend(roast.map_countries, roast.map_max, roast.legend_entries) }}
</div>
<div class="grid gap-6 md:grid-cols-2">
{{ detail::roaster_card(roast.roaster_name, roast.roaster_country, roast.roaster_country_flag, roast.roaster_city, roast.roaster_homepage, roaster_slug) }}
</div>
{% if is_authenticated %}
{{ detail::edit_delete_buttons(edit_url, "roast", "/api/v1/roasts", roast.id) }}
{% endif %}
{% endblock %}