This commit is contained in:
Tobias Wohlleben 2025-03-11 22:05:59 +01:00
commit b0dae6ff5c
3 changed files with 33 additions and 4 deletions

View File

@ -1,5 +1,5 @@
<!DOCTYPE html>
<html lang="en" xmlns:x-on="http://www.w3.org/1999/xhtml">
<html lang="en" xmlns:x-on="http://www.w3.org/1999/xhtml" xmlns:x-bind="http://www.w3.org/1999/xhtml">
<head>
<!-- Basic Page Needs -->
@ -44,6 +44,9 @@
<table class="u-full-width">
<thead>
<tr>
<th>
<input type="checkbox" x-on:click="checkItems" />
</th>
<th>Workshop ID</th>
<th>Titel</th>
</tr>
@ -51,12 +54,16 @@
<tbody>
<template x-for="item in items" :key="item.id">
<tr>
<td>
<input type="checkbox" x-on:click="checkItem" x-model="checkedItems" x-bind:value="item" class="checkbox"/>
</td>
<td x-text="item.id"></td>
<td x-text="item.title"></td>
</tr>
</template>
</tbody>
</table>
<span x-text="JSON.stringify(checkedItems)"></span>
</div>
</div>
</template>

View File

@ -15,8 +15,26 @@ document.addEventListener('alpine:init', () => {
ids: '2694448564;2875848298;3290232938',
items: [],
loading: false,
checkedItems: [],
checkItem(e) {
let checkedItem = e.target.value;
console.log('checkedItem', checkedItem);
let checkbox = document.querySelectorAll('.checkbox').find(cb => cb.value === checkedItem.id);
checkbox.checked = e.target.checked;
console.log(this.checkedItems);
},
checkItems(e) {
if (e.target.checked) {
this.checkedItems = this.items;
} else {
this.checkedItems = [];
}
console.log(this.checkedItems);
},
async getModDescription() {
this.loading = true;
let idList = this.ids.split(';'); // distinct here or ananlyze and show hint
const responses = await Promise.all(idList.map(id =>
@ -33,7 +51,7 @@ document.addEventListener('alpine:init', () => {
this.items.push(item);
});
});
this.loading = false;
}
}))

View File

@ -41,5 +41,9 @@ module.exports = {
},
historyApiFallback: true
},
performance: {
hints: false,
maxEntrypointSize: 512000,
maxAssetSize: 512000
}
}