Skip to content

Commit bb98f34

Browse files
committed
Feature: Added buttons "Copy to clipboard", and "Open ticket" on version page
1 parent 979c336 commit bb98f34

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

admin/version.xsl

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@
9393
<section class="box">
9494
<h3 class="box_title">Summary for reporting</h3>
9595
<xsl:for-each select="resource[@type='result']">
96-
<pre>
96+
<pre id="summary">
9797
<xsl:for-each select="value[@type!='structure']"><xsl:value-of select="@member" />: <xsl:value-of select="@value" /><xsl:text>
9898
</xsl:text></xsl:for-each>
9999
<xsl:for-each select="value[@member='uname' and @state='set']/value">uname: <xsl:value-of select="@member" />: <xsl:value-of select="@value" /><xsl:text>
@@ -106,7 +106,31 @@
106106
</xsl:text></xsl:for-each>
107107
</pre>
108108
</xsl:for-each>
109+
<ul class="boxnav">
110+
<li><a href="javascript:copy();">Copy to clipboard</a></li>
111+
<li><a href="javascript:openTicket();">Open ticket</a></li>
112+
</ul>
109113
</section>
110114
</xsl:for-each>
115+
<script>
116+
function getText() {
117+
const node = document.getElementById("summary");
118+
return node.textContent;
119+
}
120+
121+
function copy() {
122+
const text = getText();
123+
alert("Copied to clipboard: " + text);
124+
navigator.clipboard.writeText(text);
125+
}
126+
127+
function openTicket() {
128+
const baseurl = "http://gitlab.xiph.org/xiph/icecast-server/-/issues/new?issue[description]=";
129+
const basetext = "# Problem\r\n&lt;describe your problem here&gt;\r\n\r\n# Version Summary\r\n";
130+
const text = getText();
131+
132+
window.location.href = baseurl + encodeURIComponent(basetext + "```\r\n" + text + "```");
133+
}
134+
</script>
111135
</xsl:template>
112136
</xsl:stylesheet>

0 commit comments

Comments
 (0)