mirror of
https://github.com/caddyserver/website.git
synced 2025-04-29 16:29:14 -04:00
feat(redesign): retrieve from URL
This commit is contained in:
parent
85ec18c9a6
commit
ee662393d0
4 changed files with 92 additions and 44 deletions
|
@ -49,7 +49,11 @@
|
|||
<option value="windows-arm-7">Windows arm 7</option>
|
||||
<option value="windows-arm64">Windows arm64</option>
|
||||
</select>
|
||||
<button class="primary">Download</button>
|
||||
<a id="download-link" href="https://localhost/api/download">
|
||||
<button class="primary">
|
||||
Download
|
||||
</button>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div id="command" onclick="copyCommand()">
|
||||
|
@ -91,33 +95,6 @@
|
|||
const getCardTemplate = item => `{{ include "/includes/card.html" }}`;
|
||||
const modulesCount = document.getElementById('modules-count');
|
||||
|
||||
function renderList(list) {
|
||||
if (groupBy === 'type') {
|
||||
const groupedData = Object.entries(packageManager.group(groupBy)).filter(([_, items]) => !!items.length)
|
||||
document.getElementById('side-panel-packages').innerHTML = `
|
||||
<div>
|
||||
<h2 class="blue">Namespaces</h2>
|
||||
${groupedData.map(([k]) => `<a href="#${k}"> ${k}</a>`).join('')}
|
||||
</div>`;
|
||||
document.getElementById('packages').innerHTML = groupedData.map(([category, items]) => `
|
||||
<section id="${category}">
|
||||
<h2 class="blue">${category}</h2>
|
||||
<div class="card-list">${items.map(item => getCardTemplate({ ...item, state: packages.includes(item.path) })).join('')}</div>
|
||||
</section>`).join('')
|
||||
return;
|
||||
}
|
||||
|
||||
document.getElementById('side-panel-packages').innerHTML = '';
|
||||
document.getElementById('packages').innerHTML = `
|
||||
<div class="card-list">
|
||||
${list.map(item => getCardTemplate({ ...item, state: packages.includes(item.path) })).join('')}
|
||||
</div>`;
|
||||
};
|
||||
|
||||
packageManager.getPackages().then(() => {
|
||||
renderList(packageManager.group(groupBy))
|
||||
})
|
||||
|
||||
document.getElementById('search-package').addEventListener('input', ({ target: { value } }) => {
|
||||
packageManager.setFilterValue(value.toLowerCase());
|
||||
renderList(packageManager.group(groupBy))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue