Skip to content

Commit

Permalink
Color code patch comments
Browse files Browse the repository at this point in the history
dark red = -2
red = -1
gray = no comment
yellow = +1
green = +2
  • Loading branch information
jrobson committed Apr 3, 2013
1 parent 6672e7d commit 47ae00a
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,25 @@ function silentNoise( $commentPanel ) {
} );
}

function colorComment( $commentPanel ) {
var heading = $commentPanel.find( '.commentPanelMessage p' ).eq( 0 ).text(),
color = '#aaa';
if ( heading.match( /Code\-Review\-2$/ ) ) {
color = '#C90505';
} else if ( heading.match( /Code\-Review\-1$/ ) ) {
color = 'red';
} else if ( heading.match( /Code\-Review\+1$/ ) ) {
color = 'yellow';
} else if ( heading.match( /Code\-Review\+2$/ ) ) {
color = 'green';
}
$commentPanel.css( {
'border-left': 'solid 10px ' + color,
'border-top-left-radius': 0,
'border-bottom-left-radius': 0
} );
}

function listener( ev ) {
var $t = $( ev.target ), $owner, author, action;
if ( $t.hasClass( 'commentPanel' ) ) { // force open comment panel
Expand All @@ -19,6 +38,7 @@ function listener( ev ) {
} else {
$t.find( '.commentPanelContent' ).show();
}
colorComment( $t );
} else if ( $t.hasClass( 'gwt-DisclosurePanel' ) ) { // open patchset
$( '.gwt-DisclosurePanel-closed tbody tr' ).trigger( 'click' ); // HACK! not optimal
} else if ( $t.children( '.changeTable' ).length > 0 ) {
Expand Down

0 comments on commit 47ae00a

Please sign in to comment.