Skip to content

Commit

Permalink
Change status color when new status is selected
Browse files Browse the repository at this point in the history
Fixes #25651
  • Loading branch information
dregad committed Mar 29, 2019
1 parent 0e56fec commit 9fa21a3
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions js/common.js
Expand Up @@ -519,6 +519,26 @@ $(document).ready( function() {
var listobject = new List( this, listoptions );
$(this).data('listobject',listobject).data('listoptions',listoptions).addClass('listjs-table');
});

/**
* Change status color box's color when a different status is selected.
* To achieve that we need to store the current value in a data attribute,
* to compute the class name to remove in the change event.
*/
var statusColor = $('#status');
// Store current value
statusColor.data('prev', statusColor.val());
statusColor.change(function () {
function getColorClassName (statusCode) {
return 'status-' + statusCode + '-fg';
}

var me = $(this);
me.siblings('i')
.removeClass(getColorClassName(me.data('prev')))
.addClass(getColorClassName(me.val()));
me.data('prev', me.val());
});
});

function setBugLabel() {
Expand Down

0 comments on commit 9fa21a3

Please sign in to comment.