Explicitly set the danger class on each line because they can get out of sync when using the All toggle

This commit is contained in:
Isaac Connor 2018-02-08 09:57:11 -05:00
parent babae4629a
commit cfe53c0ffe
1 changed files with 8 additions and 9 deletions

View File

@ -2,20 +2,21 @@
function setButtonStates( element ) {
var form = element.form;
var checked = 0;
// We want to know if 1 or more monitors are checked
for ( var i=0; i < form.elements.length; i++ ) {
if (
form.elements[i].type=="checkbox"
&&
form.elements[i].name=="markMids[]"
&&
form.elements[i].checked
) {
if ( checked++ > 1 )
break;
var tr = $j(form.elements[i]).closest("tr");
if ( form.elements[i].checked ) {
checked ++;
tr.addClass("danger");
} else {
tr.removeClass("danger");
}
}
}
$(element).closest("tr").toggleClass("danger");
if ( checked ) {
form.editBtn.disabled = false;
form.deleteBtn.disabled = false;
@ -87,8 +88,6 @@ function reloadWindow() {
}
function initPage() {
jsTranslatedAddText = translatedAddText;
jsTranslatedCloneText = translatedCloneText;
reloadWindow.periodical( consoleRefreshTimeout );
if ( showVersionPopup )
createPopup( '?view=version', 'zmVersion', 'version' );
@ -96,7 +95,7 @@ function initPage() {
createPopup( '?view=donate', 'zmDonate', 'donate' );
// Makes table sortable
$j( function() {
$j( function() {
$j( "#consoleTableBody" ).sortable({
handle: ".glyphicon-sort",
update: applySort,