Fri Apr 11 2025
Tucker McKnight
Shows the three most recent patches, with a working "copy pull command" button underneath each one.
7709cb53cc555176a2c4d6dda954c457402f5e64
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css">
{% for patch in repos[repo].patches | batch(3) | first %}
<h5 class="card-title ">Card title</h5>
<h6 class="card-subtitle mb-2 text-body-secondary">Card subtitle</h6>
<p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p>
<a href="#" class="card-link">Card link</a>
<a href="/repos/{{repo}}/patches/{{patch.hash}}" class="text-primary d-inline-block card-title text-decoration-none fs-5">{{patch.name}}</a>
<p class="card-subtitle fs-6 mb-2 text-body-secondary">{{patch.date}}</p>
<p class="card-subtitle fs-6 mb-2 text-body-secondary">{{patch.author}}</p>
<p class="card-text">{{patch.description | truncate(150)}}</p>
</div>
<div class="card my-3">
<div class="card-body" ><h5 class="card-title">Card title</h5><h6 class="card-subtitle mb-2 text-body-secondary" >Card subtitle</h6>
<p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p>
<a href="#" class="card-link">Card link</a>
<div class="card-footer">
<span class="card-link font-monospace" data-hash="{{patch.hash}}" id="copy-pull-{{loop.index}}">{{patch.hash | truncate(8, true, "")}}</span><button id="pull-button-{{loop.index}}" onclick="copyPull({{loop.index}})" class="btn btn-sm btn-outline-primary ms-2"><i class="bi-copy bi me-1"></i>Pull</button>
{% endfor %}
}
const copyPull = (index) => {
const spanElem = document.getElementById(`copy-pull-${index}`)
const hash = spanElem.attributes["data-hash"].value
const button = document.getElementById(`pull-button-${index}`)
navigator.clipboard.writeText(`darcs clone {{url}} -h ${hash}`).then(() => {
button.innerHTML = button.innerHTML.replace("Pull", "Copied")
})