-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added shortcode and script to fetch and display decentralized service…
…s issues from GitHub API.
- Loading branch information
Showing
1 changed file
with
33 additions
and
0 deletions.
There are no files selected for viewing
33 changes: 33 additions & 0 deletions
33
themes/freenet/layouts/shortcodes/decentralized-services-issues.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<div id="decentralized-services-issues"> | ||
<p>Loading...</p> | ||
</div> | ||
|
||
<script> | ||
async function fetchDecentralizedServicesIssues() { | ||
const response = await fetch('https://api.github.com/repos/freenet/freenet-core/issues?state=open&labels=A-decentralized-services'); | ||
const issues = await response.json(); | ||
const container = document.getElementById('decentralized-services-issues'); | ||
container.innerHTML = ''; | ||
|
||
if (issues.length === 0) { | ||
container.innerHTML = '<p>No open issues found with the "A-decentralized-services" label.</p>'; | ||
return; | ||
} | ||
|
||
const list = document.createElement('ul'); | ||
issues.forEach(issue => { | ||
const listItem = document.createElement('li'); | ||
const date = new Date(issue.created_at).toLocaleDateString('en-US', { | ||
year: 'numeric', | ||
month: 'long', | ||
day: 'numeric' | ||
}); | ||
listItem.innerHTML = `<strong>${date}</strong> - <a href="${issue.html_url}" target="_blank">${issue.title}</a> by ${issue.user.login}`; | ||
list.appendChild(listItem); | ||
}); | ||
|
||
container.appendChild(list); | ||
} | ||
|
||
fetchDecentralizedServicesIssues(); | ||
</script> |