Skip to content

Commit

Permalink
Added print button to printables page
Browse files Browse the repository at this point in the history
  • Loading branch information
itzg committed Jan 1, 2025
1 parent 599f85a commit 44989ed
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/main/resources/static/css/printables.css
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,8 @@ body {
.controls {
display: none;
}
}

#printBtn {
margin-right: 1em;
}
12 changes: 11 additions & 1 deletion src/main/resources/templates/printables/whitecards.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,21 @@
</div>
<div class="controls">
<form method="get">
<button id="printBtn">Print</button>
<input type="hidden" name="offset" th:value="${offset + count}">
<input type="submit" value="Next">
<input type="submit" value="Get next">
<input type="number" id="count" name="count" min="1" size="2" th:value="${count}">
<label for="count">cards</label>
</form>
</div>

<script>
const printBtn = document.querySelector("#printBtn");
printBtn.addEventListener('click', () => {
// initiate print dialog
print();
});
</script>

</body>
</html>

0 comments on commit 44989ed

Please sign in to comment.