Fossil SCM

Add a copy button for the artifact hash on the /artifact page.

florian 2019-06-02 12:02 copybtn.js-demonstration
Commit 3aab0bfdc0175d622e20c027c6bfac7d5a37c063635cf39d23f4df74dc612ab4
1 file changed +9 -3
+9 -3
--- src/info.c
+++ src/info.c
@@ -2187,14 +2187,20 @@
21872187
}
21882188
zUuid = db_text("?", "SELECT uuid FROM blob WHERE rid=%d", rid);
21892189
if( isFile ){
21902190
@ <h2>Latest version of file '%h(zName)':</h2>
21912191
style_submenu_element("Artifact", "%R/artifact/%S", zUuid);
2192
- }else if( g.perm.Setup ){
2193
- @ <h2>Artifact %s(zUuid) (%d(rid)):</h2>
21942192
}else{
2195
- @ <h2>Artifact %s(zUuid):</h2>
2193
+ style_copy_button();
2194
+ @ <h2>Artifact
2195
+ @ <span class="copy-button" id="copy-artifacthash"
2196
+ @ data-copytarget="artifacthash" data-copylength="%d(hash_digits(1))">
2197
+ if( g.perm.Setup ){
2198
+ @ </span>&nbsp;<span id="artifacthash">%s(zUuid)</span> (%d(rid)):</h2>
2199
+ }else{
2200
+ @ </span>&nbsp;<span id="artifacthash">%s(zUuid)</span>:</h2>
2201
+ }
21962202
}
21972203
blob_zero(&downloadName);
21982204
asText = P("txt")!=0;
21992205
if( asText ) objdescFlags &= ~OBJDESC_BASE;
22002206
objType = object_description(rid, objdescFlags, &downloadName);
22012207
--- src/info.c
+++ src/info.c
@@ -2187,14 +2187,20 @@
2187 }
2188 zUuid = db_text("?", "SELECT uuid FROM blob WHERE rid=%d", rid);
2189 if( isFile ){
2190 @ <h2>Latest version of file '%h(zName)':</h2>
2191 style_submenu_element("Artifact", "%R/artifact/%S", zUuid);
2192 }else if( g.perm.Setup ){
2193 @ <h2>Artifact %s(zUuid) (%d(rid)):</h2>
2194 }else{
2195 @ <h2>Artifact %s(zUuid):</h2>
 
 
 
 
 
 
 
 
2196 }
2197 blob_zero(&downloadName);
2198 asText = P("txt")!=0;
2199 if( asText ) objdescFlags &= ~OBJDESC_BASE;
2200 objType = object_description(rid, objdescFlags, &downloadName);
2201
--- src/info.c
+++ src/info.c
@@ -2187,14 +2187,20 @@
2187 }
2188 zUuid = db_text("?", "SELECT uuid FROM blob WHERE rid=%d", rid);
2189 if( isFile ){
2190 @ <h2>Latest version of file '%h(zName)':</h2>
2191 style_submenu_element("Artifact", "%R/artifact/%S", zUuid);
 
 
2192 }else{
2193 style_copy_button();
2194 @ <h2>Artifact
2195 @ <span class="copy-button" id="copy-artifacthash"
2196 @ data-copytarget="artifacthash" data-copylength="%d(hash_digits(1))">
2197 if( g.perm.Setup ){
2198 @ </span>&nbsp;<span id="artifacthash">%s(zUuid)</span> (%d(rid)):</h2>
2199 }else{
2200 @ </span>&nbsp;<span id="artifacthash">%s(zUuid)</span>:</h2>
2201 }
2202 }
2203 blob_zero(&downloadName);
2204 asText = P("txt")!=0;
2205 if( asText ) objdescFlags &= ~OBJDESC_BASE;
2206 objType = object_description(rid, objdescFlags, &downloadName);
2207

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button