Skip to content

Instantly share code, notes, and snippets.

@adonaldson
Created February 15, 2011 16:54
Show Gist options
  • Select an option

  • Save adonaldson/827795 to your computer and use it in GitHub Desktop.

Select an option

Save adonaldson/827795 to your computer and use it in GitHub Desktop.
(function() {
var lighthouse_token = '';
var base_url = "https://harmonypark.lighthouseapp.com";
var ticket_url = prompt("Ticket url?");
if (ticket_url === null) {
return;
}
var url_segments = ticket_url.replace(base_url + '/', '').split("/");
var project_id = parseInt(url_segments[1], 10);
var ticket_id = parseInt(url_segments[3], 10);
if (isNaN(project_id) || isNaN(ticket_id)) {
alert("Couldn't find the project / ticket ID from the address you pasted.");
return;
}
var params = {
_token: lighthouse_token
};
$.getJSON(base_url + "/projects/" + project_id + "/tickets/" + ticket_id + ".json?callback=?", params, function(data) {
var ticket = data.ticket;
$("#reveal_create_inline_task").click();
$("#task_name").val("[" + ticket.number + "] " + ticket.title);
});
}());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment