clone

a personal forge on plain git: static pages, stacked-diff reviews, signed local ci, repo sites and releases

main
forge / site / repo / review-diff.njk
review-diff.njk 3.6K
1---2pagination:3 data: forge.pages.reviewDiffs4---5{% extends "base.njk" %}6{% import "macros.njk" as m with context %}7{% import "ui.njk" as ui %}8{% set rv = p.review %}9{% block head %}{{ m.reviewMeta(rv, p.repo, p.title, p.repo.urls.reviewDiff(rv.id).href) }}{% endblock %}10{% block scripts %}<script src="{{ assets.diffs }}" defer></script>11<script src="{{ assets.discuss }}" defer></script>12{% endblock %}13{% block content %}14{% css %}15/* Line comments under their lines; they look like the discussion's (discussion.njk). */16.cmt { border-top: var(--hairline) solid var(--border); }17.cmt:target { box-shadow: inset var(--bar) 0 0 var(--accent); }18.cmt-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--space-half) var(--space-3); padding: var(--space-2) var(--space-3) 0; font-size: var(--text-sm); }19.cmt-head a, .cmt-head .date { font: var(--fw-regular) var(--text-xs) var(--mono); }20.cmt-head time { font-size: inherit; }21.cmt-head .tag { font-size: var(--text-sm); font-weight: var(--fw-medium); color: var(--warn); }22.cmt-head a { color: var(--muted); }23.cmt .markdown { padding: var(--space-1) var(--space-3) var(--space-2); font-size: var(--text-md); line-height: 1.6; }24.cmt .markdown > :last-child { margin-bottom: 0; }25/* In a diff, a comment is as wide as the code box, not its longest line. */26.code:has(.cmts) { container-type: inline-size; }27.code .cmts { position: sticky; left: 0; width: 100cqw; padding: 0 var(--space-3) var(--space-2); background: var(--tint); border-block: var(--hairline) solid var(--border); font: var(--fw-regular) var(--text-md)/1.5 var(--sans); white-space: normal; }28.code .cmts > .cmt:first-child { border-top: 0; }29.code .cmts > form { padding-top: var(--space-2); }30/* A new line comment, signed in (discuss.ts): the + on the line under the31 pointer (or the line last clicked) opens a form under it. */32.commenting .code.diff .rows { position: relative; }33.addline { position: absolute; z-index: 2; width: 20px; height: 17px; min-height: 0; padding: 0; font: var(--fw-strong) var(--text-sm)/15px var(--sans); text-align: center; color: var(--on-accent); background: var(--accent); border-color: var(--accent); }34.addline:hover { color: var(--on-accent); background: var(--accent-hover); border-color: var(--accent-hover); }35.cmts .where { font: var(--fw-regular) var(--text-xs)/1.6 var(--mono); color: var(--muted); margin-bottom: var(--space-1); overflow-wrap: anywhere; }36.cmts textarea { min-height: 5em; }37.cmts .reply-bar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); margin-top: var(--space-2); font-size: var(--text-sm); }38.cmts .reply-bar .grow { flex: 1; }39.cmts .reply-status.bad { color: var(--fail); white-space: pre-line; }40.cmt.pending { border-top-style: dashed; }41.cmt.pending .text { padding: var(--space-2) var(--space-3); white-space: pre-wrap; overflow-wrap: anywhere; color: var(--muted); }42{% endcss %}43<div class="meta-head">44<h1><a href="{{ p.repo.urls.review(rv.id).href }}" data-key="u">{{ rv.title }}</a> <span class="desc">#{{ rv.id }}</span></h1>45<div class="byline">Combined diff of {{ rv.layer.length | plural('commit') }} on <span class="mono">{{ rv.branch }}</span></div>46</div>47<p class="desc" id="line-comments" data-post="{{ p.repo.urls.review(rv.id).href }}" data-at="{{ rv.tip }}" hidden></p>48{% set tools %}<span class="count" data-viewed="{{ p.repo.slug }}" hidden></span>{{ ui.checkbox('wrap lines', false, 'data-wrap') }}{% endset %}49{{ rv.combined | diffstatHtml('', tools) | safe }}50{{ rv.combined | diffHtml(p.repo, '', rv.branch if rv.live else null, rv, true) | safe }}51{% endblock %}