Skip to content

Instantly share code, notes, and snippets.

@tozevv
Created October 31, 2015 09:14
Show Gist options
  • Save tozevv/01112bfdc16c104d22de to your computer and use it in GitHub Desktop.
Save tozevv/01112bfdc16c104d22de to your computer and use it in GitHub Desktop.
JIRA copy versions between projects hack.
// do this in the console in the source project window
var jsonVersions = JSON.stringify(jQuery("tr.project-config-version").map(function(i, e) { var x = jQuery(e).data(); return { id: x.id,
description: x.description, name: x.name, startdate: x.startdate, releasedate: x.releasedate} }).toArray())
jsonVersions;
// copy the output of this
// do this in the console in the source project window
var JsonVersions = "pasteoutputhere";
var versions = JSON.parse(jsonVersions).reverse();
var addrows = function(versions)
{
var version = versions[0];
var row = jQuery("tr.project-config-versions-add-fields");
row.find("td.project-config-version-name input[name=name]").val(version.name)
row.find("td.project-config-version-description input[name=description]").val(version.description || "")
row.find("td.project-config-version-start-date input#project-config-version-start-date-field")
.val(version.startdate ? jQuery.datepicker.formatDate("dd/M/yy", new Date(version.startdate)) : "")
row.find("td.project-config-version-release-date input#project-config-version-release-date-field")
.val(version.releasedate ? jQuery.datepicker.formatDate("dd/M/yy", new Date(version.releasedate)) : "")
row.find("input[type=submit]").click();
if (versions.length > 1) setTimeout(function() { addrows(versions.slice(1)); }, 200);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment