Created
February 4, 2011 19:00
-
-
Save unixmonkey/811566 to your computer and use it in GitHub Desktop.
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
| // This javascript file is intened to make redmine_backlogs | |
| // look and behave just a bit more like Pivotal Tracker to | |
| // help ease the transition | |
| $(function(){ | |
| // make backlogs less hideous | |
| apply_styles(); | |
| // refresh browser every half hour to prevent js memory bloat | |
| setTimeout("window.location.reload(true)", 30*60*1000); | |
| // make adjustments every 5 seconds | |
| setInterval("make_backlogs_usable()", 5000); | |
| // Long story titles are cut off, hover to see the whole thing | |
| $('div.subject').each(function(){ | |
| $(this).attr('title', $(this).text()); | |
| }); | |
| }); | |
| function make_backlogs_usable(){ | |
| update_story_colors(); | |
| rearrange_current_sprint(); | |
| } | |
| function apply_styles(){ | |
| // add style tag to the bottom of <head> | |
| $('<style id="pivotal_css" type="text/css" rel="stylesheet" media="screen"/>').appendTo('head')[0]; | |
| $('#pivotal_css').append( | |
| 'div.header { background-color: #333 !important; color: #fff !important; }'+ | |
| '.sprint { color: #fff; }'+ | |
| '.prevent_edit { color: #fff; background-color: #333 !important; opacity: 0.6; }'+ | |
| '.ui-icon { background-image: url("http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.5/themes/smoothness/images/ui-icons_888888_256x240.png"); }'+ | |
| 'li.story:hover { background-color: #d1e0ed !important; }'+ | |
| '#product_backlog_container li.story { background-color: #e4eff7 !important; }' | |
| ); | |
| update_story_colors(); | |
| } | |
| function update_story_colors(){ | |
| $('li.story > div.status_id > div.t').each(function(){ | |
| var state = this.innerHTML; | |
| var row = $(this).parents('li.story'); | |
| if (state == 'In Progress') { | |
| row.css('background-color','#f3f3d1'); | |
| } else if (state == 'Closed' || state == 'Resolved') { | |
| row.css('background-color','#daebcf'); | |
| } else if (state == 'New') { | |
| row.css('background-color','#f4f4f4'); | |
| } | |
| }); | |
| } | |
| function rearrange_current_sprint() { | |
| var state_names = ['Closed','Resolved','In Progress','Rejected','New','Backlogged']; | |
| $.each( state_names, function(idx,state_name){ | |
| var current_sprint = $('#sprint_backlogs_container > .backlog > .stories:first'); | |
| $('#sprint_backlogs_container > .backlog > .stories:first').children().each(function(){ | |
| var state = $(this).find('div.status_id > div.t').html(); | |
| if (state == state_name) { | |
| $(this).appendTo( current_sprint ); | |
| } | |
| }); | |
| }); | |
| } |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Rearrange the current sprint every 5 seconds