Add select all feature to stash tabs

This commit is contained in:
2025-09-25 20:58:20 +02:00
parent f25180c3cf
commit 78c22bc84f
2 changed files with 16 additions and 2 deletions

View File

@@ -0,0 +1,13 @@
function toggleSelectAll(tabIndex) {
const tab = document.querySelector(`[data-tab="${tabIndex}"]`);
const checkboxes = tab.querySelectorAll('input[type="checkbox"]');
if (checkboxes.length === 0)
return;
const allSelected = Array.from(checkboxes).every(cb => cb.checked);
checkboxes.forEach(cb => {
cb.checked = !allSelected;
});
}

View File

@@ -4,13 +4,14 @@
<meta charset="utf-8"> <meta charset="utf-8">
<title>Shared Stash</title> <title>Shared Stash</title>
<link rel="stylesheet" href="/static/style.css" /> <link rel="stylesheet" href="/static/style.css" />
<script src="/static/helpers.js"></script>
<head> <head>
<body> <body>
<form action="/stash/{{stash_name}}/store" method="POST"> <form action="/stash/{{stash_name}}/store" method="POST">
{% for tab in stash.tabs %} {% for tab in stash.tabs %}
{% set tabloop = loop %} {% set tabloop = loop %}
<h2>Tab {{tabloop.index}}</h2> <h2>Tab {{tabloop.index}} <button type="button" onclick="toggleSelectAll({{tabloop.index}})">Select All</button> </h2>
<div class="stash-tab"> <div class="stash-tab" data-tab="{{tabloop.index}}">
{% for item in tab.items %} {% for item in tab.items %}
{% set itemloop = loop %} {% set itemloop = loop %}
{% include "item.html" %} {% include "item.html" %}