Add generator and result page

This commit is contained in:
Valentin Brandl 2019-05-04 15:38:00 +02:00
parent d5e6bf7839
commit eb0ee4b31d
No known key found for this signature in database
GPG Key ID: 30D341DD34118D7D
2 changed files with 38 additions and 0 deletions

View File

@ -0,0 +1,23 @@
@use super::base;
@use crate::VersionInfo;
@(version_info: VersionInfo, domain: &str, url: &str, service: &str, path: &str)
@:base("Hits-of-Code Badges", "Badge Generator", {
<p>
Here is the markdown for the badge for <a href="https://@url/@path">@url/@path</a>
</p>
<pre>
[![Hits-of-Code](https://@domain/@service/@path)](https://@domain/view/@service/@path)
</pre>
<p>
It will be rendered like this
</p>
<pre>
<a href="https://@domain/view/@service/@path"><img src="https://@domain/@service/@path" alt="example badge" /></a>
</pre>
}, version_info)

View File

@ -45,6 +45,21 @@ would render this badge:
alt="example badge" /></a>
</pre>
<h2>Badge Generator</h2>
<form method="post" action="/generate">
<select name="service" id="service">
<option value="github">GitHub</option>
<option value="gitlab">Gitlab</option>
<option value="bitbucket">Bitbucket</option>
</select>
<label>/</label>
<input name="user" id="user" type="text" placeholder="user" />
<label>/</label>
<input name="repo" id="repo" type="text" placeholder="repository" />
<button type="submit">Generate</button>
</form>
<h2>Source Code</h2>
<p>