Created
January 18, 2016 16:39
-
-
Save felippenardi/6e1c1599b96dcfa582c7 to your computer and use it in GitHub Desktop.
Pivotal Tracker Branch Naming Generator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
javascript: (function ($) { | |
var storyTitles = []; | |
var story = $('.story .details').closest('.story').first(); | |
if(story){ | |
var title = story.find('.editor.name').val(); | |
var id = /story_(\d+)/.exec(story.attr('class'))[1]; | |
var storyType = story.find(".story_type .selection").text(); | |
var gitptTitle = id + '-' + title; | |
var translate = { | |
"ä": "ae", "ö": "oe", "ü": "ue", "ß": "ss" | |
}; | |
var cleanedTitle = storyType + "-" + gitptTitle.toLowerCase().replace(/[öäüß]/g, function(match) { | |
return translate[match]; | |
}).replace(/[^a-zA-Z0-9]+/g, "-").replace(/^-/, "").replace(/-$/, ""); | |
prompt('Your branch name:', cleanedTitle); | |
} else { | |
alert("Please select the stories first."); | |
} | |
})(jQuery); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment