Create Bookmarklet (browser bookmark that executes Javsacript) to copy a Git branching name from Redmine to Clipboard.
Format: feature/[issue #]-[issue title]
(can be changed bellow).
This is the base javascript:
(function(text){
let splash = document.createElement("div")
let msg = document.createElement("span")
splash.style = "cursor:pointer;position:fixed;top:0;left:0;width:100vw;height:100vh;display:flex;justify-content:center;align-items:center;background:#FFF;z-index:999999"
msg.textContent = "Click to copy to clipboard: " + text
splash.append(msg)
splash.onclick = evt => {
let node = document.createElement("textarea"),
selection = document.getSelection();
node.textContent = text,
document.body.appendChild(node),
selection.removeAllRanges(),
node.select(),
document.execCommand("copy"),
selection.removeAllRanges(),
document.body.removeChild(node),
document.body.removeChild(splash)
}
document.body.append(splash)
})(jQuery(".category.attribute .value").html().replace("Evolution", "feature").replace("Bug", "fix").concat("/", location.href.replace(/\?.+/, "").replace(/.*\//, "").concat("-").concat(jQuery(".subject h3").html().replace(/[\W_]+/g, "-"))))
Minify it (you can use Closure Compiler Service or any other) to get something like this:
(function(d){var a=document.createElement("div"),b=document.createElement("span");a.style="cursor:pointer;position:fixed;top:0;left:0;width:100vw;height:100vh;display:flex;justify-content:center;align-items:center;background:#FFF;z-index:999999";b.textContent="Click to copy to clipboard: "+d;a.append(b);a.onclick=function(c){c=document.createElement("textarea");var b=document.getSelection();c.textContent=d;document.body.appendChild(c);b.removeAllRanges();c.select();document.execCommand("copy");b.removeAllRanges();document.body.removeChild(c);document.body.removeChild(a)};document.body.append(a)})(jQuery(".category.attribute .value").html().replace("Evolution","feature").replace("Bug","fix").concat("/",location.href.replace(/\?.+/,"").replace(/.*\//,"").concat("-").concat(jQuery(".subject h3").html().replace(/[\W_]+/g,"-"))));
Prefix it with javascript:
:
javascript:(function(d){var a=document.createElement("div"),b=document.createElement("span");a.style="cursor:pointer;position:fixed;top:0;left:0;width:100vw;height:100vh;display:flex;justify-content:center;align-items:center;background:#FFF;z-index:999999";b.textContent="Click to copy to clipboard: "+d;a.append(b);a.onclick=function(c){c=document.createElement("textarea");var b=document.getSelection();c.textContent=d;document.body.appendChild(c);b.removeAllRanges();c.select();document.execCommand("copy");b.removeAllRanges();document.body.removeChild(c);document.body.removeChild(a)};document.body.append(a)})(jQuery(".category.attribute .value").html().replace("Evolution","feature").replace("Bug","fix").concat("/",location.href.replace(/\?.+/,"").replace(/.*\//,"").concat("-").concat(jQuery(".subject h3").html().replace(/[\W_]+/g,"-"))));
Then add it as a new bookmark, or edit existing bookmark to add in the URL field.
To change copied stuff edit this line:
jQuery(".category.attribute .value").html().replace("Evolution", "feature").replace("Bug", "fix").concat("/", location.href.replace(/\?.+/, "").replace(/.*\//, "").concat("-").concat(jQuery(".subject h3").html().replace(/[\W_]+/g, "-")))