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