Add edit_button and edit_delete_buttons macros to detail_cards.html. All 7 entity detail pages now show an Edit button next to Delete when authenticated. Each detail template struct receives a pre-computed edit_url from the route handler.
57 lines
1.9 KiB
HTML
57 lines
1.9 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 · {{ gear.make }} {{ gear.model }}{% endblock %}
|
|
{% block og_title %}{{ gear.make }} {{ gear.model }} — Brewlog{% endblock %}
|
|
{% block og_description %}
|
|
{{ gear.make }}
|
|
{{ gear.model }}
|
|
— {{ gear.category_label }}
|
|
{% 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("gear", gear.id, image_url, is_authenticated) }}
|
|
<div class="flex flex-col gap-1 min-w-0">
|
|
<h1 class="text-2xl font-semibold truncate">
|
|
{{ gear.make }} {{ gear.model }}
|
|
</h1>
|
|
<p class="text-sm text-text-secondary">
|
|
<a
|
|
href="/data?type=gear"
|
|
class="text-accent hover:text-accent-hover transition"
|
|
>Gear</a
|
|
>
|
|
· {{ gear.created_date }}
|
|
</p>
|
|
</div>
|
|
</div>
|
|
</header>
|
|
{{ img::lightbox_script() }}
|
|
|
|
<div class="rounded-lg border bg-surface p-5">
|
|
<h2 class="text-lg font-semibold text-text mb-4">Details</h2>
|
|
<dl class="grid grid-cols-2 gap-x-4 gap-y-3 text-sm">
|
|
<div>
|
|
<dt class="text-text-muted">Category</dt>
|
|
<dd class="font-medium text-text">{{ gear.category_label }}</dd>
|
|
</div>
|
|
<div>
|
|
<dt class="text-text-muted">Make</dt>
|
|
<dd class="font-medium text-text">{{ gear.make }}</dd>
|
|
</div>
|
|
<div>
|
|
<dt class="text-text-muted">Model</dt>
|
|
<dd class="font-medium text-text">{{ gear.model }}</dd>
|
|
</div>
|
|
</dl>
|
|
</div>
|
|
|
|
{% if is_authenticated %}
|
|
{{ detail::edit_delete_buttons(edit_url, "gear", "/api/v1/gear", gear.id) }}
|
|
{% endif %}
|
|
{% endblock %}
|