Add repo-link to badge markdown in UI (#753)

Co-authored-by: Anbraten <anton@ju60.de>
This commit is contained in:
9p4 2022-02-06 16:05:02 -05:00 committed by GitHub
parent 5f79739bc0
commit 8ce41788e8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -20,7 +20,7 @@
<div> <div>
<h2 class="text-lg text-gray-500 ml-2">Markdown</h2> <h2 class="text-lg text-gray-500 ml-2">Markdown</h2>
<pre class="box">![status-badge]({{ baseUrl }}{{ badgeUrl }})</pre> <pre class="box">[![status-badge]({{ baseUrl }}{{ badgeUrl }})]({{ baseUrl }}{{ repoUrl }})</pre>
</div> </div>
</div> </div>
</Panel> </Panel>
@ -47,8 +47,15 @@ export default defineComponent({
return `/api/badges/${repo.value.owner}/${repo.value.name}/status.svg`; return `/api/badges/${repo.value.owner}/${repo.value.name}/status.svg`;
}); });
const repoUrl = computed(() => {
if (!repo) {
throw new Error('Unexpected: "repo" should be provided at this place');
}
return { baseUrl, badgeUrl }; return `/${repo.value.owner}/${repo.value.name}`;
});
return { baseUrl, badgeUrl, repoUrl };
}, },
}); });
</script> </script>